Skip to content

Commit

Permalink
Merge pull request #152 from apisearch-io/feature/filter_by_user
Browse files Browse the repository at this point in the history
Fields _user.* is treated as final paths
  • Loading branch information
mmoreram authored Mar 8, 2024
2 parents 5bb7672 + e2d49fc commit 644f2ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,10 @@ public static function createFromArray(array $array): self
*/
public static function getPathByField(string $field)
{
if (0 === strpos($field, 'indexed_metadata.')) {
if (
0 === strpos($field, 'indexed_metadata.') ||
0 === strpos($field, '_user')
) {
return $field;
}

Expand Down
1 change: 1 addition & 0 deletions Tests/Model/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,5 +545,6 @@ public function testPathByField()
$this->assertEquals('indexed_metadata.another_id', Item::getPathByField('another_id'));
$this->assertEquals('indexed_metadata._field', Item::getPathByField('_field'));
$this->assertEquals('indexed_metadata._field', Item::getPathByField('indexed_metadata._field'));
$this->assertEquals('_user.lol', Item::getPathByField('_user.lol'));
}
}

0 comments on commit 644f2ae

Please sign in to comment.