SOLR-1887: add warning log when hl.useFastVectoryHighlighter=true specified on the field that termPositions or termOffsets are not stored.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@937579 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2010-04-24 02:36:50 +00:00
parent 01def23422
commit af96066c27
1 changed files with 8 additions and 4 deletions

View File

@ -354,10 +354,14 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
*/
private boolean useFastVectorHighlighter( SolrParams params, IndexSchema schema, String fieldName ){
SchemaField schemaField = schema.getFieldOrNull( fieldName );
return schemaField != null &&
schemaField.storeTermPositions() &&
schemaField.storeTermOffsets() &&
params.getFieldBool( fieldName, HighlightParams.USE_FVH, false );
if( schemaField == null ) return false;
boolean useFvhParam = params.getFieldBool( fieldName, HighlightParams.USE_FVH, false );
if( !useFvhParam ) return false;
boolean termPosOff = schemaField.storeTermPositions() && schemaField.storeTermOffsets();
if( !termPosOff ) {
log.warn( "Solr will use Highlighter instead of FastVectorHighlighter because {} field does not store TermPositions and TermOffsets.", fieldName );
}
return termPosOff;
}
private void doHighlightingByHighlighter( Query query, SolrQueryRequest req, NamedList docSummaries,