You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2017/06/06 15:07:35 UTC

lucene-solr:branch_6x: SOLR-10722: UH optimize for Solr's getFieldInfos

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x af64fc56b -> eaf49204a


SOLR-10722: UH optimize for Solr's getFieldInfos

(cherry picked from commit 29de0f7)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/eaf49204
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/eaf49204
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/eaf49204

Branch: refs/heads/branch_6x
Commit: eaf49204a1955bb31dc4fc109c80068ab10acb99
Parents: af64fc5
Author: David Smiley <ds...@apache.org>
Authored: Tue Jun 6 11:05:17 2017 -0400
Committer: David Smiley <ds...@apache.org>
Committed: Tue Jun 6 11:07:26 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                              | 2 ++
 .../org/apache/solr/highlight/UnifiedSolrHighlighter.java     | 7 +++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eaf49204/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 29afd47..ce5041f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -115,6 +115,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
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eaf49204/solr/core/src/java/org/apache/solr/highlight/UnifiedSolrHighlighter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/highlight/UnifiedSolrHighlighter.java b/solr/core/src/java/org/apache/solr/highlight/UnifiedSolrHighlighter.java
index e9c842c..818b06b 100644
--- a/solr/core/src/java/org/apache/solr/highlight/UnifiedSolrHighlighter.java
+++ b/solr/core/src/java/org/apache/solr/highlight/UnifiedSolrHighlighter.java
@@ -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.postingshighlight.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);