Set query filters, such as "name contains"

Using the Google App Engine using Objectify to query a data store, I would like to use a query like

objectifyService.query(Entity.class).filter("name contains", a); 

which will return a list with all objects containing the "a" caracter in their names. However, the contains statement does not exist.

Is there an easy way to do this?

+1
source share
2 answers

You can simplify the equivalent of the full-text search service by breaking the name field into the parts you want to find and save them as an indexed property. You can even use Lucene parsers to tokenize and protect your fields.

This works a lot when working with a data warehouse: if you do not have a query operator that does what you want, predetermine the appropriate data so that your query becomes an equality test.

Alternatively, use the FTS service.

+2
source

The answer is "the operator does not exist" - the Google data store does not support this type of filter. You should use a search engine to search: https://cloud.google.com/appengine/docs/java/search/

0
source

Source: https://habr.com/ru/post/987278/


All Articles