Has ContainsNone Operator been added

Description

I saw this post on GitHub: Implements `ContainsNone` Operator by avirlrma · Pull Request #4576 · weaviate/weaviate · GitHub

Which seems to suggest that the ContainsNone operator has been added, but I don’t find any documentation for it. Can you please clarify?

If it has not been added, is there a way to create a filter for an object property array to make sure that the results do NOT contain specific elements in the array?

Server Setup Information

I am running on WCS.

Any additional Information

For example, I have a text field which contains an array of the names of groups to which the object belongs.

What I want to do is to be able to add an exclusion filter.

I want to be able to say that if the object contains: Labor Private Group, Apple Private Group, Amazon Private Group or Netflix Private Group, it should NOT be returned.

JP responded to this here: Slack

the PR was closed without being merged

This is my response:

How can I press for this (or something similar) as a filter operator? This would allow a level of access control within the filter that currently doesn’t exist. Essentially, it would allow for an “exclusion filter” to allow you to exclude objects that a user can not access. The only way to do this through application-level code would be to parse the query results after the fact . This is far less efficient.

Do you see what I am saying? The exclusion filter returns a smaller, pre-filtered result set, reducing the number of documents that need to be processed. This is far more efficient.

Who do I need to talk to to make this case?

1 Like

hi @SomebodySysop !!

Thanks for updating it here.

We’ll poke and push this internally so it can be released as this is indeed a popular feature request!

1 Like

Thank you! For anyone trying to implement any permissions-based access control to vectorized content (using the object properties), this would be a MUST HAVE feature.

1 Like

Hi @Marion_Nehring and @sebawita for a great Hero Roundtable yesterday. If I seemed a bit more animated than usual, it is because I have a major deal pending whose success is riding on a certain capability I need in Weaviate being available.

It was requested here two years ago: FR: Add a `ContainsNone` operator · Issue #3513 · weaviate/weaviate · GitHub

I have discussed it previously in these threads:

I need implementation of the “ContainsNone” GraphQL operator. This will allow me to create, using my existing query properties, what I call an “Exclusion Filter”.

Why is this so important? Because it allows every Weaviate developer to implement access control over their vector stores using ONLY the GraphQL filter. I can give you the details of my particular use case in private, but in general:

Let’s say you use a class property called “Groups” to determine who can access particular pieces of content.

Public users can access Groups A, B and C. A Private organization creates content in Groups D and E that is restricted to it’s users.

A, B and C are also serve as categories, so it is possible for a single piece of content to belong to both A and D. In this very basic permissions scenario, the current GraphQL tool does not provide a way to EXCLUDE content from Public users that belongs to both Public and Private groups.

That’s where the “Exclusion Filter” comes in.

Purpose: Improves search performance by filtering out group-restricted content at the query level.

How it works:

  1. Receives query prompt with identified user from calling app
  2. Checks which groups the current user cannot view (lacks “view group” permission in calling app)
  3. Builds a filter query to exclude documents containing those groups in the Groups property
  4. Adds the filter as a ContainsNone operator: field:“GroupD” OR field:“GroupE”) to the GraphQL

Result: GraphQL returns a smaller, pre-filtered result set, reducing the number of documents that need potentially expensive permission checking.

Key benefits:

  • Performance: Less data transferred from Weaviate (economical and faster)
  • Efficiency: Bulk filtering at database level vs individual applications level checks
  • Non-intrusive: Doesn’t change search relevance or user’s search terms
  • Safe: Restricted Documents which also belong to public groups are NOT included by default

So, what can I do to get this in front of developers to make the case that this would not only help me out, but could be of great benefit to many other users seeking to control access using just the GraphQL tool?