SOLR-7804: Fix test bug where it was randomly generating 2 identical facet.pivot params w/o realizing it

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1692552 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2015-07-24 17:34:08 +00:00
parent 8f58afc41a
commit f00964e7db
1 changed files with 7 additions and 2 deletions

View File

@ -39,6 +39,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -165,11 +166,15 @@ public class TestCloudPivotFacet extends AbstractFullDistribZkTestBase {
}
ModifiableSolrParams pivotP = params(FACET,"true");
pivotP.add(FACET_PIVOT, buildPivotParamValue(buildRandomPivot(fieldNames)));
// put our FACET_PIVOT params in a set in case we just happen to pick the same one twice
LinkedHashSet<String> pivotParamValues = new LinkedHashSet<String>();
pivotParamValues.add(buildPivotParamValue(buildRandomPivot(fieldNames)));
if (random().nextBoolean()) {
pivotP.add(FACET_PIVOT, buildPivotParamValue(buildRandomPivot(fieldNames)));
pivotParamValues.add(buildPivotParamValue(buildRandomPivot(fieldNames)));
}
pivotP.set(FACET_PIVOT, pivotParamValues.toArray(new String[pivotParamValues.size()]));
// keep limit low - lots of unique values, and lots of depth in pivots
pivotP.add(FACET_LIMIT, ""+TestUtil.nextInt(random(),1,17));