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

Wildcard search does not match beginning of string #415

Closed
mozey opened this issue Mar 4, 2015 · 4 comments
Closed

Wildcard search does not match beginning of string #415

mozey opened this issue Mar 4, 2015 · 4 comments

Comments

@mozey
Copy link

mozey commented Mar 4, 2015

Consider the following SQL query, it gives me back one database row:

select * from task where description like '%Something%';

I would expect the following query to produce the same, but I get zero results:

api/task?q={"filters":[{"name":"description","op":"like","val":"%Something%"}]}

When I search for "Something%", I do get back the same row as the SQL query.

@jfinkels
Copy link
Owner

jfinkels commented Mar 5, 2015

I think this is because you need to URL encode your query parameters. This should be noted in the documentation.

@jfinkels
Copy link
Owner

jfinkels commented Mar 5, 2015

This explains #331 also.

@jfinkels
Copy link
Owner

jfinkels commented Mar 5, 2015

Let me know if that works for you so I can close this issue.

jfinkels added a commit that referenced this issue Mar 5, 2015
When making a request with a filter that uses the ``like`` operator, the
user will likely provide an argument of the form ``%somestring%``. If
not properly URL encoded, this will be interpreted on the server side as
an unintended string.

This fixes #331 and #415.
@mozey
Copy link
Author

mozey commented Mar 5, 2015

Ah, encoding it works! Was pasting the queries into the address bar, I thought the browser would do the encoding automatically. Odd that "Something%" does work without explicitly encoding.

@jfinkels jfinkels closed this as completed Mar 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants