【发布时间】:2013-03-17 07:01:39
【问题描述】:
我有实体:
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
【问题讨论】: