Skip to content

metadata and generic filters in vector search #689

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

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

santiatpml
Copy link
Contributor

I have added two filters to vector_search: metadata_filter uses basic containment operator @> and generic_filter takes pretty much anything that the user wants to filter on documents table using SQL syntax.

generic_filter should give us quite a bit of coverage including timestamps and nested metadata.

Added three tests.

Copy link
Contributor

@montanalow montanalow left a comment

Choose a reason for hiding this comment

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

I think there is a quickly growing need to move to a builder pattern, to prevent having to duplicate this functionality for example on a text_search or fuzzy_search function. We need a better API that more cleanly encapsulates recall, ranking and filtering, reranking and refiltering, and finally passing as an input to another SQL function or recalling from the database to the application.

)

if metadata_filter:
cte_select_statement += (
" AND documents.metadata @> {metadata_filter}".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is nice. We should also add a GIN index to documents.metadata.

@santiatpml santiatpml merged commit 873ca9b into master Jun 6, 2023
@santiatpml santiatpml deleted the santi-pgml-sdk-metadata-filter branch June 6, 2023 00:16
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy