Don't use official searcher for production queries

This commit is contained in:
Andrea Cavalli 2021-12-12 18:52:50 +01:00
parent 3cdafd748e
commit 5157656a2c
2 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ public class AdaptiveLocalSearcher implements LocalSearcher {
private static final OfficialSearcher officialSearcher = new OfficialSearcher();
private static final LocalSearcher localPagedSearcher = new PagedLocalSearcher();
private static final LocalSearcher scoredPaged = new PagedLocalSearcher();
private static final LocalSearcher countSearcher = new CountMultiSearcher();
@ -72,7 +72,7 @@ public class AdaptiveLocalSearcher implements LocalSearcher {
return countSearcher.collect(indexSearcher, queryParams, keyFieldName, transformer);
} else if (queryParams.isSorted() || queryParams.needsScores()) {
if (realLimit <= maxAllowedInMemoryLimit) {
return localPagedSearcher.collect(indexSearcher, queryParams, keyFieldName, transformer);
return scoredPaged.collect(indexSearcher, queryParams, keyFieldName, transformer);
} else {
if ((queryParams.isSorted() && !queryParams.isSortedByScore())) {
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
@ -81,7 +81,7 @@ public class AdaptiveLocalSearcher implements LocalSearcher {
if (sortedScoredFull != null) {
return sortedScoredFull.collect(indexSearcher, queryParams, keyFieldName, transformer);
} else {
return officialSearcher.collect(indexSearcher, queryParams, keyFieldName, transformer);
return scoredPaged.collect(indexSearcher, queryParams, keyFieldName, transformer);
}
} else {
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
@ -90,7 +90,7 @@ public class AdaptiveLocalSearcher implements LocalSearcher {
if (unsortedScoredFull != null) {
return unsortedScoredFull.collect(indexSearcher, queryParams, keyFieldName, transformer);
} else {
return officialSearcher.collect(indexSearcher, queryParams, keyFieldName, transformer);
return scoredPaged.collect(indexSearcher, queryParams, keyFieldName, transformer);
}
}
}

View File

@ -69,7 +69,7 @@ public class AdaptiveMultiSearcher implements MultiSearcher {
if (sortedScoredFull != null) {
return sortedScoredFull.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
} else {
return officialSearcher.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
return scoredPaged.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
}
} else {
if (queryParams.limitLong() < MAX_IN_MEMORY_SIZE) {
@ -78,7 +78,7 @@ public class AdaptiveMultiSearcher implements MultiSearcher {
if (unsortedScoredFull != null) {
return unsortedScoredFull.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
} else {
return officialSearcher.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
return scoredPaged.collectMulti(indexSearchersMono, queryParams, keyFieldName, transformer);
}
}
}