Search API, how to like query

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%';

Upvotes: 2

Views: 2170

Answers (1)

Ashish Awasthi
Ashish Awasthi

Reputation: 1327

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

Upvotes: 1

Related Questions