Solr 方面计数不正确,如何去重

发布于 2024-11-29 20:21:49 字数 86 浏览 9 评论 0原文

我们使用两个 solr 来索引文件。有时一篇文章会在两个 solr 中建立索引,因为我们会更新。由于这些重复的文章,导致面计数不正确的问题。如何消除重复计数?

We are using two solrs to index the files. Sometimes one article is indexed in both solrs because we do update. It cause a problem that the facet counts are not correct due to these duplicated articles. How can I de-duplicate the counts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断舍离 2024-12-06 20:21:49

我的建议是不要保留重复的文章。因此,您需要一种方法来识别这些重复的文章并将其从一个 SOLR 中删除。

如果您不想删除重复的文章,您仍然需要跟踪它们。
了解 SOLR1 中的哪些文章在 SOLR2 中重复将帮助您消除重复计数,如下所示:

  • 在 SOLR1 中创建一个名为 的额外字段:

    IsDuplicateField = true,如果文章在 SOLR2 中重复
                     = 假,否则
    
  • 当您对 SOLR1 进行查询时添加:IsDuplicatedField=true 到构面。

  • 检索结果时,只需将面计数总数与 SOLR1 中的 IsDuplicateField 总数相减即可。

在这种情况下,方面 IsDuplicateField 将检索所有重复且与您的查询匹配的文章。

祝你好运 !

My advise would be not to keep duplicated articles. So you need a method to identify this duplicates articles and deleted it form one SOLR.

If you don't want to delete duplicate articles you still need to keep track of them.
Knowing which articles from SOLR1 are duplicates in SOLR2 will help you de-duplicate the counts like this:

  • create an extra field in SOLR1 named :

    IsDuplicateField = true, if article is duplicated in SOLR2
                     = false, otherwise
    
  • when you do the query to SOLR1 add: IsDuplicatedField=true to facets.

  • when retrieving result just decrease the total number of facet counts with total number of IsDuplicateField from SOLR1.

In this situation the facet IsDuplicateField will retrieve all the articles that are duplicated and match your query.

Good luck !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文