java - 跨文档的邻近搜索
问题描述
假设我们有可搜索的 Lucene 文档,例如:
Document 1:
This is first sentence.
Document 2:
This is second sentence.
Document 3:
This is third sentence.
除了上面的三个文档之外,我们还有一个SUPER
包含所有三个文档的文本的文档,以支持跨内容的邻近搜索1
,2
& 3
- 所以它看起来像:
Document SUPER:
This is first sentence.
This is second sentence.
This is third sentence.
现在查询:
first
将返回Document 1
查询:
second
将返回Document 2
查询:
"first third"~20
将返回Document SUPER
。
我们想要实现的是让 Lucene 改为返回Document 1
并Document 2
带有突出显示的字段first
,third
在这种情况下。因此需要某种从Document SUPER
子文档到子文档的高亮映射。
解决这个问题的最佳方法是什么?
旁注: 我并不是要一个完整的解决方案。我只是想了解如何使用现有的 Lucene API 来解决这个问题(如果有支持的话)......
解决方案
推荐阅读
- php - 使用 PayPal 付款会挂在 notify_url 页面内
- cassandra - 为什么 ScyllaDB MV 已准备好生产,而 Cassandra MV 仍处于试验阶段,不建议使用?
- git - github分支与我推送的差异
- c# - 有没有办法让依赖注入和扩展方法交互?
- python - 如何使用 if 语句将 DataFrame 项返回到 Excel
- database - Postgresql 无法更改 max_connections
- multithreading - 在并发编程中,是否有可能通过使用锁,一个程序有时会使用比必要更多的处理器?
- vb.net - 如何在 VB.NET 中指定 lamdba 函数?
- twig - twig attrbutes.addclass 嵌套问题
- c - 节点值在 C 中自动更改