SOLR-10155: For numeric types facet.contains= and facet.prefix= are now rejected.

(Gus Heck, Christine Poerschke)
This commit is contained in:
Christine Poerschke 2017-03-03 12:03:41 +00:00
parent da113fde77
commit 43474312eb
2 changed files with 6 additions and 6 deletions

View File

@ -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 ==================

View File

@ -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) {