gpt4 book ai didi

java - 使用 SolrIndexSearcher 进行 ids 查询

转载 作者:行者123 更新时间:2023-12-02 09:39:33 24 4
gpt4 key购买 nike


我想对 SolrIndexSearcher 进行 ids 查询(使用它们的 ids 从 solr 获取多个文档) - 类似于对 SolrServer q=:&ids=ID1,ID2&fl=* 的 ids 查询。

我尝试以多种方式调用 search(Query,int) 但没有成功

TopDocs results = this.indexSearcher.search(QueryParsing.parseQuery("q=\\*\\:\\*&ids=ID1,ID2&fl=*", this.indexSearcher.getSchema()) , MAX_DOCUMENTS);

结果总是空的..

谢谢

最佳答案

您可以使用 q=ids:(ID1 OR ID2) 进行搜索,这将搜索 ids。
您还可以使用过滤器查询q=*:*&fq=ids:(ID1 OR ID2),这是一种高性能方法,因为它利用了过滤器缓存。

关于java - 使用 SolrIndexSearcher 进行 ids 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12128724/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com