Skip to content

Commit

Permalink
test typos
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <[email protected]>
  • Loading branch information
sandeshkr419 committed Mar 9, 2024
1 parent c2e88ec commit b7fa2c0
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ protected List<ValuesSourceType> getSupportedValuesSourceTypes() {
}

public void testUsesGlobalOrdinalsByDefault() throws Exception {
boolean randomizeAggregatorImpl = false;
Directory directory = newDirectory();
RandomIndexWriter indexWriter = new RandomIndexWriter(random(), directory);
indexWriter.close();
Expand All @@ -239,35 +240,35 @@ public void testUsesGlobalOrdinalsByDefault() throws Exception {
.field("string");
MappedFieldType fieldType = new KeywordFieldMapper.KeywordFieldType("string");

TermsAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, false, fieldType);
TermsAggregator aggregator = createAggregator(aggregationBuilder, indexSearcher, randomizeAggregatorImpl, fieldType);
assertThat(aggregator, instanceOf(GlobalOrdinalsStringTermsAggregator.class));
GlobalOrdinalsStringTermsAggregator globalAgg = (GlobalOrdinalsStringTermsAggregator) aggregator;
assertThat(globalAgg.descriptCollectionStrategy(), equalTo("dense"));

// Infers depth_first because the maxOrd is 0 which is less than the size
aggregationBuilder.subAggregation(AggregationBuilders.cardinality("card").field("string"));
aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
aggregator = createAggregator(aggregationBuilder, indexSearcher, randomizeAggregatorImpl, fieldType);
assertThat(aggregator, instanceOf(GlobalOrdinalsStringTermsAggregator.class));
globalAgg = (GlobalOrdinalsStringTermsAggregator) aggregator;
assertThat(globalAgg.collectMode, equalTo(Aggregator.SubAggCollectionMode.DEPTH_FIRST));
assertThat(globalAgg.descriptCollectionStrategy(), equalTo("remap"));

aggregationBuilder.collectMode(Aggregator.SubAggCollectionMode.DEPTH_FIRST);
aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
aggregator = createAggregator(aggregationBuilder, indexSearcher, randomizeAggregatorImpl, fieldType);
assertThat(aggregator, instanceOf(GlobalOrdinalsStringTermsAggregator.class));
globalAgg = (GlobalOrdinalsStringTermsAggregator) aggregator;
assertThat(globalAgg.collectMode, equalTo(Aggregator.SubAggCollectionMode.DEPTH_FIRST));
assertThat(globalAgg.descriptCollectionStrategy(), equalTo("remap"));

aggregationBuilder.collectMode(Aggregator.SubAggCollectionMode.BREADTH_FIRST);
aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
aggregator = createAggregator(aggregationBuilder, indexSearcher, randomizeAggregatorImpl, fieldType);
assertThat(aggregator, instanceOf(GlobalOrdinalsStringTermsAggregator.class));
globalAgg = (GlobalOrdinalsStringTermsAggregator) aggregator;
assertThat(globalAgg.collectMode, equalTo(Aggregator.SubAggCollectionMode.BREADTH_FIRST));
assertThat(globalAgg.descriptCollectionStrategy(), equalTo("dense"));

aggregationBuilder.order(BucketOrder.aggregation("card", true));
aggregator = createAggregator(aggregationBuilder, indexSearcher, fieldType);
aggregator = createAggregator(aggregationBuilder, indexSearcher, randomizeAggregatorImpl, fieldType);
assertThat(aggregator, instanceOf(GlobalOrdinalsStringTermsAggregator.class));
globalAgg = (GlobalOrdinalsStringTermsAggregator) aggregator;
assertThat(globalAgg.descriptCollectionStrategy(), equalTo("remap"));
Expand Down Expand Up @@ -350,9 +351,8 @@ private void testSimple(
ADD_SORTED_SET_FIELD_INDEXED.apply(document, "string", "e");
indexWriter.addDocument(document);
indexWriter.deleteDocuments(new Term("string", "e"));
assertEquals(5, indexWriter.getDocStats().maxDoc);
assertEquals(5, indexWriter.getDocStats().maxDoc); // deleted document still in segment
}
assertEquals(4, indexWriter.getDocStats().numDocs);

try (IndexReader indexReader = maybeWrapReaderEs(indexWriter.getReader())) {
IndexSearcher indexSearcher = newIndexSearcher(indexReader);
Expand Down

0 comments on commit b7fa2c0

Please sign in to comment.