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

[Feature Request] Add "Not" operator in filter to support "Not Like" etc. in Get queries #3683

Open
paulcalcraft opened this issue Oct 27, 2023 · 3 comments
Labels

Comments

@paulcalcraft
Copy link

paulcalcraft commented Oct 27, 2023

It looks like a previously faulty not operator was removed: #3360

But I can't see any way to filter a search by excluding some matching criteria. For example, I want to exclude embedded chunks that are from a particular domain name, so I want to essentially invert this Like:

const response = await client.graphql
  .get()
  .withClassName('Snippet')
  .withFields('text')
  .withWhere({
    path: ['url'],
    operator: 'Like',
    valueText: 'https://example.org*',
  })
  .do();
console.log(response);

So we'd be able to add a Not operator like this:

const response = await client.graphql
  .get()
  .withClassName('Snippet')
  .withFields('text')
  .withWhere({
                operator: 'Not',
                operands: [{
                    path: ['url'],
                    operator: 'Like',
                    valueText: 'https://example.org*',
                }],
            })
  .do();
console.log(response);

Given the implementation of Like etc. (https://github.com/weaviate/weaviate/blob/b5490142fa6cea9a6212e77055db7479e69760b7/adapters/repos/db/inverted/row_reader.go#L194C24-L194C24) it might actually be easier to implement as a new operator called NotLike, rather than a general purpose Not? I haven't looked too far into it.

In any case, it might be worth adding a note to the filter documentation to say that a Not operator isn't currently supported because it took me quite a lot of digging to confirm that I wasn't just missing something. (And I might still be!)

@etiennedi
Copy link
Member

Thanks for the request. Seems very related to #3319 which would likely act as a basis for this. Please upvote that one as well, to express your interest.

@thearchitector
Copy link

thearchitector commented Nov 29, 2023

For posterity (i upvoted as well), being able to negate arbitrary filters would be incredibly useful / necessary for complex logic, so i fully support this as a feature.

@alberto-bracci
Copy link

Any update on this feature request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants