Skip to content

Commit 907605f

Browse files
authored
feat(mongodb-constants): add $rankFusion stage for 8.1+ COMPASS-9429 (#545)
1 parent a868984 commit 907605f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

packages/mongodb-constants/src/stage-operators.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,48 @@ const STAGE_OPERATORS = [
749749
`,
750750
snippet: `{
751751
\${1:specification(s)}
752+
}`,
753+
},
754+
{
755+
name: '$rankFusion',
756+
value: '$rankFusion',
757+
label: '$rankFusion',
758+
outputStage: false,
759+
fullScan: false,
760+
firstStage: false,
761+
score: 1,
762+
env: [ATLAS],
763+
meta: 'stage',
764+
version: '8.1.0',
765+
apiVersions: [],
766+
namespaces: [COLLECTION],
767+
description:
768+
'Combines multiple pipelines using reciprocal rank fusion to create hybrid search results.',
769+
comment: `/**
770+
* input.pipelines: Required. Map from name to input pipeline. Each pipeline must be a Ranked Selection Pipeline operating on the same collection. Minimum of one pipeline.
771+
* combination.weights: Optional. Map from pipeline name to numbers (non-negative). If unspecified, default weight is 1 for each pipeline.
772+
* scoreDetails: Optional. Default false. Set to true to include detailed scoring information in {$meta: "scoreDetails"} for debugging and tuning.
773+
*/
774+
`,
775+
snippet: `{
776+
input: {
777+
pipelines: {
778+
\${1:searchPipeline}: [
779+
{$search: {\${2:searchStage}}},
780+
{$limit: \${3:limit}}
781+
],
782+
\${4:vectorPipeline}: [
783+
{$vectorSearch: {\${5:vectorSearchStage}}}
784+
]
785+
}
786+
},
787+
combination: {
788+
weights: {
789+
\${6:searchPipeline}: \${7:number},
790+
\${8:vectorPipeline}: \${9:number}
791+
}
792+
},
793+
scoreDetails: \${10:false}
752794
}`,
753795
},
754796
{

0 commit comments

Comments
 (0)