SOLR-628 -- enable runtime 'forceElevation' changes

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@735117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2009-01-16 20:23:41 +00:00
parent 088ad18d2b
commit afe37144ea
1 changed files with 4 additions and 1 deletions

View File

@ -320,6 +320,9 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
return; return;
} }
// A runtime parameter can alter the config value for forceElevation
boolean force = params.getBool( FORCE_ELEVATION, forceElevation );
Query query = rb.getQuery(); Query query = rb.getQuery();
if( query == null ) { if( query == null ) {
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
@ -364,7 +367,7 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
SortField[] current = sortSpec.getSort().getSort(); SortField[] current = sortSpec.getSort().getSort();
ArrayList<SortField> sorts = new ArrayList<SortField>( current.length + 1 ); ArrayList<SortField> sorts = new ArrayList<SortField>( current.length + 1 );
// Perhaps force it to always sort by score // Perhaps force it to always sort by score
if( forceElevation && current[0].getType() != SortField.SCORE ) { if( force && current[0].getType() != SortField.SCORE ) {
sorts.add( new SortField(idField, sorts.add( new SortField(idField,
new ElevationComparatorSource(booster.priority), false ) ); new ElevationComparatorSource(booster.priority), false ) );
modify = true; modify = true;