Skip to content

Commit f06ef55

Browse files
Update src/Database/Validator/Query/Filter.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent b5a3c95 commit f06ef55

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Database/Validator/Query/Filter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,13 @@ public function isValid($value): bool
341341
return false;
342342
}
343343

344-
$attributeSchema = $this->schema[$attribute];
344+
// Handle dotted attributes (relationships)
345+
$attributeKey = $attribute;
346+
if (\str_contains($attributeKey, '.') && !isset($this->schema[$attributeKey])) {
347+
$attributeKey = \explode('.', $attributeKey)[0];
348+
}
349+
350+
$attributeSchema = $this->schema[$attributeKey];
345351
if ($attributeSchema['type'] !== Database::VAR_VECTOR) {
346352
$this->message = 'Vector queries can only be used on vector attributes';
347353
return false;
@@ -353,7 +359,6 @@ public function isValid($value): bool
353359
}
354360

355361
return $this->isValidAttributeAndValues($attribute, $value->getValues(), $method);
356-
357362
case Query::TYPE_OR:
358363
case Query::TYPE_AND:
359364
$filters = Query::groupByType($value->getValues())['filters'];

0 commit comments

Comments
 (0)