You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2017/08/01 19:33:48 UTC

[1/3] lucene-solr:master: SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1 and log a warning.

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7_0 edc529ea1 -> 4fddc0eac
  refs/heads/branch_7x 5afe7f6ef -> b8e771d7d
  refs/heads/master d696b5986 -> 6b399d7a6


SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1 and log a warning.


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

Branch: refs/heads/master
Commit: 6b399d7a6178ae04b4905f31921de1e31fa6c033
Parents: d696b59
Author: Steve Rowe <sa...@apache.org>
Authored: Tue Aug 1 15:32:54 2017 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Tue Aug 1 15:32:54 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                        |  3 +++
 .../src/java/org/apache/solr/request/NumericFacets.java |  2 +-
 .../src/java/org/apache/solr/request/SimpleFacets.java  | 12 ++++++++----
 .../src/test/org/apache/solr/request/TestFaceting.java  |  2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6b399d7a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 78456ae..bd56c6a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -604,6 +604,9 @@ Other Changes
 
 * SOLR-9321: Remove deprecated methods of ClusterState. (Jason Gerlowski, ishan, Cao Manh Dat)
 
+* SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1
+  and log a warning. (Steve Rowe)
+
 ==================  6.7.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/6b399d7a/solr/core/src/java/org/apache/solr/request/NumericFacets.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/NumericFacets.java b/solr/core/src/java/org/apache/solr/request/NumericFacets.java
index fd17f1f..b509995 100644
--- a/solr/core/src/java/org/apache/solr/request/NumericFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/NumericFacets.java
@@ -407,7 +407,7 @@ final class NumericFacets {
 
   private static NamedList<Integer> getCountsMultiValued(SolrIndexSearcher searcher, DocSet docs, String fieldName, int offset, int limit, int mincount, boolean missing, String sort) throws IOException {
     // If facet.mincount=0 with PointFields the only option is to get the values from DocValues
-    // not currently supported. See SOLR-10033
+    // not currently supported. See SOLR-11174
     mincount = Math.max(mincount, 1);
     final SchemaField sf = searcher.getSchema().getField(fieldName);
     final FieldType ft = sf.getType();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6b399d7a/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 f39eda4..085b47e 100644
--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
@@ -17,6 +17,7 @@
 package org.apache.solr.request;
 
 import java.io.IOException;
+import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -93,6 +94,8 @@ import org.apache.solr.search.grouping.GroupingSpecification;
 import org.apache.solr.util.BoundedTreeSet;
 import org.apache.solr.util.DefaultSolrThreadFactory;
 import org.apache.solr.util.RTimer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.solr.common.params.CommonParams.SORT;
 
@@ -103,6 +106,7 @@ import static org.apache.solr.common.params.CommonParams.SORT;
  * to leverage any of its functionality.
  */
 public class SimpleFacets {
+  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   
   /** The main set of documents all facet counts should be relative to */
   protected DocSet docsOrig;
@@ -492,10 +496,10 @@ public class SimpleFacets {
                       + FacetParams.FACET_CONTAINS + ", "
                       + FacetParams.FACET_EXCLUDETERMS + ") are not supported on numeric types");
             }
-//            We should do this, but mincount=0 is currently the default
-//            if (ft.isPointField() && mincount <= 0) {
-//              throw new SolrException(ErrorCode.BAD_REQUEST, FacetParams.FACET_MINCOUNT + " <= 0 is not supported on point types");
-//            }
+            if (ft.isPointField() && mincount <= 0) { // default is mincount=0.  See SOLR-10033 & SOLR-11174.
+              LOG.warn("Raising facet.mincount from " + mincount + " to 1, because field " + field + " is Points-based.");
+              mincount = 1;
+            }
             counts = NumericFacets.getCounts(searcher, docs, field, offset, limit, mincount, missing, sort);
           } else {
             PerSegmentSingleValuedFaceting ps = new PerSegmentSingleValuedFaceting(searcher, docs, field, offset, limit, mincount, missing, sort, prefix, termFilter);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6b399d7a/solr/core/src/test/org/apache/solr/request/TestFaceting.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/request/TestFaceting.java b/solr/core/src/test/org/apache/solr/request/TestFaceting.java
index 9559b4c..32cb177 100644
--- a/solr/core/src/test/org/apache/solr/request/TestFaceting.java
+++ b/solr/core/src/test/org/apache/solr/request/TestFaceting.java
@@ -335,7 +335,7 @@ public class TestFaceting extends SolrTestCaseJ4 {
 
   @Test
   public void testFacetSortWithMinCount0() {
-    assumeFalse("facet.mincount=0 doesn't work with point fields (SOLR-10033) or single valued DV",
+    assumeFalse("facet.mincount=0 doesn't work with point fields (SOLR-11174) or single valued DV",
                 Boolean.getBoolean(NUMERIC_POINTS_SYSPROP) || Boolean.getBoolean(NUMERIC_DOCVALUES_SYSPROP));
     
     assertU(adoc("id", "1", "f_td", "-420.126"));


[3/3] lucene-solr:branch_7_0: SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1 and log a warning.

Posted by sa...@apache.org.
SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1 and log a warning.


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

Branch: refs/heads/branch_7_0
Commit: 4fddc0eac26120969561d3336c29c547b342ffbf
Parents: edc529e
Author: Steve Rowe <sa...@apache.org>
Authored: Tue Aug 1 15:32:54 2017 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Tue Aug 1 15:33:41 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                        |  3 +++
 .../src/java/org/apache/solr/request/NumericFacets.java |  2 +-
 .../src/java/org/apache/solr/request/SimpleFacets.java  | 12 ++++++++----
 .../src/test/org/apache/solr/request/TestFaceting.java  |  2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4fddc0ea/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 988dfea..1f1b93f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -497,6 +497,9 @@ Other Changes
 
 * SOLR-9321: Remove deprecated methods of ClusterState. (Jason Gerlowski, ishan, Cao Manh Dat)
 
+* SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1
+  and log a warning. (Steve Rowe)
+
 ==================  6.7.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/4fddc0ea/solr/core/src/java/org/apache/solr/request/NumericFacets.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/NumericFacets.java b/solr/core/src/java/org/apache/solr/request/NumericFacets.java
index fd17f1f..b509995 100644
--- a/solr/core/src/java/org/apache/solr/request/NumericFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/NumericFacets.java
@@ -407,7 +407,7 @@ final class NumericFacets {
 
   private static NamedList<Integer> getCountsMultiValued(SolrIndexSearcher searcher, DocSet docs, String fieldName, int offset, int limit, int mincount, boolean missing, String sort) throws IOException {
     // If facet.mincount=0 with PointFields the only option is to get the values from DocValues
-    // not currently supported. See SOLR-10033
+    // not currently supported. See SOLR-11174
     mincount = Math.max(mincount, 1);
     final SchemaField sf = searcher.getSchema().getField(fieldName);
     final FieldType ft = sf.getType();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4fddc0ea/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 f39eda4..085b47e 100644
--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
@@ -17,6 +17,7 @@
 package org.apache.solr.request;
 
 import java.io.IOException;
+import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -93,6 +94,8 @@ import org.apache.solr.search.grouping.GroupingSpecification;
 import org.apache.solr.util.BoundedTreeSet;
 import org.apache.solr.util.DefaultSolrThreadFactory;
 import org.apache.solr.util.RTimer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.solr.common.params.CommonParams.SORT;
 
@@ -103,6 +106,7 @@ import static org.apache.solr.common.params.CommonParams.SORT;
  * to leverage any of its functionality.
  */
 public class SimpleFacets {
+  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   
   /** The main set of documents all facet counts should be relative to */
   protected DocSet docsOrig;
@@ -492,10 +496,10 @@ public class SimpleFacets {
                       + FacetParams.FACET_CONTAINS + ", "
                       + FacetParams.FACET_EXCLUDETERMS + ") are not supported on numeric types");
             }
-//            We should do this, but mincount=0 is currently the default
-//            if (ft.isPointField() && mincount <= 0) {
-//              throw new SolrException(ErrorCode.BAD_REQUEST, FacetParams.FACET_MINCOUNT + " <= 0 is not supported on point types");
-//            }
+            if (ft.isPointField() && mincount <= 0) { // default is mincount=0.  See SOLR-10033 & SOLR-11174.
+              LOG.warn("Raising facet.mincount from " + mincount + " to 1, because field " + field + " is Points-based.");
+              mincount = 1;
+            }
             counts = NumericFacets.getCounts(searcher, docs, field, offset, limit, mincount, missing, sort);
           } else {
             PerSegmentSingleValuedFaceting ps = new PerSegmentSingleValuedFaceting(searcher, docs, field, offset, limit, mincount, missing, sort, prefix, termFilter);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4fddc0ea/solr/core/src/test/org/apache/solr/request/TestFaceting.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/request/TestFaceting.java b/solr/core/src/test/org/apache/solr/request/TestFaceting.java
index 9559b4c..32cb177 100644
--- a/solr/core/src/test/org/apache/solr/request/TestFaceting.java
+++ b/solr/core/src/test/org/apache/solr/request/TestFaceting.java
@@ -335,7 +335,7 @@ public class TestFaceting extends SolrTestCaseJ4 {
 
   @Test
   public void testFacetSortWithMinCount0() {
-    assumeFalse("facet.mincount=0 doesn't work with point fields (SOLR-10033) or single valued DV",
+    assumeFalse("facet.mincount=0 doesn't work with point fields (SOLR-11174) or single valued DV",
                 Boolean.getBoolean(NUMERIC_POINTS_SYSPROP) || Boolean.getBoolean(NUMERIC_DOCVALUES_SYSPROP));
     
     assertU(adoc("id", "1", "f_td", "-420.126"));


[2/3] lucene-solr:branch_7x: SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1 and log a warning.

Posted by sa...@apache.org.
SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1 and log a warning.


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

Branch: refs/heads/branch_7x
Commit: b8e771d7ddadb309ebc418a7fb59fd2428421f02
Parents: 5afe7f6
Author: Steve Rowe <sa...@apache.org>
Authored: Tue Aug 1 15:32:54 2017 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Tue Aug 1 15:33:26 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                        |  3 +++
 .../src/java/org/apache/solr/request/NumericFacets.java |  2 +-
 .../src/java/org/apache/solr/request/SimpleFacets.java  | 12 ++++++++----
 .../src/test/org/apache/solr/request/TestFaceting.java  |  2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b8e771d7/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5e56af1..7058b6d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -587,6 +587,9 @@ Other Changes
 
 * SOLR-9321: Remove deprecated methods of ClusterState. (Jason Gerlowski, ishan, Cao Manh Dat)
 
+* SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1
+  and log a warning. (Steve Rowe)
+
 ==================  6.7.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/b8e771d7/solr/core/src/java/org/apache/solr/request/NumericFacets.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/NumericFacets.java b/solr/core/src/java/org/apache/solr/request/NumericFacets.java
index fd17f1f..b509995 100644
--- a/solr/core/src/java/org/apache/solr/request/NumericFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/NumericFacets.java
@@ -407,7 +407,7 @@ final class NumericFacets {
 
   private static NamedList<Integer> getCountsMultiValued(SolrIndexSearcher searcher, DocSet docs, String fieldName, int offset, int limit, int mincount, boolean missing, String sort) throws IOException {
     // If facet.mincount=0 with PointFields the only option is to get the values from DocValues
-    // not currently supported. See SOLR-10033
+    // not currently supported. See SOLR-11174
     mincount = Math.max(mincount, 1);
     final SchemaField sf = searcher.getSchema().getField(fieldName);
     final FieldType ft = sf.getType();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b8e771d7/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 f39eda4..085b47e 100644
--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
@@ -17,6 +17,7 @@
 package org.apache.solr.request;
 
 import java.io.IOException;
+import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -93,6 +94,8 @@ import org.apache.solr.search.grouping.GroupingSpecification;
 import org.apache.solr.util.BoundedTreeSet;
 import org.apache.solr.util.DefaultSolrThreadFactory;
 import org.apache.solr.util.RTimer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.solr.common.params.CommonParams.SORT;
 
@@ -103,6 +106,7 @@ import static org.apache.solr.common.params.CommonParams.SORT;
  * to leverage any of its functionality.
  */
 public class SimpleFacets {
+  private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   
   /** The main set of documents all facet counts should be relative to */
   protected DocSet docsOrig;
@@ -492,10 +496,10 @@ public class SimpleFacets {
                       + FacetParams.FACET_CONTAINS + ", "
                       + FacetParams.FACET_EXCLUDETERMS + ") are not supported on numeric types");
             }
-//            We should do this, but mincount=0 is currently the default
-//            if (ft.isPointField() && mincount <= 0) {
-//              throw new SolrException(ErrorCode.BAD_REQUEST, FacetParams.FACET_MINCOUNT + " <= 0 is not supported on point types");
-//            }
+            if (ft.isPointField() && mincount <= 0) { // default is mincount=0.  See SOLR-10033 & SOLR-11174.
+              LOG.warn("Raising facet.mincount from " + mincount + " to 1, because field " + field + " is Points-based.");
+              mincount = 1;
+            }
             counts = NumericFacets.getCounts(searcher, docs, field, offset, limit, mincount, missing, sort);
           } else {
             PerSegmentSingleValuedFaceting ps = new PerSegmentSingleValuedFaceting(searcher, docs, field, offset, limit, mincount, missing, sort, prefix, termFilter);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b8e771d7/solr/core/src/test/org/apache/solr/request/TestFaceting.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/request/TestFaceting.java b/solr/core/src/test/org/apache/solr/request/TestFaceting.java
index 9559b4c..32cb177 100644
--- a/solr/core/src/test/org/apache/solr/request/TestFaceting.java
+++ b/solr/core/src/test/org/apache/solr/request/TestFaceting.java
@@ -335,7 +335,7 @@ public class TestFaceting extends SolrTestCaseJ4 {
 
   @Test
   public void testFacetSortWithMinCount0() {
-    assumeFalse("facet.mincount=0 doesn't work with point fields (SOLR-10033) or single valued DV",
+    assumeFalse("facet.mincount=0 doesn't work with point fields (SOLR-11174) or single valued DV",
                 Boolean.getBoolean(NUMERIC_POINTS_SYSPROP) || Boolean.getBoolean(NUMERIC_DOCVALUES_SYSPROP));
     
     assertU(adoc("id", "1", "f_td", "-420.126"));