File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2333,7 +2333,7 @@ protected function buildFilter(Query $query): array
23332333 $ filter ['$or ' ] = array_map (function ($ val ) use ($ attribute ) {
23342334 return [
23352335 $ attribute => [
2336- '$regex ' => new Regex ( " .* { $ this ->escapeWildcards ($ val)} .* " , 'i ' )
2336+ '$regex ' => $ this ->createSafeRegex ($ val, ' .*%s.* ' , 'i ' )
23372337 ]
23382338 ];
23392339 }, $ value );
Original file line number Diff line number Diff line change @@ -244,6 +244,15 @@ public function testIndexValidation(): void
244244 'indexes ' => $ indexes
245245 ]);
246246
247+ // not using $indexes[0] as the index validator skips indexes with same id
248+ $ newIndex = new Document ([
249+ '$id ' => ID ::custom ('newIndex1 ' ),
250+ 'type ' => Database::INDEX_FULLTEXT ,
251+ 'attributes ' => ['title1 ' , 'integer ' ],
252+ 'lengths ' => [],
253+ 'orders ' => [],
254+ ]);
255+
247256 $ validator = new Index (
248257 $ attributes ,
249258 $ indexes ,
@@ -258,7 +267,7 @@ public function testIndexValidation(): void
258267 $ database ->getAdapter ()->getSupportForIdenticalIndexes ()
259268 );
260269
261- $ this ->assertFalse ($ validator ->isValid ($ indexes [ 0 ] ));
270+ $ this ->assertFalse ($ validator ->isValid ($ newIndex ));
262271
263272 if ($ database ->getAdapter ()->getSupportForAttributes ()) {
264273 $ this ->assertEquals ('Attribute "integer" cannot be part of a fulltext index, must be of type string ' , $ validator ->getDescription ());
You can’t perform that action at this time.
0 commit comments