我是 SOLR 的首次亮相者,并且在solr中具有以下索引数据:
Code Status Timestamp 8fdd04e7 temporary 2018-25-09 21:07:10PM 8fdd04e7 temporary 2018-25-09 21:17:20PM 8fdd04e7 temporary 2018-25-09 21:20:40PM 8fdd04e7 success 2018-25-09 21:27:30PM 32c313e8 temporary 2018-25-09 22:31:30PM f663e6bc temporary 2018-25-09 23:35:20PM f663e6bc failure 2018-25-09 21:35:50PM d3fe29e7 temporary 2018-25-09 21:37:20PM
在这里,我正在寻找从未成功的代码或失败的代码。我正在寻找的是:
Code Status Timestamp 32c313e8 temporary 2018-25-09 22:31:30PM d3fe29e7 temporary 2018-25-09 21:37:20PM
答案 0 :(得分:0)
您可以使用过滤器查询。 使用fq参数向solr发送请求。
ex:http://localhost:8983/solr/CORE_NAME/select?q=*:*
您将在solr中获得所有文档
Code Status
8fdd04e7 temporary
8fdd04e7 temporary
8fdd04e7 temporary
8fdd04e7 success
32c313e8 temporary
f663e6bc temporary
f663e6bc failure
d3fe29e7 temporary
在上面的查询q=*:*
中返回所有已建立索引的文档(*-匹配所有文档)。
通过使用filterquery参数(fq
),我们可以过滤结果/文档以仅获取状态为:临时的文档
ex:http://localhost:8983/solr/CORE_NAME/select?q=*:*&fq=status:temporary
Code Status
8fdd04e7 temporary
8fdd04e7 temporary
8fdd04e7 temporary
32c313e8 temporary
f663e6bc temporary
d3fe29e7 temporary
已更新。
以下查询将过滤出状态值为成功或失败的结果
http://localhost:8983/solr/CORE_NAME/select?q=*:*&fq=-status:failure&fq=-status:success
希望这会有所帮助, Vinod