diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 7868361833e..d93bcb3de37 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -425,6 +425,10 @@ Bug Fixes * SOLR-7169: bin/solr status should return exit code 3, not 0 if Solr is not running (Dominik Siebel via Timothy Potter) +* SOLR-8341: Fix JSON Facet API excludeTags when specified in the + form of domain:{excludeTags:mytag} (yonik) + + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java b/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java index add5548a1ab..d8d233b0b65 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java +++ b/solr/core/src/java/org/apache/solr/search/facet/FacetRequest.java @@ -295,7 +295,7 @@ abstract class FacetParser { Map domainMap = (Map) m.get("domain"); if (domainMap != null) { - excludeTags = getStringList(m, "excludeTags"); + excludeTags = getStringList(domainMap, "excludeTags"); if (excludeTags != null) { getDomain().excludeTags = excludeTags; } diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java index f7bcbc1e75a..d4c1c00a16e 100644 --- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java +++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java @@ -940,14 +940,14 @@ public class TestJsonFacets extends SolrTestCaseHS { "}" ); - // terms facet with nested query facet (with excludeTags) + // terms facet with nested query facet (with excludeTags, using new format inside domain:{}) client.testJQ(params(p, "q", "*:*", "fq", "{!tag=doc6,allfilt}-id:6", "fq","{!tag=doc3,allfilt}-id:3" , "json.facet", "{processEmpty:true, " + " f0:{${terms} type:terms, field:${cat_s}, facet:{nj:{query:'${where_s}:NJ'}} } " + - ",f1:{${terms} type:terms, field:${cat_s}, excludeTags:doc3, missing:true, facet:{nj:{query:'${where_s}:NJ'}} } " + - ",f2:{${terms} type:terms, field:${cat_s}, excludeTags:allfilt,missing:true, facet:{nj:{query:'${where_s}:NJ'}} } " + - ",f3:{${terms} type:terms, field:${cat_s}, excludeTags:doc6, missing:true, facet:{nj:{query:'${where_s}:NJ'}} } " + + ",f1:{${terms} type:terms, field:${cat_s}, domain:{excludeTags:doc3}, missing:true, facet:{nj:{query:'${where_s}:NJ'}} } " + + ",f2:{${terms} type:terms, field:${cat_s}, domain:{excludeTags:allfilt},missing:true, facet:{nj:{query:'${where_s}:NJ'}} } " + + ",f3:{${terms} type:terms, field:${cat_s}, domain:{excludeTags:doc6}, missing:true, facet:{nj:{query:'${where_s}:NJ'}} } " + "}" ) , "facets=={ count:4, " + @@ -961,7 +961,7 @@ public class TestJsonFacets extends SolrTestCaseHS { // range facet with sub facets and stats, with "other:all" (with excludeTags) client.testJQ(params(p, "q", "*:*", "fq", "{!tag=doc6,allfilt}-id:6", "fq","{!tag=doc3,allfilt}-id:3" , "json.facet", "{processEmpty:true " + - ", f1:{type:range, field:${num_d}, start:-5, end:10, gap:5, other:all, facet:{ x:'sum(${num_i})', ny:{query:'${where_s}:NY'}} , excludeTags:allfilt }" + + ", f1:{type:range, field:${num_d}, start:-5, end:10, gap:5, other:all, facet:{ x:'sum(${num_i})', ny:{query:'${where_s}:NY'}} , domain:{excludeTags:allfilt} }" + ", f2:{type:range, field:${num_d}, start:-5, end:10, gap:5, other:all, facet:{ x:'sum(${num_i})', ny:{query:'${where_s}:NY'}} }" + "}" )