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

Cant filter with $in operator #27

Open
AaronMcCloskey opened this issue Feb 29, 2024 · 2 comments
Open

Cant filter with $in operator #27

AaronMcCloskey opened this issue Feb 29, 2024 · 2 comments

Comments

@AaronMcCloskey
Copy link

I know you can use $containsi but it doesn't really achieve what I want.

Let's use this example

schema.json

"page": {
  "type": "customField",
  "options": ["My Account:my-account", "Account:account", "Account Edit:account-edit"],
  "customField": "plugin::multi-select.multi-select"
},

HTTP Request

$in

filters[page][$in]=account

Does not return any data, even if I have multiple entries that have account selected

$containsi

filters[page][$containsi]=account

Returns any entries that page value includes the account characters and not only the account value

Current Behaviour

[
    {
        "id": 1,
        "attributes": {
            "page": [
                "my-account"
            ]
        }
    },
    {
        "id": 3,
        "attributes": {
            "page": [
                "account-edit"
            ]
        }
    },
    {
        "id": 5,
        "attributes": {
            "page": [
                "account"
            ]
        }
    }
]

Expected Behaviour using $in

[
    {
        "id": 5,
        "attributes": {
            "page": [
                "account"
            ]
        }
    }
]

At the moment, I can't use this plugin due to this missing feature.

Unless I am missing something. Any help would be greatly appreciated.

@Pikachews
Copy link

A hacky workaround I found for this is using $containsi and wrapping the value in quotes, e.g. [$containsi]="account"

@eruiz-impact
Copy link

Is there a timeline for this fix? I will need to drop this plugin if this functionality doesn't exist.

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

3 participants