Google App Engine, Java Datastore Query: how to execute SQL statement?

I have an entity:

Entity e = new Entity("Item"); e.setProperty("Description", Description); 

And I'm trying to do a keyword search. Ex, If I have "abc", "eabcd" and "abc block", when I do a search for "abc", it should return all three.

If I use SQL, I would say something like this:

 Select * from Item where Description like "%"+keyword+"%" 

I know I can do this, but it will only return "abc".

 public static Iterable<Entity> SearchItems(String Description) { DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Query q = new Query("Item").addFilter("Description", FilterOperator.EQUAL, Description); return ds.prepare(q).asIterable(); } 

What should I do?

PS I saw this, but it is not particularly useful. Google App Engine and SQL LIKE

+4
source share
1 answer

You need a text search and the App Engine datastore does not support this. For such requests .

However, the API does not support the application of full text queries to the data warehouse, you need to create and store your data in indexed documents . You may need to consider duplicating data in your data warehouse and save it again in the indexed document store.

+4
source

All Articles