From f48610c02ae02180ab6875117594e798c35d1c2b Mon Sep 17 00:00:00 2001 From: Simran Spiller Date: Tue, 23 Sep 2025 10:28:36 +0200 Subject: [PATCH] Vector indexes support filtering --- site/content/3.12/aql/functions/vector.md | 15 +++++++++++++-- .../version-3.12/whats-new-in-3-12.md | 16 ++++++++++++++++ site/content/3.13/aql/functions/vector.md | 15 +++++++++++++-- .../version-3.12/whats-new-in-3-12.md | 16 ++++++++++++++++ 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/site/content/3.12/aql/functions/vector.md b/site/content/3.12/aql/functions/vector.md index 45341b8ea8..32f7a09cdf 100644 --- a/site/content/3.12/aql/functions/vector.md +++ b/site/content/3.12/aql/functions/vector.md @@ -56,8 +56,19 @@ 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 + ``` {{< /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 ac4b390df3..9beedcb6cc 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 @@ -1443,6 +1443,22 @@ utilizing vector indexes in queries. Furthermore, a new error code `ERROR_QUERY_VECTOR_SEARCH_NOT_APPLIED` (1554) 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. +Example: + +```aql +FOR doc IN coll + FILTER doc.val > 3 + SORT APPROX_NEAR_COSINE(doc.vector, @q) DESC + LIMIT 5 + RETURN doc +``` + ## Server options ### Effective and available startup options diff --git a/site/content/3.13/aql/functions/vector.md b/site/content/3.13/aql/functions/vector.md index 45341b8ea8..32f7a09cdf 100644 --- a/site/content/3.13/aql/functions/vector.md +++ b/site/content/3.13/aql/functions/vector.md @@ -56,8 +56,19 @@ 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 + ``` {{< /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 ac4b390df3..9beedcb6cc 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 @@ -1443,6 +1443,22 @@ utilizing vector indexes in queries. Furthermore, a new error code `ERROR_QUERY_VECTOR_SEARCH_NOT_APPLIED` (1554) 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. +Example: + +```aql +FOR doc IN coll + FILTER doc.val > 3 + SORT APPROX_NEAR_COSINE(doc.vector, @q) DESC + LIMIT 5 + RETURN doc +``` + ## Server options ### Effective and available startup options