I'm using the Search API GAE, how to make a query like "like%"? as is done in SQL example: select * from person where name like '% john%';
Asked
Active
Viewed 2,053 times
2
-
what do you want exactly please explain it . – syed shah Sep 07 '13 at 21:06
-
I want to do a search using the search service (Search API) like this in SQL: select * from name like '% jo%'; (return john) – Joander Vieira Cândido Sep 08 '13 at 14:24
1 Answers
1
your queryString would be "name: john" on the person index with name field set to be a Text field.
A regular query with ':' or '=' on the Text or HTML type of index value is closest (not same) to 'like' in SQL.
Details on available operators to use in the query are at https://developers.google.com/appengine/docs/java/search/query_strings#Java_Queries_on_text_and_HTML_fields.
Also check stemming if your use-case is to find words with similar meaning. https://developers.google.com/appengine/docs/java/search/query_strings#Java_Stemming

Ashish Awasthi
- 1,302
- 11
- 23
-
thank you, I'm Brazilian I'm using google translator.But if your putting "name: jo" (similar to "like '%jo%' ") returns no data – Joander Vieira Cândido Sep 08 '13 at 14:11
-
Joander, I don't think "like '%jo%'" kind of queries are supported in GAE-search yet, you may raise a ticket to add it though. Or else you can go to your database for these. GAE-search is primarily designed to work on the context and it uses tokens (whole words). What you can do though is stemming, if your use-case is to find words with similar meaning. https://developers.google.com/appengine/docs/java/search/query_strings#Java_Stemming – Ashish Awasthi Sep 09 '13 at 12:07