Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] TermsAggregatorTests flaky test fix #13738

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,33 +353,40 @@ private void testSimple(
newIndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE)
)
) {
List<Document> documents = new ArrayList<>();
Document document = new Document();
addFieldConsumer.apply(document, "string", "a");
addFieldConsumer.apply(document, "string", "b");
indexWriter.addDocument(document);
documents.add(document);

document = new Document();
addFieldConsumer.apply(document, "string", "");
addFieldConsumer.apply(document, "string", "c");
addFieldConsumer.apply(document, "string", "a");
indexWriter.addDocument(document);
documents.add(document);

document = new Document();
addFieldConsumer.apply(document, "string", "b");
addFieldConsumer.apply(document, "string", "d");
indexWriter.addDocument(document);
documents.add(document);

document = new Document();
addFieldConsumer.apply(document, "string", "");
if (includeDocCountField) {
// Adding _doc_count to one document
document.add(new NumericDocValuesField("_doc_count", 10));
}
indexWriter.addDocument(document);
documents.add(document);

if (includeDeletedDocumentsInSegment) {
document = new Document();
ADD_SORTED_SET_FIELD_INDEXED.apply(document, "string", "e");
indexWriter.addDocument(document);
documents.add(document);
indexWriter.addDocuments(documents);
indexWriter.deleteDocuments(new Term("string", "e"));
assertEquals(5, indexWriter.getDocStats().maxDoc); // deleted document still in segment
} else {
indexWriter.addDocuments(documents);
}

try (IndexReader indexReader = maybeWrapReaderEs(indexWriter.getReader())) {
Expand Down
Loading