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

Please add GQL support for "CONTAINS" #118

Open
nigeljohnson73 opened this issue May 24, 2016 · 4 comments
Open

Please add GQL support for "CONTAINS" #118

nigeljohnson73 opened this issue May 24, 2016 · 4 comments

Comments

@nigeljohnson73
Copy link

It seems to be supported in the google docs:

https://cloud.google.com/datastore/docs/apis/gql/gql_reference#grammar

Extremely helpful for doing "like" searches.

@tomwalder
Copy link
Owner

If you read that page further down, you will see that CONTAINS is not for strings. It is for array-like sets and is synonymous with = queries.

Comparators are either equivalence comparators: =, IN, CONTAINS,...

@nigeljohnson73
Copy link
Author

I didn't read that bit that way, sorry. Someone did point me at adding some form of filtering to do "like" styled queries with the full-text-search, but it seems that has not made the PHP API yet. I think there is also a significant overhead with this in both index storage requirements and processing, so probably not a good thing to add to to a cloud project.

I think "contains" would still be a good enhancement for "tag" style fields?

@tomwalder
Copy link
Owner

You can just use =

For example, if you have a multi-value property (string list) called tags, you can do

SELECT * FROM Books WHERE tags = @tag

and then bind a string like Horror to this, and it will get you any booked tagged as Horror

@netcell
Copy link

netcell commented May 25, 2016

How can I define a string list field? Do you mean = equals contains and if I have a tags of Horror, Comedy the query would find it too?

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

3 participants