-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
In SERVER-96059 an optimization was introduced to remove a redundant $sort stage after a $search stage, if the sort criteria matched and was on metadata.
This ticket would be to investigate what sort criteria this could be generalized to, and implement the generalization.
Previously, we started with only metadata, as this is all that applied to hybrid search, and there is some question around if the $search stage can sort all possible types (not just numbers like 'searchScore').
Note: The current optimization also only matches on a single sorting field like: {$meta: 'searchScore'}, instead of multiple like: {a: 1, b: 1}. We should also investigate matching the $search and $sort sorting spec on compound / multi-field specs.
- depends on
-
SERVER-96059 Optimize away metadata $sort directly after $search for single node environments
- In Code Review