Skip to content

Commit e4f9047

Browse files
committed
[NO ISSUE] Bringing over some good changes from PR #316 to Server
1 parent 834c35a commit e4f9047

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

modules/search/pages/search-request-params.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ NOTE: The vector in your Search query must match the dimension of the vectors st
274274
If the dimensions do not match, your Search query does not return any results.
275275
For more information about the dimension value, see the xref:search-index-params.adoc#dims[dims property] or the xref:child-field-options-reference.adoc#dimension[Dimension option] in the UI.
276276

277+
|[[filter]]filter |Object |No a|
278+
279+
Add a filter object to xref:vector-search:pre-filtering-vector-search.adoc[add pre-filtering], based on an additional query, to a Vector Search query.
280+
281+
The `filter` object can take properties from any of the query types supported by the <<query-object,>>.
277282
|====
278283

279284
[#knn-params]

modules/vector-search/examples/run-pre-filtered-vector-search-rest-api.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ curl -XPOST -H "Content-Type: application/json" \
1515
"field": "colorvect_l2",
1616
"vector": [ 176, 0, 176 ],
1717
"filter": {
18-
"field: "color",
18+
"field": "color",
1919
"match": "navy"
2020
}
2121
}

modules/vector-search/pages/pre-filtering-vector-search.adoc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= Pre-filtering Vector Searches
22
:page-topic-type: guide
33
:page-ui-name: {ui-name}
4-
:description: You can specify filters as part of a vector search statement which will restrict the documents searched during the query.
4+
:description: You can specify filters as part of a Vector Search query object to restrict the documents searched in a Search index.
55

66
[abstract]
77
{description}
@@ -42,26 +42,28 @@ For the best results, consider using the sample Vector Search index from xref:cr
4242

4343
== Procedure
4444

45-
To run a pre-filtered vector search with the REST API:
45+
To add pre-filtering to a Vector Search with the REST API:
4646

4747
. In your command-line tool, enter a `curl` command with the `XPOST` verb.
4848
. Set your header content to include `"Content-Type: application/json"`.
4949
. Add your `username`, `password`, and the Search Service endpoint on port `8094`.
5050
. Add the `index name` you want to query to the endpoint.
51-
51+
+
5252
[source, console]
5353
----
5454
curl -XPOST -H "Content-Type: application/json" \
5555
-u ${CB_USERNAME}:${CB_PASSWORD} http://${CB_HOSTNAME}:8094/api/bucket/vector-sample/scope/color/index/{INDEX_NAME}/query \
5656
-d \
5757
----
58+
. Enter a search query that includes a `filter` object with your `knn` object.
59+
+
60+
For more information about the `filter` object, see xref:search:search-request-params.adoc#filter[filter].
61+
5862

59-
=== Example
63+
=== Example: Pre-Filter A Vector Search Query For The Color "Navy"
6064

61-
In the following example, you will extend a search query
62-
to find matches in `color-index`.
63-
A pre-filter on the query will narrow the documents in the index searched to those with a `color` field value
64-
that closely matches `navy`.
65+
For example, the following Vector Search query tries to find matches to a color with an RGB value of `[176, 0, 176]` with a minimum brightness of `70` and a maximum of `80`.
66+
A pre-filter on the query will narrow the documents searched inside the Vector Search index to documents that have a `color` field value that closely matches `navy`:
6567

6668
[source, console]
6769
----

0 commit comments

Comments
 (0)