Adding a query boost to the query.
This commit is contained in:
parent
50eab74e48
commit
6e9f4e90eb
1 changed files with 7 additions and 1 deletions
|
@ -97,6 +97,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear
|
|||
private int defaultMaxSearchSize= 1000;
|
||||
|
||||
protected static final Map<Format,Map<Result,String>> templateTable;
|
||||
private static final float QUERY_BOOST = 2.0F;
|
||||
|
||||
protected enum Format{
|
||||
HTML, XML;
|
||||
|
@ -229,6 +230,11 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear
|
|||
try{
|
||||
log.info("Searching for query term in the Index with maxHitSize "+ maxHitSize);
|
||||
log.info("Query is "+ query.toString());
|
||||
|
||||
//sets the query boost for the query. the lucene docs matching this query term
|
||||
//are multiplied by QUERY_BOOST to get their total score
|
||||
query.setBoost(QUERY_BOOST);
|
||||
|
||||
topDocs = searcherForRequest.search(query,null,maxHitSize);
|
||||
}catch(Throwable t){
|
||||
log.error("in first pass at search: " + t);
|
||||
|
|
Loading…
Add table
Reference in a new issue