From 2c7d86bc4dd263a3cc29a3fb911e853060513db2 Mon Sep 17 00:00:00 2001 From: Mikhail Khludnev Date: Fri, 19 Aug 2016 16:50:22 +0300 Subject: [PATCH] SOLR-8644: Test asserts that block join facets work with parent level fq exclusions --- solr/CHANGES.txt | 2 ++ .../search/join/BlockJoinFacetSimpleTest.java | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 738360ec383..9ab6005b371 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -289,6 +289,8 @@ Other Changes * SOLR-8643: BlockJoinFacetComponent is substituted by BlockJoinFacetDocSetComponent. It doesn't need to change solrconfig.xml (Mikhail Khludnev) +* SOLR-8644: Test asserts that block join facets work with parent level fq exclusions. (Dr. Oleg Savrasov via Mikhail Khludnev) + ================== 6.1.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetSimpleTest.java b/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetSimpleTest.java index a34e1d9c295..5e610cfe22e 100644 --- a/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetSimpleTest.java +++ b/solr/core/src/test/org/apache/solr/search/join/BlockJoinFacetSimpleTest.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.List; import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.request.SolrQueryRequest; import org.junit.BeforeClass; import org.junit.Test; @@ -94,4 +95,27 @@ public class BlockJoinFacetSimpleTest extends SolrTestCaseJ4 { } } + @Test + public void testParentLevelFQExclusion() { + SolrQueryRequest req = req( + "qt", handler, + "q", "{!parent which=type_s:parent}+SIZE_s:XL", + "fq", "{!term f=BRAND_s tag=rbrand}Nike", + "facet", "true", + "facet.field", "BRAND_s", + "child.facet.field", "COLOR_s"); + assertQ("no exclusion, brand facet got only one Nike",req, "//*[@numFound='" + 1 + "']", + "count(//lst[@name='BRAND_s']/int[.='1'])=1"); + + assertQ("nike filter is excluded, expecting both brand in facet",req( + "qt", handler, + "q", "{!parent which=type_s:parent}+SIZE_s:XL", + "fq", "{!term f=BRAND_s tag=rbrand}Nike", + "facet", "true", + "facet.field", "{!ex=rbrand}BRAND_s", + "child.facet.field", "COLOR_s"), + "//*[@numFound='" + 1 + "']", + "count(//lst[@name='BRAND_s']/int[.='1'])=2"); + + } }