lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r937579 - /lucene/dev/trunk/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
Date Sat, 24 Apr 2010 02:36:50 GMT
Author: koji
Date: Sat Apr 24 02:36:50 2010
New Revision: 937579

URL: http://svn.apache.org/viewvc?rev=937579&view=rev
Log:
SOLR-1887: add warning log when hl.useFastVectoryHighlighter=true specified on the field that
termPositions or termOffsets are not stored.

Modified:
    lucene/dev/trunk/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java?rev=937579&r1=937578&r2=937579&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java Sat
Apr 24 02:36:50 2010
@@ -354,10 +354,14 @@ public class DefaultSolrHighlighter exte
    */
   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,



Mime
View raw message