Skip to content

Filtering on a list of values silently ignores Regex/Equals and sends CONTAINS with a list value #150

Description

@apdavison

Summary

get_filter_value() accepts a list as a filter value, but get_query_filter_property() in fairgraph/queries.py doesn't handle one. It picks the operator from the type of the whole value, so a list of Regex or Equals objects falls through to CONTAINS. The generated query then has a CONTAINS filter whose value is a list.

Example

Dataset.list(client, short_name=[Equals("FOO"), Equals("BAR")])

The generated filter is {"op": "CONTAINS", "value": ["FOO", "BAR"]}. There is no error or warning, and the user asked for exact matching. Regex behaves the same way.

Also unclear

  • I haven't checked how the KG interprets a CONTAINS filter with a list value. It may match any element, or all of them, or return nothing.
  • For link-typed properties, get_query_filter_property() calls filter_obj.value.startswith(...) on the value, which would fail on a list. I haven't tried this.
  • Nothing in the documentation says whether lists are supported.

Expected behaviour

Filter values in lists should be handled explicitly, either supported or rejected with a clear error. They shouldn't silently change the meaning of the query.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions