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

vectorstore: Add support to filter by IS NULL and IS NOT NULL criteria #40

Merged

Conversation

MartinGotelli
Copy link
Contributor

Description: Add support to filter by IS NULL criteria in the metadata
Issue: N/A
Dependencies: N/A
Twitter handle: @martinferenaz

This PR fixes the problem when you want to search if a tag has a value (exists) in the metadata. To check that you need to compare with the "IS NULL" method and the "$eq" operator only checks that the tag exists and has a null value assigned.

In addition, a test for the $nin condition was added and a bug arrised, the bug was resolved adding a not condition after the in_

@MartinGotelli MartinGotelli changed the title Add support to filter by IS NULL and IS NOT NULL criteria vectorstore: Add support to filter by IS NULL and IS NOT NULL criteria May 4, 2024
Copy link
Collaborator

@eyurtsev eyurtsev left a comment

Choose a reason for hiding this comment

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

Looks great! I can merge and release as soon as $null is updated to $exists

langchain_postgres/vectorstores.py Show resolved Hide resolved
langchain_postgres/vectorstores.py Outdated Show resolved Hide resolved
@MartinGotelli MartinGotelli requested a review from eyurtsev May 16, 2024 20:21
@eyurtsev eyurtsev merged commit a995b4c into langchain-ai:main May 16, 2024
6 checks passed
eyurtsev pushed a commit that referenced this pull request May 18, 2024
So... yeah I f***ed up. But this is the fix.

The $exists was working as the $null, but the rename implies also
changing how the bool value is interpreted:

$exists: True (there is a tag, I don't care the value)
$exists: False (no tag in there)

ref: #40
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.

2 participants