在使用Java SDK 4.7.10,以下编码显示出问题
private String keyword = "Kylie cosmetics";
private void fetchOurOwnData() {
AVQuery query = new AVQuery("Products");
// Test 1 & Test 3
query.whereContains("searchString", keyword.toLowerCase().split(" ")[0]);
// Test 2 & Test 3
query.whereContains("searchString", keyword.toLowerCase().split(" ")[1]);
query.countInBackground(new CountCallback() {
@Override
public void done(int count, AVException e) {
if (e != null) {
Log.d("reload", "1 - " + e.getLocalizedMessage());
} else {
Log.d("Result", "Count: " + String.valueOf(count));
}
}
});
}
在 test1 中,使用以下代码,获得count = 32
query.whereContains("searchString", keyword.toLowerCase().split(" ")[0]);
Log
D/===AVOS Cloud===: LogUtil$avlog->d->43: curl -X GET -H "X-LC-Id: IDX4LztPPtMsBK7gim8UJo7s-gzGzoHsz" -H "X-LC-Key: YourAppKey" -H "" -G --data-urlencode 'count=1&limit=0&where={"searchString":{"$regex":".*kylie.*"}}' https://idx4lztp.api.lncld.net/1.1/classes/Products
D/===AVOS Cloud===: LogUtil$avlog->d->43: {"results":[],"count":32}
D/===AVOS Cloud===: AVPushConnectionManager->initConnection->111: push connection is open
在 test2 中,使用以下代码,获得count = 221
query.whereContains("searchString", keyword.toLowerCase().split(" ")[1]);
Log
D/===AVOS Cloud===: LogUtil$avlog->d->43: curl -X GET -H "X-LC-Id: IDX4LztPPtMsBK7gim8UJo7s-gzGzoHsz" -H "X-LC-Key: YourAppKey" -H "" -G --data-urlencode 'count=1&limit=0&where={"searchString":{"$regex":".*cosmetics.*"}}' https://idx4lztp.api.lncld.net/1.1/classes/Products
D/===AVOS Cloud===: LogUtil$avlog->d->43: {"results":[],"count":221}
D/===AVOS Cloud===: AVPushConnectionManager->initConnection->111: push connection is open
在 test3 中,使用以下代码,获得count = 221
query.whereContains("searchString", keyword.toLowerCase().split(" ")[0]);
query.whereContains("searchString", keyword.toLowerCase().split(" ")[1]);
Log
D/===AVOS Cloud===: LogUtil$avlog->d->43: curl -X GET -H "X-LC-Id: IDX4LztPPtMsBK7gim8UJo7s-gzGzoHsz" -H "X-LC-Key: YourAppKey" -H "" -G --data-urlencode 'count=1&limit=0&where={"searchString":{"$regex":".*cosmetics.*"}}' https://idx4lztp.api.lncld.net/1.1/classes/Products
D/===AVOS Cloud===: LogUtil$avlog->d->43: {"results":[],"count":221}
D/===AVOS Cloud===: AVPushConnectionManager->initConnection->111: push connection is open
是不是whereContains在Java只会取最后一个条件?但我在iOS SDK并没有这个问题
-
创建时间
19年5月12日
-
最后回复
19年5月13日
-
1
回复
-
1.1K
浏览
-
2
用户
-
1
赞
-
1
链接