Quickblox自定义对象Android:或运算符

时间:2014-08-21 21:19:44

标签: android object quickblox

我在自定义对象中有5个字段,我需要创建一个请求构建器,检查这5个字段中是否包含特定字符串。我试过这个:

QBCustomObjectRequestBuilder customObjectRequestBuilder = new QBCustomObjectRequestBuilder();
    customObjectRequestBuilder.eq("tag1", searchTerm);
    customObjectRequestBuilder.eq("tag2", searchTerm);
    customObjectRequestBuilder.eq("tag3", searchTerm);
    customObjectRequestBuilder.eq("tag4", searchTerm);
    customObjectRequestBuilder.eq("tag5", searchTerm);

但是,当然,这只会返回所有5个字段等于搜索字词的记录。

我需要知道如何构建一个返回记录的请求,其中至少有一个字段等于搜索词。

代码示例非常有用。谢谢。

1 个答案:

答案 0 :(得分:1)

我找到了答案:

QBCustomObjectRequestBuilder customObjectRequestBuilder = new QBCustomObjectRequestBuilder();
    customObjectRequestBuilder.or("tag1[or]=" + searchTerm + "&tag2[or]=" + searchTerm + "&tag3[or]=" + searchTerm + "&tag4[or]=" + searchTerm + "&tag5[or]=" + searchTerm);