-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
Right now mongot generates (and sorts on) searchScore for all $search queries. The same is true for $vectorSearch and "vectorSearchScore", so all the following is relevant for $vectorSearch queries as well.
This ticket captures two improvements for removing work that mongot is currently doing.
1. If by scanning the query we can deduce that searchScore is not used and not necessary (if it is not referenced at all in the query on standalone), it does not need to be attached to the documents (though the sort may still be necessary). For example, a query with just a $search stage in the pipeline and no other stages, or a $search followed by a $lookup. Note that in a sharded cluster we will also need to change the merge sort key if we plan on not sending searchScore to the merging node.
2. If by scanning the query we see that the document order will be changed by an MQL stage before seeing a stage that depends on order, we should tell mongot to not sort on searchScore. For example, a $search followed by a $sort. Note that searchScore may still need to be calculated/sent, but the sort will not be necessary on mongot.
- related to
-
SERVER-93521 Enforce that "searchScore" and "vectorSearchScore" cannot be used when undefined.
- Backlog