Google App Engine,Java数据存储区查询:如何使用SQL Like语句?

我有实体:
Entity e = new Entity("Item");
e.setProperty("Description", Description);
我正在尝试执行关键字搜索.
例如,如果我有“abc”,“eabcd”和“abc block”,当我执行搜索“abc”时,它应该返回所有三个.
如果我使用SQL,我会说这样的话:
Select * from Item where Description like "%"+keyword+"%"
我知道我可以做到这一点,但这只会返回“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();
}
我该怎么办?
附:我已经看过了,但这并不是特别有用. Google App Engine and SQL LIKE
解决方法:
您需要的是full text search,而App Engine数据存储不支持该功能.您需要使用App Engine Search API来执行such queries.
但是,API不支持将全文查询应用于数据存储区,您需要在indexed documents中构建和存储数据.您可能需要考虑复制数据存储区中的数据并将其再次存储在索引文档存储中.