Skip to content

Advanced Querying

cardinal252 edited this page Sep 27, 2013 · 2 revisions

Here are some of the special features in Lucinq

Query manipulation

One really cool feature of lucene is the ability to manipulate and re-execute queries. This means that if say - you only want to change a single parameter, then can simply change it

`` IQueryBuilder queryBuilder = new QueryBuilder();

queryBuilder.Term(BBCFields.Title, "africa", key: "africacriteria");

LuceneSearchResult results = ExecuteAndAssert(luceneSearch, queryBuilder, 8);

queryBuilder.Queries.Remove("africacriteria"); queryBuilder.Term(BBCFields.Title, "report", key: "businesscriteria");

Console.WriteLine("\r\nSecond Criteria");

LuceneSearchResult results2 = ExecuteAndAssert(luceneSearch, queryBuilder, 5);

Assert.AreNotEqual(results.TotalHits, results2.TotalHits); ``