@@ -54,6 +54,7 @@ public function setUp(): void
5454 'title ' => [
5555 ['type ' => 'string ' , 'analyzer ' => 'lucene.english ' ],
5656 ['type ' => 'autocomplete ' , 'analyzer ' => 'lucene.english ' ],
57+ ['type ' => 'token ' ],
5758 ],
5859 ],
5960 ],
@@ -141,49 +142,34 @@ public function testGetIndexes()
141142 }
142143
143144 public function testEloquentBuilderSearch ()
144- {
145- $ results = Book::search (Search::text ('title ' , 'systems ' ));
146-
147- self ::assertInstanceOf (EloquentCollection::class, $ results );
148- self ::assertCount (3 , $ results );
149- self ::assertInstanceOf (Book::class, $ results ->first ());
150- self ::assertSame ([
151- 'Operating System Concepts ' ,
152- 'Database System Concepts ' ,
153- 'Modern Operating Systems ' ,
154- ], $ results ->pluck ('title ' )->all ());
155- }
156-
157- public function testEloquentBuilderWithAdvancedParameters ()
158145 {
159146 $ results = Book::search (
160- concurrent: true ,
147+ sort: [ ' title ' => 1 ] ,
161148 operator: Search::text ('title ' , 'systems ' ),
162- sort: ['title ' => -1 ],
163149 );
164150
165151 self ::assertInstanceOf (EloquentCollection::class, $ results );
166152 self ::assertCount (3 , $ results );
167153 self ::assertInstanceOf (Book::class, $ results ->first ());
168154 self ::assertSame ([
169- 'Operating System Concepts ' ,
170155 'Database System Concepts ' ,
171156 'Modern Operating Systems ' ,
157+ 'Operating System Concepts ' ,
172158 ], $ results ->pluck ('title ' )->all ());
173159 }
174160
175161 public function testDatabaseBuilderSearch ()
176162 {
177163 $ results = $ this ->getConnection ('mongodb ' )->table ('books ' )
178- ->search (Search::text ('title ' , 'systems ' ));
164+ ->search (Search::text ('title ' , 'systems ' ), sort: [ ' title ' => 1 ] );
179165
180166 self ::assertInstanceOf (LaravelCollection::class, $ results );
181167 self ::assertCount (3 , $ results );
182168 self ::assertIsArray ($ results ->first ());
183169 self ::assertSame ([
184- 'Operating System Concepts ' ,
185170 'Database System Concepts ' ,
186171 'Modern Operating Systems ' ,
172+ 'Operating System Concepts ' ,
187173 ], $ results ->pluck ('title ' )->all ());
188174 }
189175
0 commit comments