mirror of https://github.com/apache/lucene.git
SOLR-1268: ignore undefined field
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@897611 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f6d7daf239
commit
2df8e5d5f5
|
@ -346,9 +346,14 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
|
|||
return fragments;
|
||||
}
|
||||
|
||||
/*
|
||||
* If fieldName is undefined, this method returns false, then
|
||||
* doHighlightingByHighlighter() will do nothing for the field.
|
||||
*/
|
||||
private boolean useFastVectorHighlighter( SolrParams params, IndexSchema schema, String fieldName ){
|
||||
SchemaField schemaField = schema.getField( fieldName );
|
||||
return schemaField.storeTermPositions() &&
|
||||
SchemaField schemaField = schema.getFieldOrNull( fieldName );
|
||||
return schemaField != null &&
|
||||
schemaField.storeTermPositions() &&
|
||||
schemaField.storeTermOffsets() &&
|
||||
!params.getFieldBool( fieldName, HighlightParams.USE_HIGHLIGHTER, false );
|
||||
}
|
||||
|
@ -357,7 +362,8 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
|
|||
int docId, Document doc, String fieldName ) throws IOException {
|
||||
SolrParams params = req.getParams();
|
||||
String[] docTexts = doc.getValues(fieldName);
|
||||
if (docTexts == null) return;
|
||||
// according to Document javadoc, doc.getValues() never returns null. check empty instead of null
|
||||
if (docTexts.length == 0) return;
|
||||
|
||||
SolrIndexSearcher searcher = req.getSearcher();
|
||||
IndexSchema schema = searcher.getSchema();
|
||||
|
|
Loading…
Reference in New Issue