Skip to content

'contains' filter should be case insensitive #57

Open
@Redsandro

Description

@Redsandro

According to the docs:

To only show articles where the title attribute is a case-insensitive match against linux-rocks:

http://localhost:16006/rest/articles?filter[title]=~linux-rocks

To only show articles where the title attribute contains for:

http://localhost:16006/rest/articles?filter[title]=:for

It doesn't state that seaching within a field (:) should be case-sensitive.

Looking at for example the jsonapi-store-relationaldb handler, you can see that the : filter is actually case insensitive.

Searching with the mongodb handler should also be case-insensitive, because the behavior of filters should be identical between storage providers.

A workaround is to query all possible cases and merge the search results:

  • ?filter[title]=:for
  • ?filter[title]=:For
  • ?filter[title]=:FOR

The offending line is this:

":": new RegExp(value)

I will provide a PR below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions