首页 > 解决方案 > 跨文档的邻近搜索

问题描述

假设我们有可搜索的 Lucene 文档,例如:

Document 1:

This is first sentence.
Document 2: 

This is second sentence.
Document 3:

This is third sentence.

除了上面的三个文档之外,我们还有一个SUPER包含所有三个文档的文本的文档,以支持跨内容的邻近搜索12& 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 1Document 2带有突出显示的字段firstthird在这种情况下。因此需要某种从Document SUPER子文档到子文档的高亮映射。

解决这个问题的最佳方法是什么?

旁注: 我并不是要一个完整的解决方案。我只是想了解如何使用现有的 Lucene API 来解决这个问题(如果有支持的话)......

标签: javalucene

解决方案


推荐阅读