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

Filtering json strings #32

Open
EricOuma opened this issue Apr 26, 2023 · 0 comments
Open

Filtering json strings #32

EricOuma opened this issue Apr 26, 2023 · 0 comments

Comments

@EricOuma
Copy link

Description

I have two string fields that are part of my filter_by query: first_data and second_data. Either of these fields can have a value or none of them. Their values are set by encoding a Python dictionary to a json string e.g

first_dict = {'age':40}
second_dict = {}

first_data = json.dumps(first_dict, default=str)
second_data = json.dumps(first_dict, default=str)

Steps to reproduce

schema_fields = [
        {
            "name": "first_data", "type": "string",
        },
        {
            "name": "second_data", "type": "string"
        },
        {
            "name": "some_field", "type": "string[]"
        }
]

# Note that I am only checking for emptiness in both fields. There is probably a better approach for this by I wonder this doesn't work

{
  "q": "*",
  "filter_by": "first_data:!={} && second_data:!={} && some_field:=[A,B]"
}

Expected Behavior

I expect to only see results that either first_data or second_data have a value

Actual Behavior

I see results have both first_data and second_data equal to {}
sample

Metadata

Typesense Version: 0.15.0

OS: Ubuntu 22.04.2 LTS

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

No branches or pull requests

1 participant