Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for filtered vector search #100

Merged
merged 13 commits into from
Oct 17, 2023
Merged

Conversation

yoziru
Copy link
Contributor

@yoziru yoziru commented Oct 16, 2023

This PR adds support for metadata filters in vector search
Filters are based on MongoDB's query operators since some vector dbs already use this approach. For the first step, only string filtering is supported:

  • $eq
  • $ne
  • $and
  • $or

Float operators ($gte, $lte, ..) are for a later PR

Example simple

{
    "collection": "grafana.promql.templates",
    "query": "count over time",
    "filter": {
        "metric_type": {
            "$eq": "gauge"
        }
    }
}

Example OR

{
    "collection": "grafana.promql.templates",
    "query": "count over time",
    "filter": {
        "$or": [
            {
                "metric_type": {
                    "$eq": "gauge"
                }
            },
            {
                "metric_type": {
                    "$eq": "histogram"
                }
            }
        ]
    }
}

@yoziru yoziru changed the title vector search add filters Add support for filtered vector search Oct 16, 2023
@yoziru yoziru requested a review from sd2k October 16, 2023 12:18
@yoziru yoziru marked this pull request as ready for review October 16, 2023 12:20
Copy link
Contributor

@sd2k sd2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments inline, haven't tested this but it seems good otherwise.

pkg/plugin/resources.go Outdated Show resolved Hide resolved
pkg/plugin/vector/store/qdrant.go Outdated Show resolved Hide resolved
pkg/plugin/vector/store/qdrant.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sd2k sd2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@yoziru yoziru merged commit bbca65b into main Oct 17, 2023
3 checks passed
@yoziru yoziru deleted the vector-search-add-filters branch October 17, 2023 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants