在 SOLR 中接受和管理相同的文档

Accepting and managing identical documents in SOLR

我有一个树结构,其中包含我正在使用 Solr 编制索引的文档。许多文件存在于多个地方,内容相同,但一些元数据不同。我想将重复项保留在索引中,所以它不是我正在寻找的重复数据删除(或者至少是这样认为)。如果我想对重复的文档进行单次点击,但仍然能够保持单个文档可用,我可以使用哪些策略?

Folder A          |
  Folder A1       | 
    Document 1    | Category 1
    Document 2    | Category 1
  Folder A2       |
    Document 1    | Category 2
    Document 2    | Category 2

文档 1 相同,同时存在于文件夹 A1 和 A2 中。在文档1中搜索某个东西时,如果我过滤掉类别1(或2),我希望能够找到它,但是如果没有过滤器,我希望得到一个匹配,说明它匹配多个类别。

在填充索引或查询时处理这个问题更好吗?有哪些选项可用?

这是使用 Collapse and Expanding 的好案例。

您根据文档的文档 ID 折叠结果集,让您只能为每个不同的文档返回一个结果。您仍然可以使用扩展功能取回唯一文档的所有变体(即不同的元数据集及其类别)。

q=foo&fq={!collapse field=DocumentID}&expand=true

The expand=true parameter turns on the ExpandComponent. The ExpandComponent adds a new section to the search output labeled expanded.

Inside the expanded section there is a map with each group head pointing to the expanded documents that are within the group. As applications iterate the main collapsed result set, they can access the expanded map to retrieve the expanded groups.

您也可以选择使用 Result Grouping,但如果您可以使 C&E 工作,那是推荐的解决方案。