java - Lucene 8.6.1 加入查询没有收集所有加入的记录
问题描述
Lucene 8.6.1 加入查询没有收集所有加入的记录
joinQuery = JoinUtil.createJoinQuery(fromField, false, toField, query, searcher,
ScoreMode.None);
执行连接查询时,它不会收集所有连接的记录。
protected void search(List<LeafReaderContext> leaves, Weight weight, Collector collector)
throws IOException {
// TODO: should we make this
// threaded...? the Collector could be sync'd?
// always use single thread:
for (LeafReaderContext ctx : leaves) { // search each subreader
final LeafCollector leafCollector;
try {
**leafCollector = collector.getLeafCollector(ctx);**
} catch (CollectionTerminatedException e) {
// there is no doc of interest in this reader context
// continue with the following leaf
continue;
}
BulkScorer scorer = weight.bulkScorer(ctx);
if (scorer != null) {
try {
scorer.score(leafCollector, ctx.reader().getLiveDocs());
} catch (CollectionTerminatedException e) {
// collection was terminated prematurely
// continue with the following leaf
}
}
}
}
类似的 joinQuery 在 lucene 4.5.1 中工作
我们是否需要编写自定义收集器来收集 JoinQuery 记录或我们可以收集它的任何其他方式?
//更新
当我在 rewrite 方法中通过 org.apache.lucene.search.MultiTermQueryConstantScoreWrapper 中的连接查询 TermsQuery{field=associatedresourceurifromQuery=+_category:animals} 时,我得到collectedTerms null 并且结果具有MatchNoDocsQuery(“empty BooleanQuery”),任何人都有任何想法,我们是否必须编写任何 CustomCollector 来收集连接查询结果?
提前致谢。
解决方案
推荐阅读
- docker - 为什么在 Docker 容器中提取 tar 存档在 Windows 上如此缓慢?
- angular - CSRF 令牌不匹配 Laravel sanctum 和 Angular http
- javascript - 使用javascript转换翻译不起作用
- python - 查找数据框中字符串的出现次数,与另一个单元格中的值相关联
- python - 在模型实例的内存列表上使用 Django Queryset 过滤器 API?
- react-native - persistCombineReducers 错误:在 persitor 配置中需要密钥
- python - 安装pyrebase时如何解决此错误?
- c++ - 将 Unicode 输出到控制台的最佳方法是什么?
- ruby-on-rails - Rails、Active Record、Devise 和 cloudinary、simple form、heroku... 照片没有上传到我的 cloudinary
- linux - Digital Ocean Droplet 重启恢复模式