[SERVER-69872] Send necessary information to decide whether searchScore is needed to mongot Created: 21/Sep/22  Updated: 22/Mar/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Ted Tuckman Assignee: Backlog - Query Integration
Resolution: Unresolved Votes: 0
Labels: mongot-cross-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Integration
Participants:

 Description   

Right now mongot generates (and sorts on) searchScore for all queries. 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.



 Comments   
Comment by Ted Tuckman [ 23/Jan/23 ]

Done. Let me know if it needs clarifying at all.

Comment by Nicholas Zolnierz [ 23/Jan/23 ]

ted.tuckman@mongodb.com can you add a small description for future readers? My understanding is that this is specifically for pipelines which contain a $search but then some subsequent stage(s) remove any ordering guarantees and thus the implicit sort on score is wasted work?

Comment by Alice Neff [ 29/Sep/22 ]

joseph.kanaan@mongodb.com - when is Query team's Q4 planning and can we sync about Search Q4 asks soon? Please suggest the right forum to discuss with product and eng leads.

cc oren.ovadia@mongodb.com doug.tarr@mongodb.com elle.shwer@mongodb.com kateryna.kamenieva@mongodb.com

Generated at Thu Feb 08 06:14:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.