Skip to content

Commit 644f2ae

Browse files
authored
Merge pull request #152 from apisearch-io/feature/filter_by_user
Fields _user.* is treated as final paths
2 parents 5bb7672 + e2d49fc commit 644f2ae

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Model/Item.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,10 @@ public static function createFromArray(array $array): self
671671
*/
672672
public static function getPathByField(string $field)
673673
{
674-
if (0 === strpos($field, 'indexed_metadata.')) {
674+
if (
675+
0 === strpos($field, 'indexed_metadata.') ||
676+
0 === strpos($field, '_user')
677+
) {
675678
return $field;
676679
}
677680

Tests/Model/ItemTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -545,5 +545,6 @@ public function testPathByField()
545545
$this->assertEquals('indexed_metadata.another_id', Item::getPathByField('another_id'));
546546
$this->assertEquals('indexed_metadata._field', Item::getPathByField('_field'));
547547
$this->assertEquals('indexed_metadata._field', Item::getPathByField('indexed_metadata._field'));
548+
$this->assertEquals('_user.lol', Item::getPathByField('_user.lol'));
548549
}
549550
}

0 commit comments

Comments
 (0)