From f2943708a7779230c0f05f65eda5fa5d194980fb Mon Sep 17 00:00:00 2001 From: Marc Morera Date: Fri, 6 May 2022 16:51:16 +0200 Subject: [PATCH] Fixed filtering by field starting with indexed_metadata --- Model/Item.php | 4 ++++ Tests/Model/ItemTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/Model/Item.php b/Model/Item.php index a85fbff..2fb72f8 100644 --- a/Model/Item.php +++ b/Model/Item.php @@ -671,6 +671,10 @@ public static function createFromArray(array $array): self */ public static function getPathByField(string $field) { + if (0 === strpos($field, 'indexed_metadata.')) { + return $field; + } + if ('_id' === $field) { return $field; } diff --git a/Tests/Model/ItemTest.php b/Tests/Model/ItemTest.php index 7f9e63e..ad7870a 100644 --- a/Tests/Model/ItemTest.php +++ b/Tests/Model/ItemTest.php @@ -543,5 +543,6 @@ public function testPathByField() $this->assertEquals('uuid.type', Item::getPathByField('type')); $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')); } }