-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
Fully Compatible
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Right now on master (but not on 8.1), if you run any (non-mongot) explain query on a view that is defined with a search on a sharded topology (sharded cluster with sharded or un-sharded collection), the query will assert at Location 40602.
This assertion happens when we attempt to serialize $_internalSearchIdLookup for explain. Specifically here, when we modify the BSON pipeline when we have a view, we append the view pipeline after the "main" pipeline (which is a dummy $match), if the view pipeline is a search, it will appear after the $match, tripping search's positional requirement StageConstraint as not the first stage.
We need to fix this logic so these types of queries can successfully execute an explain, with a coherent result.
More context from adithi.raghavan@mongodb.com:
The assertion wasn't hit on 8.1 because josh had this validateViewPipeline function in search_helper.cpp that contained assertions that would be hit for all search in view cases. the bug was still there (like this piece of code where the bug is was still there I think), it was just never exposed/hit because of the assertions in search_helper.cpp. Josh removed those assertions in search_helper in this PR (which went in in June 2025). There were no test cases that hit that code path (exposing the bug) until we added them in our ranked_fusion_on_search_views work.
Note that this issue is not Hybrid Search specific, but we need it resolved for the 8.2 release of $rankFusion an $scoreFusion views support