Skip to content

Commit 650ca11

Browse files
authored
Merge pull request #143 from apisearch-io/fix/fixed-filter-by
Fixed filtering by field starting with indexed_metadata
2 parents 012a42b + f294370 commit 650ca11

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Model/Item.php

+4
Original file line numberDiff line numberDiff line change
@@ -671,6 +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.')) {
675+
return $field;
676+
}
677+
674678
if ('_id' === $field) {
675679
return $field;
676680
}

Tests/Model/ItemTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -543,5 +543,6 @@ public function testPathByField()
543543
$this->assertEquals('uuid.type', Item::getPathByField('type'));
544544
$this->assertEquals('indexed_metadata.another_id', Item::getPathByField('another_id'));
545545
$this->assertEquals('indexed_metadata._field', Item::getPathByField('_field'));
546+
$this->assertEquals('indexed_metadata._field', Item::getPathByField('indexed_metadata._field'));
546547
}
547548
}

0 commit comments

Comments
 (0)