SOLR-10722: UH optimize for Solr's getFieldInfos

This commit is contained in:
David Smiley 2017-06-06 11:05:17 -04:00
parent 622e527cf2
commit 29de0f75e8
2 changed files with 9 additions and 0 deletions

View File

@ -352,6 +352,8 @@ Optimizations
so that the second phase which would normally involve calculating the domain for the bucket
can be skipped entirely, leading to large performance improvements. (yonik)
* SOLR-10722: Speed up Solr's use of the UnifiedHighlighter be re-using FieldInfos. (David Smiley)
Other Changes
----------------------

View File

@ -26,6 +26,7 @@ import java.util.Set;
import java.util.function.Predicate;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.uhighlight.CustomSeparatorBreakIterator;
@ -263,6 +264,12 @@ public class UnifiedSolrHighlighter extends SolrHighlighter implements PluginInf
}
}
// optimization for Solr which keeps a FieldInfos on-hand
@Override
protected FieldInfo getFieldInfo(String field) {
return ((SolrIndexSearcher)searcher).getFieldInfos().fieldInfo(field);
}
@Override
public int getMaxNoHighlightPassages(String field) {
boolean defaultSummary = params.getFieldBool(field, HighlightParams.DEFAULT_SUMMARY, false);