-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Prior to this ticket in SERVER-103281, we enabled running $rankFusion on a view with non-search input pipelines. In this ticket we would like to expand the functionality to include being able to run a $rankFusion on a view with search input pipelines. We believe that the work done in SERVER-103281 has laid the groundwork for this to not be too challenging (but we’ll have to see once we test).
Make sure this logic is guarded by featureFlagSearchHybridScoringFull (not every single piece of logic necessarily needs to, but the functionality should only work when this flag is enabled, and the behavior with and without the flag enabled should be coherent and predictable).
What we know needs to be implemented:
Based on our investigation, we are pretty confident that the following changes need to happen (although it’s possible other changes need to happen that we haven’t foreseen).
There are two functions, related to determining if a stage / pipeline involves search / mongot, that we to modify to get $rankFusion with a internal $search pipelines working correctly.
1)
The function search_helper_bson_obj::isMongotPipeline needs to updated to return true when the first entry in the pipeline is a rank fusion and the first input pipeline to rank fusion has a search stage.
This function is crucial to getting $rankFusion working with a search input pipeline on a view, because the proper resolved view pipeline must be computed (here) when running an aggregation pipeline on a view
2)
The virtual interface function isSearchStage is also used in a couple places in the search-on-views implementation. Currently, this function for rank fusion always returns true, however, this is not the correct behavior. Similarly, we should only return true if the first input pipeline to rank fusion has a search stage.
This has to do with what this interface function expects, and how we desugar a rank fusion. A search stage inside of a $unionWith is not considered a search stage, and in rank fusion, all input pipelines other than the first are wrapped in a $unionWith. So if a $rankFusion has no search stages in its first pipeline, but has search stages in other input pipelines, this function would expect false (in the same way this interface would expect false if the user manually wrote out this desugared query).
The implementation / modification of these two functions should be done together to see if there is anyway to consolidate their implementation, as conceptually they are checking the same thing.
Additionally, there are TODOs comments for SERVER-103504 in the codebase that point to logic that should be able to be removed once we get this working.
Testing:
After SERVER-103281, we have a test file called ‘ranked_fusion_on_view.js’ that should be expanded to include test cases for $rankFusion input pipelines that have $search & $vectorSearch.
Additionally, we should add test cases where the view definition itself has a $search/$vectorSearch. We should add these test cases where $rankFusion both does and does not have search input pipelines. Admittedly, I don’t exactly know if this will work out of the box - but either way we should inherit any restricts that a (non $rankFusion) search or non-search query has running on a view that has a $search/$vectorSearch. We should be able to look for existing tests, or right our own to understand the existing behavior.
For all test combinations, it’s important to have a search input pipeline be both the first not the first pipeline. This is because the first input pipeline is not wrapped in a $unionWith, and all other pipelines are wrapped in a $unionWith, and $unionWith has its own particulars of its interactions with search and views.
- depends on
-
SERVER-103281 Enable and test running $rankFusion on a view with non-search input pipelines
-
- In Code Review
-
-
SERVER-100355 support subpipeline $search/$searchMeta on mongot-indexed sharded view
-
- Closed
-