spring-projects / spring-projects/spring-ai

Support collection type of MetadataField in Vector Store

Open
#5,591 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

In some vector stores like Azure AI Search, the metadata fields could be collection type, and support filter collection metadata by users.

Say keywords field, in Azure AI Search, we can define this field as a collection type of string

new MetadataField("keywords", SearchFieldDataType.collection(SearchFieldDataType.STRING))

And then query the vector store by setting the filter that any documents that have at least one of the keywords 'cat' and 'dog' using OData query:
keywords/any(t: search.in(t, 'cat, dog'))

Expected Behavior

Return all documents with keywords contains 'cat' or 'dog'.

Current Behavior

It's not supported, only single value metadata types and 'in' operator are supported in Azure AI Search.

Context

There are many scenarios we need set a group of keywords or tags into one metadata field, and search with filtering the keywords or tags.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by searching for MetadataField and the Azure AI Search filter implementation, then trace how metadata types and the in operator are translated. Done means collection-valued fields can be defined and filters such as keywords/any(t: search.in(t, 'cat, dog')) return matching documents.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java
Domain
backend, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.