Skip to content

Commit

Permalink
test typos
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
  • Loading branch information
sandeshkr419 committed Mar 12, 2024
1 parent 9be19a0 commit 128db47
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 128db47

Please sign in to comment.