diff --git a/site/content/3.12/aql/functions/vector.md b/site/content/3.12/aql/functions/vector.md index f8e9f9b741..be1b83261b 100644 --- a/site/content/3.12/aql/functions/vector.md +++ b/site/content/3.12/aql/functions/vector.md @@ -56,8 +56,23 @@ be found depends on the data as well as the search effort (see the `nProbe` opti {{< info >}} - If there is more than one suitable vector index over the same attribute, it is undefined which one is selected. -- You cannot have any `FILTER` operation between `FOR` and `LIMIT` for - pre-filtering. + +- In v3.12.4 and v3.12.5, you cannot have any `FILTER` operation between `FOR` + and `LIMIT` for pre-filtering. From v3.12.6 onward, you can add `FILTER` + operations between `FOR` and `SORT` that are then applied during the lookup in + the vector index. Example: + + ```aql + FOR doc IN coll + FILTER doc.val > 3 + SORT APPROX_NEAR_COSINE(doc.vector, @q) DESC + LIMIT 5 + RETURN doc + ``` + + Note that e.g. `LIMIT 5` does not ensure that you get 5 results by searching + as many neighboring Voronoi cells as necessary, but it rather considers only as + many as configured via the `nProbes` parameter. {{< /info >}} ### APPROX_NEAR_COSINE() diff --git a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md index 3ee8768a74..1ac2909f25 100644 --- a/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md +++ b/site/content/3.12/release-notes/version-3.12/whats-new-in-3-12.md @@ -1483,6 +1483,20 @@ has been added. Introduced in: v3.12.6 +Vector indexes now support filtering. You can add `FILTER` operations between +`FOR` and `SORT` that are then applied during the lookup in the vector index. +Note that e.g. `LIMIT 5` does not ensure that you get 5 results by searching +as many neighboring Voronoi cells as necessary, but it rather considers only as +many as configured via the `nProbes` parameter. Example: + +```aql +FOR doc IN coll + FILTER doc.val > 3 + SORT APPROX_NEAR_COSINE(doc.vector, @q) DESC + LIMIT 5 + RETURN doc +``` + Vector indexes can now be sparse to exclude documents with the embedding attribute for indexing missing or set to `null`. diff --git a/site/content/3.13/aql/functions/vector.md b/site/content/3.13/aql/functions/vector.md index f8e9f9b741..be1b83261b 100644 --- a/site/content/3.13/aql/functions/vector.md +++ b/site/content/3.13/aql/functions/vector.md @@ -56,8 +56,23 @@ be found depends on the data as well as the search effort (see the `nProbe` opti {{< info >}} - If there is more than one suitable vector index over the same attribute, it is undefined which one is selected. -- You cannot have any `FILTER` operation between `FOR` and `LIMIT` for - pre-filtering. + +- In v3.12.4 and v3.12.5, you cannot have any `FILTER` operation between `FOR` + and `LIMIT` for pre-filtering. From v3.12.6 onward, you can add `FILTER` + operations between `FOR` and `SORT` that are then applied during the lookup in + the vector index. Example: + + ```aql + FOR doc IN coll + FILTER doc.val > 3 + SORT APPROX_NEAR_COSINE(doc.vector, @q) DESC + LIMIT 5 + RETURN doc + ``` + + Note that e.g. `LIMIT 5` does not ensure that you get 5 results by searching + as many neighboring Voronoi cells as necessary, but it rather considers only as + many as configured via the `nProbes` parameter. {{< /info >}} ### APPROX_NEAR_COSINE() diff --git a/site/content/3.13/release-notes/version-3.12/whats-new-in-3-12.md b/site/content/3.13/release-notes/version-3.12/whats-new-in-3-12.md index 3ee8768a74..1ac2909f25 100644 --- a/site/content/3.13/release-notes/version-3.12/whats-new-in-3-12.md +++ b/site/content/3.13/release-notes/version-3.12/whats-new-in-3-12.md @@ -1483,6 +1483,20 @@ has been added. Introduced in: v3.12.6 +Vector indexes now support filtering. You can add `FILTER` operations between +`FOR` and `SORT` that are then applied during the lookup in the vector index. +Note that e.g. `LIMIT 5` does not ensure that you get 5 results by searching +as many neighboring Voronoi cells as necessary, but it rather considers only as +many as configured via the `nProbes` parameter. Example: + +```aql +FOR doc IN coll + FILTER doc.val > 3 + SORT APPROX_NEAR_COSINE(doc.vector, @q) DESC + LIMIT 5 + RETURN doc +``` + Vector indexes can now be sparse to exclude documents with the embedding attribute for indexing missing or set to `null`.