Skip to content

Commit

Permalink
Run SignificanceLookup BackgroundFrequency query in its own IndexSear…
Browse files Browse the repository at this point in the history
…cher (elastic#99704)

Use a brand new index searcher so the query runs on the current thread.
  • Loading branch information
iverase authored Sep 20, 2023
1 parent a5d07ee commit d279791
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ private void indexEqualTestData() throws ExecutionException, InterruptedExceptio
indexRandom(true, false, indexRequestBuilders);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99690")
public void testScriptScore() throws ExecutionException, InterruptedException, IOException {
String type = randomBoolean() ? "text" : "long";
indexRandomFrequencies01(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ private long getBackgroundFrequency(Query query) throws IOException {
if (backgroundFilter != null) {
query = new BooleanQuery.Builder().add(query, Occur.FILTER).add(backgroundFilter, Occur.FILTER).build();
}
return context.searcher().count(query);
// use a brand new index searcher as we want to run this query on the current thread
return new IndexSearcher(context.searcher().getIndexReader()).count(query);
}

private TermsEnum getTermsEnum(String field) throws IOException {
Expand Down

0 comments on commit d279791

Please sign in to comment.