lucene Queries Boosting queries

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

A query can be boosted to increase it's score relative to other subqueries. This is done by wrapping it with a BoostQuery

Query lessRelevantQuery = new TermQuery(new Term("fieldname", "ipsum"));
//Five times as interesting
Query highlyRelevantQuery = new BoostQuery(
         new TermQuery(new Term("fieldname", "lorem")), 
         5.0f);
BooleanQuery query = new BooleanQuery.Builder()
        .add(lessRelevantQuery, BooleanClause.Occur.SHOULD) 
        .add(highlyRelevantQuery, BooleanClause.Occur.SHOULD) 
        .build();


Got any lucene Question?