Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Use of pre-filtering for vector search with Vertex AI

I am using .NET to implement vector search. Everything is working good so far, but now I need a feature to add filters to the query. The restricts are already a part of the index, so basically I only need to understand which query / request to use.

The only documentation I found doesn't provide any code snippets nor hints. The Query class used for vector search does not have any restricts / allow properties.

I found a class NearestNeighborQuery that includes all the needed properties, but it cannot be added to the FindNeighborsRequest.

I've browsed everything possible so far but still have no clue. I'd really appreciate if anyone gives a tip.

Solved Solved
1 2 1,311
1 ACCEPTED SOLUTION

This issue is resolved. I was looking for another request type / query type. But the solution was to use the same FindNeighborsRequest and the same Query type. The IndexDatapoint provides the possibility to add numeric as well as category restricts.

View solution in original post

2 REPLIES 2

This issue is resolved. I was looking for another request type / query type. But the solution was to use the same FindNeighborsRequest and the same Query type. The IndexDatapoint provides the possibility to add numeric as well as category restricts.

hey can you share the code snippet, i am unable to figure a out how to use filtering.