Objectify query filters like "name contains"
Asked Answered
B

2

1

With Google App Engine using Objectify to query the datastore, I would like to use a query like

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

which would return a list with all the entities containing the 'a' caracter in their names. However the contains operator doesn't exist.

Is there a simple way to do that?

Bea answered 22/12, 2014 at 0:39 Comment(0)
V
2

You can work up a simplified equivalent of the fulltext search service by breaking down your name field into the pieces you wish to search by and storing them as an indexed property. You can even use Lucene's analyzers to tokenize and stem your fields.

This comes up a lot when working with the datastore: If you don't have a query operator that does what you want, preindex relevant data so that your query is now an equality test.

Alternatively, use the FTS service.

Vetiver answered 22/12, 2014 at 6:8 Comment(0)
F
0

Answer is "operator doesn't exist" - Google datastore does not support this type of filter. To search, you should use Search engine : https://cloud.google.com/appengine/docs/java/search/

Finsen answered 22/12, 2014 at 1:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.