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

Lucene 9.10 upgrade #626

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _artifactId = 'server'
//This is for https://github.com/gradle/gradle/issues/11308
System.setProperty("org.gradle.internal.publish.checksums.insecure", "True")

def luceneVersion = '9.9.0'
def luceneVersion = '9.10.0'
project.ext.slf4jVersion = '2.0.0-alpha1'
project.ext.grpcVersion = '1.46.0'
project.ext.lz4Version = '1.7.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ private static DocCollector buildDocCollector(CollectorCreatorContext collectorC
.collect(Collectors.toList());

DocCollector docCollector;
if (searchRequest.getQuery().hasCompletionQuery()) {
int numHitsToCollect = DocCollector.computeNumHitsToCollect(searchRequest);
// If we don't need hits, just count recalled docs
if (numHitsToCollect == 0) {
docCollector = new HitCountCollector(collectorCreatorContext, additionalCollectors);
} else if (searchRequest.getQuery().hasCompletionQuery()) {
docCollector = new MyTopSuggestDocsCollector(collectorCreatorContext, additionalCollectors);
} else if (searchRequest.getQuerySort().getFields().getSortedFieldsList().isEmpty()) {
if (hasLargeNumHits(searchRequest)) {
Expand All @@ -398,10 +402,6 @@ private static DocCollector buildDocCollector(CollectorCreatorContext collectorC
} else {
docCollector = new SortFieldCollector(collectorCreatorContext, additionalCollectors);
}
// If we don't need hits, just count recalled docs
if (docCollector.getNumHitsToCollect() == 0) {
docCollector = new HitCountCollector(collectorCreatorContext, additionalCollectors);
}
return docCollector;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public DocCollector(
this.indexState = context.getIndexState();
this.additionalCollectors = additionalCollectors;

numHitsToCollect = computeNumHitsToCollect(request);
}

public static int computeNumHitsToCollect(SearchRequest request) {
// determine how many hits to collect based on request, facets and rescore window
int collectHits = request.getTopHits();
for (Facet facet : request.getFacetsList()) {
Expand All @@ -77,7 +81,7 @@ public DocCollector(
collectHits = windowSize;
}
}
numHitsToCollect = collectHits;
return collectHits;
}

/**
Expand Down
Loading