While adding rank and score fusion hybrid search tests to our js testing suite with mongot, it has become apparent that score metadata associated with search results differs depending on the cluster configuration (i.e. single node vs sharded, number or shards in the cluster).
Â
This is important for our hybrid search tests as the order of documents outputted by the query is asserted on to confirm the test success, which can now change for the same test running in a single node vs sharded configuration.Â
Â
This problem will not be limited to hybrid search queries, but rather most search queries as it is likely that our future tests will also assert that the documents returned by a query are in a specific order influenced by the search score.
Â
The goal of this ticket is to investigate a generic strategy to handle these cases and implement a set of utilities that can be reused for tests that encounter this problem.
Â
Currently there are two general approaches in consideration, both of which can be implemented and are not mutually exclusive.
Â
Approach 1:
Create a utility that can determine if the test is running in a sharded or unsharded configuration. This will allow us to run the same query/test with different expectations based on the test cluster configuration.
Â
This approach will likely work well as the test infrastructure currently stands (with either a single node or sharded option), but will likely break apart if the cluster configurations become more generic. For example, if a sharded cluster has 2, or 3, or N shards, the search scores will likely be different for all of these, growing the number of different orderings the test has to expect.
Â
Approach 2:Â
Make the test unaware of the cluster configuration its running in, but make the assertion logic more "fuzzy" / relaxed.
Â
While the search scores / ranks might be different in the different cluster configurations, they are not and should never be vastly different. So the relative ordering of the results should always be somewhat similar, just not exactly the same.
Â
If we can create a utility(s) that can tolerate a set of possible document orderings, and reject others, the same assertion utility can be used regardless of the cluster configuration.
Â
Some possible approaches here are:
- Pass in one expected ordering, but tolerate that each document can be within x positions of its expected position
- Pass in scores associated with the documents, so that the assertion utility has a direct understanding of which documents should proceed others.
- Specify rules such as "these docs must appear in the first x results" to enforce some ordering, but not a strict one
- is related to
-
SERVER-104636 Do not serialize _internalOutputSortKeyMetadata in query shape hash
-
- Closed
-
-
SERVER-96764 Create geoNear index in rankFusion auth test
-
- Closed
-
-
SERVER-97189 $rankFusion and $scoreFusion are missing parsing assertions
-
- Closed
-
-
SERVER-98343 $rankFusion seg faults if given empty pipeline
-
- Closed
-
-
SERVER-99887 $setWindowFields can fail when spilling to disk
-
- Closed
-
-
SERVER-100394 Validation of score $meta field is skipped for mongot queries
-
- Closed
-
-
SERVER-101653 Do not allow rankFusion to run on views
-
- Closed
-
-
SERVER-107409 View definitions with stages that include $rankFusion with subpipelines are not getting disallowed
-
- Closed
-
-
SERVER-108052 DocumentSourceInternalSetWindowFields doesn't have sort key metadata in bounded sorts
-
- Closed
-
-
SERVER-94669 Implement 'scoreDetails' for $rankFusion
-
- Closed
-
-
SERVER-94841 Implement 'score' for $score
-
- Closed
-
-
SERVER-91278 Allow sorting by more kinds of metadata
-
- Closed
-
-
SERVER-91279 Add example rank fusion tests which use $setWindowFields
-
- Closed
-
-
SERVER-91281 Allow $rank and $denseRank window functions to operate without a SortKeyPattern
-
- Closed
-
-
SERVER-91909 Implement basic parsing of $rankFusion
-
- Closed
-
-
SERVER-91911 Add validation that $rankFusion subpipelines are valid
-
- Closed
-
-
SERVER-91912 Test auth for $rankFusion stage
-
- Closed
-
-
SERVER-92213 Implement desugaring of $rankFusion
-
- Closed
-
-
SERVER-92244 Create Feature Flag for Milestones 1 and 2
-
- Closed
-
-
SERVER-94603 Add 'weights' argument to $rankFusion
-
- Closed
-
-
SERVER-94660 Test $rankFusion query shape and stable API restrictions
-
- Closed
-
-
SERVER-94668 POC 'scoreDetails' for $score
-
- Closed
-
-
SERVER-96064 Optimize away $sort directly after $vectorSearch for single node environments
-
- Closed
-
-
SERVER-96736 Switch $rankFusion to use 'featureFlagSearchHybridScoringPrerequisites'
-
- Closed
-
-
SERVER-97339 Implement serialization and query shape testing for $score
-
- Closed
-
-
SERVER-97645 Refactor serializeTransformation to remove redundant explain parameter
-
- Closed
-
-
SERVER-97915 Create feature flag for earlier $rankFusion milestone
-
- Closed
-
-
SERVER-97917 Move $rankFusion to be guarded under featureFlagRankFusionBasic
-
- Closed
-
-
SERVER-97919 Enable featureFlagRankFusionBasic by default
-
- Closed
-
-
SERVER-98453 Refactor $sort to make it easier to add a new option
-
- Closed
-
-
SERVER-98994 Make featureFlagRankFusionBasic FCV-gated
-
- Closed
-
-
SERVER-99153 $rankFusion scoreDetails should error if not requested by top-level pipeline (but specified in inner)
-
- Closed
-
-
SERVER-99169 score cannot be used when not defined
-
- Closed
-
-
SERVER-99210 $rankFusion should reject duplicate input.pipelines names
-
- Closed
-
-
SERVER-99335 Support projecting textScore with $meta: score
-
- Closed
-
-
SERVER-99589 Consolidate metadata dependency tracking of search and non-search metadata
-
- Closed
-
-
SERVER-99596 Refactor how metadata dependencies are validated
-
- Closed
-
-
SERVER-100045 Add property-based test for metadata field dependency validation
-
- Closed
-
-
SERVER-100107 Add "description" and "weight" to $rankFusion scoreDetails
-
- Closed
-
-
SERVER-100203 Change scoreDetails to use array rather than object
-
- Closed
-
-
SERVER-100546 Handle deps tracking generically in DocumentSourceFacet::getDependencies()
-
- Closed
-
-
SERVER-100678 scoreDetails cannot be used when not defined
-
- Closed
-
-
SERVER-100799 Guard meta_dependency_validation.js on featureFlagRankFusionFull
-
- Closed
-
-
SERVER-100948 Re-enable scoreDetails "value" field
-
- Closed
-
-
SERVER-101155 Run search e2e metadata tests in the search passthroughs
-
- Closed
-
-
SERVER-101701 $rankFusion must be the first stage of the pipeline
-
- Closed
-
-
SERVER-101702 Add tests for $rankFusion in $lookup/$unionWith subpipelines
-
- Closed
-
-
SERVER-101781 Reject $rankFusion in a view definiton
-
- Closed
-
-
SERVER-104730 Explicitly ban nested $rankFusions and $scoreFusions
-
- Closed
-
-
SERVER-99505 Refactor string building in document_source_rank_fusion.cpp
-
- Closed
-
-
SERVER-101568 $rankFusion should reject scoreDetails: true unless FF is on
-
- Closed
-
-
SERVER-88046 Support $vectorSearch execution within unionWith subpipeline
-
- Closed
-
-
SERVER-93391 Remove rankConstant field from $rankFusion
-
- Closed
-
-
SERVER-93576 Remove vector embeddings from $vectorSearch explain
-
- Closed
-
-
SERVER-95162 Refactor multiversion query test to make it more re-usable
-
- Closed
-
-
SERVER-95164 Allow more than 2 input pipelines for $rankFusion
-
- Closed
-
-
SERVER-95168 Implement $setWindowFields version of desugaring for $rankFusion
-
- Closed
-
-
SERVER-95169 Add multiversion query test which stresses sharded scenarios
-
- Closed
-
-
SERVER-96127 Adjust $rankFusion syntax to adopt 'input.pipelines' revision
-
- Closed
-
-
SERVER-96154 Validate field names for 'inputs.pipelines' and 'weights'
-
- Closed
-
-
SERVER-96792 Allow {$meta: "score"} to return any kind of score metadata
-
- Closed
-
-
SERVER-96793 Allow {$meta: "scoreDetails"} to return any kind of scoreDetails metadata
-
- Closed
-
-
SERVER-97103 Allow sorting by {$meta: "score"}
-
- Closed
-
-
SERVER-97104 Restrict {$meta: "scoreDetails"} to featureFlagRankFusionFull and apiStrict=false
-
- Closed
-
-
SERVER-98322 Improve field path validation error messages
-
- Closed
-
-
SERVER-99674 Change $rankFusion weights object to accept a subset of pipelines specified
-
- Closed
-
-
SERVER-99675 Improve feedback for misspelled $rankFusion pipelines in weights object
-
- Closed
-
-
SERVER-99732 Switch sort key metadata assertion to tassert (from invariant)
-
- Closed
-
-
SERVER-100752 $rankFusion should output score metadata
-
- Closed
-
-
SERVER-102728 Audit rankFusion's scoreDetails testing
-
- Closed
-
-
SERVER-105358 Modify hybrid search input pipeline validation to analyze pre-desugared stages
-
- Closed
-
-
SERVER-96835 Update commands_lib.js rankFusion pipeline to new syntax.
-
- Closed
-
-
SERVER-97102 Stress test dependency tracking for {$meta: "scoreDetails"} for pipelines spanning across sharded network split
-
- Closed
-
- related to
-
SERVER-91200 Add end-to-end ranked fusion test using existing syntax
- Closed
-
SERVER-91201 Add end-to-end score fusion test using existing syntax
- Closed
-
SERVER-82019 Create feature flag
-
- Closed
-
-
SERVER-91907 Create skeleton of DocumentSourceRankFusion
-
- Closed
-
-
SERVER-107693 [v8.0] Backport Hybrid Search Rank Fusion
-
- Closed
-