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

'contains' filter should be case insensitive #57

Open
Redsandro opened this issue Jul 21, 2018 · 2 comments
Open

'contains' filter should be case insensitive #57

Redsandro opened this issue Jul 21, 2018 · 2 comments

Comments

@Redsandro
Copy link

Redsandro commented Jul 21, 2018

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.

Redsandro added a commit to Redsandro/jsonapi-store-mongodb that referenced this issue Jul 21, 2018
@Redsandro
Copy link
Author

@pmcnr-hx or @paparomeo is either of you willing to review this PR?

I understand that there is a slowdown in maintenance, and there is an internal debate about the possibility of handing over the maintenance to someone else. This is however a serious little bugger that could really use a release on npm.

@championswimmer
Copy link

I'll be working on forking store-mongodb to jagql in this week

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

2 participants