@@ -19,55 +19,48 @@ public function testExample(): void
1919 Stage::scoreFusion (
2020 input: [
2121 'pipelines ' => [
22- 'searchOne ' => [
23- [
24- '$vectorSearch ' => [
25- 'index ' => 'vector_index ' ,
26- 'path ' => 'plot_embedding ' ,
27- 'queryVector ' => [-0.0016261312 , -0.028070757 , -0.011342932 ],
28- 'numCandidates ' => 150 ,
29- 'limit ' => 10 ,
30- ],
31- ],
32- ],
33- 'searchTwo ' => [
34- [
35- '$search ' => [
36- 'index ' => '<INDEX_NAME> ' ,
37- 'text ' => [
38- 'query ' => '<QUERY_TERM> ' ,
39- 'path ' => '<FIELD_NAME> ' ,
40- ],
41- ],
42- ],
43- ],
22+ 'searchOne ' => new Pipeline (
23+ Stage::vectorSearch (
24+ index: 'vector_index ' ,
25+ path: 'plot_embedding ' ,
26+ queryVector: [-0.0016261312 , -0.028070757 , -0.011342932 ],
27+ numCandidates: 150 ,
28+ limit: 10 ,
29+ ),
30+ ),
31+ 'searchTwo ' => new Pipeline (
32+ Stage::search (
33+ Search::text (
34+ query: '<QUERY_TERM> ' ,
35+ path: '<FIELD_NAME> ' ,
36+ ),
37+ index: '<INDEX_NAME> ' ,
38+ ),
39+ ),
4440 ],
4541 'normalization ' => 'sigmoid ' ,
4642 ],
4743 combination: [
4844 'method ' => 'expression ' ,
49- 'expression ' => [
50- '$sum ' => [
51- [
52- '$multiply ' => [
53- '$$searchOne ' ,
54- 10 ,
55- ],
56- ],
57- '$$searchTwo ' ,
58- ],
59- ],
45+ 'expression ' => Expression::sum (
46+ Expression::multiply (
47+ Expression::variable ('searchOne ' ),
48+ 10 ,
49+ ),
50+ Expression::variable ('searchTwo ' ),
51+ ),
6052 ],
6153 scoreDetails: true ,
6254 ),
6355 Stage::project (
6456 _id: 1 ,
6557 title: 1 ,
6658 plot: 1 ,
67- scoreDetails: [ ' $ meta' => ' scoreDetails '] ,
59+ scoreDetails: Expression:: meta ( ' scoreDetails ') ,
6860 ),
6961 Stage::limit (20 ),
7062 );
63+
7164 $ this ->assertSamePipeline (Pipelines::ScoreFusionExample, $ pipeline );
7265 }
7366}
0 commit comments