BooleanQuery booleanQuery = new BooleanQuery(); TermQuery termQueryA = new TermQuery(new Term("field", "valueA")); TermQuery termQueryB = new TermQuery(new Term("field", "valueB")); booleanQuery.Add(termQueryA, Occur.MUST); booleanQuery.Add(termQueryB, Occur.SHOULD); booleanQuery.SetBoost(1.5f);
BooleanQuery booleanQuery = new BooleanQuery(); Query queryA = new TermQuery(new Term("field", "valueA")); Query queryB = new TermQuery(new Term("field", "valueB")); booleanQuery.Add(queryA, Occur.MUST); booleanQuery.Add(queryB, Occur.SHOULD); booleanQuery.Boost = 2.0f;This example is similar to the first one but uses the Boost property of the BooleanQuery object to set the boost value instead of the SetBoost method. The Lucene.Net.Search namespace provides the BooleanQuery class.