You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrap filters in a nested array to create OR groups. Filters at the top level are ANDed; filters inside a nested array are ORed.
407
439
440
+
```php
441
+
// (category = 'tech' OR category = 'science') AND status = 'published'
442
+
$results = $db->vectorSearch(
443
+
vector: $queryVector,
444
+
k: 10,
445
+
filters: [
446
+
[
447
+
MetadataFilter::eq('category', 'tech'),
448
+
MetadataFilter::eq('category', 'science'),
449
+
], // OR group
450
+
MetadataFilter::eq('status', 'published'), // ANDed with the OR group
451
+
],
452
+
);
453
+
```
454
+
455
+
### Over-fetching for filtered queries
456
+
457
+
When filters are applied, the search may need to examine more candidates than `k` to find enough matching documents. By default, the search fetches `k * 5` candidates, then filters. You can tune this:
458
+
459
+
```php
460
+
// Fetch 10× candidates before filtering (useful when filters are very selective)
0 commit comments