-
Notifications
You must be signed in to change notification settings - Fork 2k
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
TimeSeries Desc Sort gets skipped with Lucene 10 upgrade #17329
base: main
Are you sure you want to change the base?
Changes from 3 commits
0442ed9
21d5903
368383f
21a924d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
import org.apache.lucene.search.Collector; | ||
import org.apache.lucene.search.CollectorManager; | ||
import org.apache.lucene.search.ConjunctionUtils; | ||
import org.apache.lucene.search.ConstantScoreQuery; | ||
import org.apache.lucene.search.DocIdSetIterator; | ||
import org.apache.lucene.search.Explanation; | ||
import org.apache.lucene.search.IndexSearcher; | ||
|
@@ -257,7 +258,15 @@ public void search( | |
|
||
@Override | ||
public void search(Query query, Collector collector) throws IOException { | ||
super.search(query, collector); | ||
// TODO : Remove when switching to use the @org.apache.lucene.search.IndexSearcher#search(Query, CollectorManager) variant from | ||
// @org.opensearch.search.query.QueryPhase#searchWithCollector which then calls the overridden | ||
// search(LeafReaderContextPartition[] partitions, Weight weight, Collector collector) | ||
query = collector.scoreMode().needsScores() ? rewrite(query) : rewrite(new ConstantScoreQuery(query)); | ||
Weight weight = createWeight(query, collector.scoreMode(), 1); | ||
LeafSlice[] leafSlices = getSlices(); | ||
for (LeafSlice leafSlice : leafSlices) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @expani I think we should get all partitions across all slices and call
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can override the logic in getSlices, we could even handle the desc sort use-case more efficiently by returning slices that contain leafcontextpartitions with the higher doc ids and front-load those. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
search(leafSlice.partitions, weight, collector); | ||
} | ||
searchContext.bucketCollectorProcessor().processPostCollection(collector); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msfroh this change make sense to me to restore
searchContext.shouldUseTimeSeriesDescSortOptimization()
optimization, wdyt?