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

Call weight.getQuery().toString() once per query instead of once per leaf #524

Merged
merged 1 commit into from
Dec 2, 2022
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 @@ -239,6 +239,9 @@ public static LeafSlice[] slices(
@Override
protected void search(List<LeafReaderContext> leaves, Weight weight, Collector collector)
throws IOException {
boolean isDrillSidewaysQueryOrCompletionQuery =
weight.getQuery() instanceof CompletionQuery
|| weight.getQuery().toString().contains("DrillSidewaysQuery");
for (LeafReaderContext ctx : leaves) { // search each subreader
// we force the use of Scorer (not BulkScorer) to make sure
// that the scorer passed to LeafCollector.setScorer supports
Expand All @@ -251,8 +254,7 @@ protected void search(List<LeafReaderContext> leaves, Weight weight, Collector c
// continue with the following leaf
continue;
}
if (weight.getQuery().toString().contains("DrillSidewaysQuery")
|| weight.getQuery() instanceof CompletionQuery) {
if (isDrillSidewaysQueryOrCompletionQuery) {
BulkScorer scorer = weight.bulkScorer(ctx);
if (scorer != null) {
try {
Expand Down