将此查询发送到应该从输入中获取项目的Parse.com服务器时,我得到所有(冗余)这些对象。
例如,我输入了一个20到25岁的范围,我选择的城市“纽约”,性别“女性”,它给我的结果是:所有用户都是女性,所有用户都有年龄年龄从20岁到25岁,来自纽约的用户。是否可以获得物品的(干净)联盟?
public void sendQuery(){
ParseQuery<ParseObject> leftToRight = ParseQuery.getQuery("Users");
leftToRight.whereGreaterThanOrEqualTo("age", age1);
ParseQuery<ParseObject> rightToLeft = ParseQuery.getQuery("Users");
rightToLeft.whereGreaterThanOrEqualTo("age", age2);
ParseQuery<ParseObject> city = ParseQuery.getQuery("Users");
city1.whereEqualTo("city", city);
ParseQuery<ParseObject> gender = ParseQuery.getQuery("Users");
gender1.whereEqualTo("gender", "female");
List<ParseQuery<ParseObject>> queries = new ArrayList<ParseQuery<ParseObject>>();
queries.add(leftToRight);
queries.add(rightToLeft);
queries.add(city);
queries.add(gender);
ParseQuery<ParseObject> mainQuery = ParseQuery.or(queries);
mainQuery.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> results, ParseException e) {
for (ParseObject gender : results) {
Object name = gender.get("name");
ParseFile image = (ParseFile) gender.get("ImageFile");
newUsernames.add(((Object) name).toString());
newImageUrls.add(((ParseFile) image).getUrl().toString());
}
}
});
}