You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2017/04/01 01:25:13 UTC

[2/4] lucene-solr:branch_6x: SOLR-10399: Generalize some internal facet logic to simplify points/non-points field handling

SOLR-10399: Generalize some internal facet logic to simplify points/non-points field handling

(cherry picked from commit b60b86ecab797396ab6bd8be82740191922b0aa2)


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

Branch: refs/heads/branch_6x
Commit: eb9a4b962088ee38358303cc8e75d3b83c910ef3
Parents: 1ae3cf4
Author: Chris Hostetter <ho...@apache.org>
Authored: Fri Mar 31 17:01:42 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Fri Mar 31 17:02:08 2017 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                      |  2 ++
 .../java/org/apache/solr/request/SimpleFacets.java    | 14 +++-----------
 2 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb9a4b96/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 82fb25d..5f11bcf 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -103,6 +103,8 @@ Other Changes
 
 * SOLR-10338: Configure SecureRandom non blocking for tests. (Mihaly Toth, hossman, Ishan Chattopadhyaya, via Mark Miller)
 
+* SOLR-10399: Generalize some internal facet logic to simplify points/non-points field handling (Adrien Grand, hossman)
+
 ==================  6.5.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb9a4b96/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
index b452802..8972121 100644
--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
@@ -851,17 +851,9 @@ public class SimpleFacets {
     SchemaField sf = searcher.getSchema().getField(field);
     FieldType ft = sf.getType();
     NamedList<Integer> res = new NamedList<>();
-    if (ft.isPointField()) {
-      for (String term : terms) {
-        int count = searcher.numDocs(ft.getFieldQuery(null, sf, term), parsed.docs);
-        res.add(term, count);
-      }
-    } else {
-      for (String term : terms) {
-        String internal = ft.toInternal(term);
-        int count = searcher.numDocs(new TermQuery(new Term(field, internal)), parsed.docs);
-        res.add(term, count);
-      }
+    for (String term : terms) {
+      int count = searcher.numDocs(ft.getFieldQuery(null, sf, term), parsed.docs);
+      res.add(term, count);
     }
     return res;    
   }