SOLR-10520: fix child.facet.field counts

This commit is contained in:
Mikhail Khludnev 2017-04-25 12:27:18 +03:00
parent cd02dd7d4a
commit 680f4d7fd3
3 changed files with 16 additions and 7 deletions

View File

@ -241,6 +241,7 @@ Bug Fixes
when there was a mincount > 1. This has been corrected by changing numBuckets cardinality processing to
ignore mincount > 1 for non-distributed requests. (yonik)
* SOLR-10520: child.facet.field doubled counts at least when rows>0. (Dr. Oleg Savrasov via Mikhail Khludnev)
Other Changes
----------------------

View File

@ -124,6 +124,7 @@ abstract class BlockJoinFacetComponentSupport extends SearchComponent {
@Override
public void handleResponses(ResponseBuilder rb, ShardRequest sreq) {
if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
NamedList collectedChildFacetFields = getChildFacetFields(rb.rsp.getValues(), true);
List<ShardResponse> responses = sreq.responses;
for (ShardResponse shardResponse : responses) {
@ -131,6 +132,7 @@ abstract class BlockJoinFacetComponentSupport extends SearchComponent {
mergeFacets(collectedChildFacetFields, shardChildFacetFields);
}
}
}
@Override
public void finishStage(ResponseBuilder rb) {

View File

@ -130,12 +130,18 @@ public class BlockJoinFacetDistribTest extends SolrCloudTestCase{
// to parent query
final String childQueryClause = "COLOR_s:("+(matchingColors.toString().replaceAll("[,\\[\\]]", " "))+")";
final boolean oldFacetsEnabled = random().nextBoolean();
QueryResponse results = query("q", "{!parent which=\"type_s:parent\"}"+childQueryClause,
"facet", random().nextBoolean() ? "true":"false",
"facet", oldFacetsEnabled ? "true":"false", // try to enforce multiple phases
oldFacetsEnabled ? "facet.field" : "ignore" , "BRAND_s",
oldFacetsEnabled&&usually() ? "facet.limit" : "ignore" , "1",
oldFacetsEnabled&&usually() ? "facet.mincount" : "ignore" , "2",
oldFacetsEnabled&&usually() ? "facet.overrequest.count" : "ignore" , "0",
"qt", random().nextBoolean() ? "blockJoinDocSetFacetRH" : "blockJoinFacetRH",
"child.facet.field", "COLOR_s",
"child.facet.field", "SIZE_s",
"rows","0" // we care only abt results
"distrib.singlePass", random().nextBoolean() ? "true":"false",
"rows", random().nextBoolean() ? "0":"10"
);
NamedList<Object> resultsResponse = results.getResponse();
assertNotNull(resultsResponse);