File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
docs/includes/fundamentals/read-operations Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ protected function setUp(): void
30
30
['title ' => 'movie_b ' , 'plot ' => 'love is a long story ' ],
31
31
['title ' => 'movie_c ' , 'plot ' => 'went on a trip ' ],
32
32
]);
33
+
34
+ $ collection = MongoDB::connection ('mongodb ' )->collection ('movies ' );
35
+ $ index = ['plot ' => 'text ' ];
36
+ $ collection ->createIndex ($ index );
33
37
}
34
38
35
39
/**
@@ -119,11 +123,6 @@ public function testText(): void
119
123
*/
120
124
public function testTextRelevance (): void
121
125
{
122
-
123
- $ collection = MongoDB::connection ('mongodb ' )->collection ('movies ' );
124
- $ index = ['plot ' => 'text ' ];
125
- $ collection ->createIndex ($ index );
126
-
127
126
// start-text-relevance
128
127
$ movies = Movie::where ('$text ' , ['$search ' => '"love story" ' ])
129
128
->orderBy ('score ' , ['$meta ' => 'textScore ' ])
You can’t perform that action at this time.
0 commit comments