@@ -54,6 +54,7 @@ public function setUp(): void
54
54
'title ' => [
55
55
['type ' => 'string ' , 'analyzer ' => 'lucene.english ' ],
56
56
['type ' => 'autocomplete ' , 'analyzer ' => 'lucene.english ' ],
57
+ ['type ' => 'token ' ],
57
58
],
58
59
],
59
60
],
@@ -141,49 +142,34 @@ public function testGetIndexes()
141
142
}
142
143
143
144
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 ()
158
145
{
159
146
$ results = Book::search (
160
- concurrent: true ,
147
+ sort: [ ' title ' => 1 ] ,
161
148
operator: Search::text ('title ' , 'systems ' ),
162
- sort: ['title ' => -1 ],
163
149
);
164
150
165
151
self ::assertInstanceOf (EloquentCollection::class, $ results );
166
152
self ::assertCount (3 , $ results );
167
153
self ::assertInstanceOf (Book::class, $ results ->first ());
168
154
self ::assertSame ([
169
- 'Operating System Concepts ' ,
170
155
'Database System Concepts ' ,
171
156
'Modern Operating Systems ' ,
157
+ 'Operating System Concepts ' ,
172
158
], $ results ->pluck ('title ' )->all ());
173
159
}
174
160
175
161
public function testDatabaseBuilderSearch ()
176
162
{
177
163
$ results = $ this ->getConnection ('mongodb ' )->table ('books ' )
178
- ->search (Search::text ('title ' , 'systems ' ));
164
+ ->search (Search::text ('title ' , 'systems ' ), sort: [ ' title ' => 1 ] );
179
165
180
166
self ::assertInstanceOf (LaravelCollection::class, $ results );
181
167
self ::assertCount (3 , $ results );
182
168
self ::assertIsArray ($ results ->first ());
183
169
self ::assertSame ([
184
- 'Operating System Concepts ' ,
185
170
'Database System Concepts ' ,
186
171
'Modern Operating Systems ' ,
172
+ 'Operating System Concepts ' ,
187
173
], $ results ->pluck ('title ' )->all ());
188
174
}
189
175
0 commit comments