0
votes

In my GAE Datastore I have "Person" Entity with name, surname and country

I need to do a query like "SELECT * FROM Country WHERE name LIKE '%spa%'"

This answer offers a solution like this:

Query query = new Query("Person");
query.addFilter("name", FilterOperator.GREATER_THAN_OR_EQUAL, "pe");
query.addFilter("name", FilterOperator.LESS_THAN, "pe"+ "\uFFFD");

But I don't have any success, always return 0 results... I'm missing something?

It seems that another alternative is useing the "Search API", but... How I migrate all my data of "Persons" in my Datastore to a new Document to do the search?

Any solutions?

Thanks

1

1 Answers

1
votes

That answer is not the same as your question. The query they provide is a prefix query: ie all names that start with "pe". You seem to want a query for all names which contain "pe" anywhere, which is not possible for the reasons explained in the accepted answer to that question.

The Search API is indeed the answer to doing this, and the details of how to create documents to represent your datastore objects are contained in the link you posted. (Note this isn't a migration: your data should stay in the datastore, the Search API is a separate system used only for full-text search.)