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
Copy file name to clipboardExpand all lines: spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/azure/AzureVectorStoreAutoConfiguration.java
Copy file name to clipboardExpand all lines: spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/azure/AzureVectorStoreProperties.java
Copy file name to clipboardExpand all lines: spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/azure/AzureVectorStoreAutoConfigurationIT.java
If all goes well, you should retrieve the document containing the text "Spring AI rocks!!".
131
145
146
+
### Metadata filtering
147
+
148
+
You can leverage the generic, portable [metadata filters](https://docs.spring.io/spring-ai/reference/api/vectordbs.html#_metadata_filters) with AzureVectorStore as well.
149
+
150
+
For example you can use either the text expression language:
151
+
152
+
```java
153
+
vectorStore.similaritySearch(
154
+
SearchRequest
155
+
.query("The World")
156
+
.withTopK(TOP_K)
157
+
.withSimilarityThreshold(SIMILARITY_THRESHOLD)
158
+
.withFilterExpression("country in ['UK', 'NL'] && year >= 2020"));
159
+
```
160
+
161
+
or programmatically using the expression DSL:
162
+
163
+
```java
164
+
FilterExpressionBuilder b =Filter.builder();
165
+
166
+
vectorStore.similaritySearch(
167
+
SearchRequest
168
+
.query("The World")
169
+
.withTopK(TOP_K)
170
+
.withSimilarityThreshold(SIMILARITY_THRESHOLD)
171
+
.withFilterExpression(b.and(
172
+
b.in("country", "UK", "NL"),
173
+
b.gte("year", 2020)).build()));
174
+
```
175
+
176
+
The, portable, filter expressions get automatically converted into the proprietary Azure Search [OData filters](https://learn.microsoft.com/en-us/azure/search/search-query-odata-filter).
177
+
For example the following, portable, filter expression
178
+
179
+
```sql
180
+
country in ['UK', 'NL'] && year >=2020
181
+
```
182
+
183
+
is converted into Azure, OData, [filter expression](https://learn.microsoft.com/en-us/azure/search/search-query-odata-filter):
The `AzureVectorStore` implementation is compatible with indexes that use this methodology facilitating an *easier* way to integrate with your existing documents for the purpose of searching and integrating with the AI system.
137
194
138
-
## <aname="appendix_a" /> Appendix A: Create Vector Store Search Index
195
+
## <aname="appendix_a" /> Appendix A: Create Vector Store Search Index </a>
139
196
140
197
The easiest way to crate a search index manually, is to create one from a JSON document.
141
198
This can be done by clicking on the `Indexes` link under the `Search management` section.
0 commit comments