Skip to content

Apache Lucene open-source search software

SOLR-10155: For numeric types facet.contains= and facet.prefix= are now rejected. (Gus Heck, Christine Poerschke)

Christine Poerschke43474312eb2b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 09912eeb48f..fa4d33b65de 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -271,6 +271,8 @@ Other Changes
* SOLR-10219: re-enable HDFS tests under JDK9 (hossman, Uwe Schindler)
+* SOLR-10155: For numeric types facet.contains= and facet.prefix= are now rejected.
+ (Gus Heck, Christine Poerschke)
================== 6.4.2 ==================
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 41909580746..5370dd9f3f9 100644
--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
@@ -484,15 +484,13 @@ public class SimpleFacets {
case FCS:
assert ft.isPointField() || !multiToken;
if (ft.isPointField() || (ft.getNumberType() != null && !sf.multiValued())) {
- // force numeric faceting
- if (prefix != null && !prefix.isEmpty()) {
+ if (prefix != null) {
throw new SolrException(ErrorCode.BAD_REQUEST, FacetParams.FACET_PREFIX + " is not supported on numeric types");
}
if (termFilter != null) {
- final boolean supportedOperation = (termFilter instanceof SubstringBytesRefFilter) && ((SubstringBytesRefFilter) termFilter).substring().isEmpty();
- if (!supportedOperation) {
- throw new SolrException(ErrorCode.BAD_REQUEST, FacetParams.FACET_CONTAINS + " is not supported on numeric types");
- }
+ throw new SolrException(ErrorCode.BAD_REQUEST, "BytesRef term filters ("
+ + 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) {