简体   繁体   English

使用Hibernate Search在多值上添加构面到应用程序

[英]Add faceting over multivalued to application using Hibernate Search

we use Hibernate Search in our application. 我们在应用程序中使用了Hibernate Search。 We use faceting. 我们使用刻面。 Recently we have found a big limitation. 最近,我们发现了一个很大的限制。 Faceting over fields that can have multiple values doesn't work properly with Hibernate Search - if a document has multiple values for faceted field (ex. multiple categories), only one of the values is taken into account. 在具有多个值的字段上进行切面操作无法在Hibernate Search中正常工作-如果文档中有多个值用于切面字段(例如,多个类别),则仅考虑其中一个值。

I can currently think of a couple two solutions: 我目前可以想到两种解决方案:

  • use bobo-browse (http://code.google.com/p/bobo-browse/) 使用bobo-browse(http://code.google.com/p/bobo-browse/)
  • solr (http://lucene.apache.org/solr/) solr(http://lucene.apache.org/solr/)

In both solutions we continue to maintain the index using Hiberante Search and making queries as we did before (using Hiberante Search), and run additional bobo-browse or solr query for faceting, where required (bobo-browse or solr would use index in kind of "read-only" manner). 在这两种解决方案中,我们将继续使用Hiberante Search维护索引并像以前一样进行查询(使用Hiberante Search),并在需要时运行其他bobo-browse或solr查询以进行构面(bobo-browse或solr将使用实物索引) “只读”方式)。 The problem is that we update index quite often, and would like to get really fresh data in faceting queries. 问题在于我们经常更新索引,并且希望在分面查询中获得真正的新鲜数据。 Bobo-browse doesn't automatically integrate with Hiberante Search, and to keep search up to date, I might get into some problems (ex. https://groups.google.com/forum/?fromgroups=#!topic/bobo-browse/sn_Efc-YClU ). Bobo浏览器不会自动与Hiberante搜索集成,为了使搜索保持最新状态,我可能会遇到一些问题(例如https://groups.google.com/forum/?fromgroups=#!topic/bobo-浏览/ sn_Efc-YClU )。 The documentation looks a bit untidy and not yet completed. 该文档看起来有点凌乱,但尚未完成。 Solr on the other hand seems like a really big thing to add, just to get faceting work properly. 另一方面,Solr似乎是一件很重要的事情,只是为了使构面正常工作。 And I'm still afraid I might run into some problems with updating/refreshing index. 而且我仍然担心在更新/刷新索引时会遇到一些问题。

Do you have any experience in that matter? 您对此事有经验吗? Any suggestions? 有什么建议么?

As a Hibernate Search developer, I'd suggest to join us and help implement what you need. 作为Hibernate Search开发人员,我建议您加入我们,并帮助您实现所需的工具。

Noone of us actually needed multivalued faceting so we're not really sure which solution to pick either; 我们当中没有人真正需要多值分面,因此我们不确定是否选择哪种解决方案。 it seems you have a real need, that's perfect to explore the alternatives and try them out. 看来您确实有需求,这是探索替代方案并进行尝试的完美之选。

Hibernate Search already depends on many Solr modules especially because of the large collection of excellent analysers. Hibernate Search已经依赖于许多Solr模块,尤其是由于大量优秀的分析器所致。 I'm confident we could find a way to embed the faceting logic of Solr and package it nicely in our consistent API, without the need to actually start Solr in server mode. 我相信我们可以找到一种方法来嵌入Solr的方面逻辑并将其很好地打包到我们一致的API中,而无需在服务器模式下实际启动Solr。

I guess we could do the same with Bobo-browse; 我想我们可以用Bobo-browse做同样的事情。 I'd prefer Solr to not add other dependencies, but if bobo-browse proofs a superior solution why not.. but you can help us in this choice. 我希望Solr不添加其他依赖项,但是如果bobo-browse证明是一种出色的解决方案,为什么不呢?。但是您可以在这种选择上帮助我们。

What would you get in exchange? 你会得到什么交换?

  • we'll maintain it: compatibility will stay with any future version. 我们将继续维护:与任何将来的版本都将保持兼容性。 hopefully you'll help a bit. 希望您会有所帮助。
  • eternal gratitude from other users ;) 来自其他用户的永恒感激;)
  • rock solid testing from thousands of other users 数千其他用户的坚实测试
  • bugfixes and improvements from .. 错误修正和改进。
  • a rock star badge on your CV 简历上的摇滚明星徽章

What is required? 需要什么?

  • unit tests 单元测试
  • documentation updates 文档更新
  • sensible code 明智的代码

https://community.jboss.org/wiki/ContributingToHibernateSearch https://community.jboss.org/wiki/ContributingToHibernateSearch

I also use Bobo Browse in combination with Hibernate Search. 我还将Bobo Browse与Hibernate Search结合使用。 I also have the problem with regular updates and the read-only issue. 我也有定期更新和只读问题。 Bobo is not the easiest library out there and I've looked several times at ways to integrate with Hibernate Search and just gave up because of the complexity. Bobo并不是最简单的库,我已经多次研究了与Hibernate Search集成的方法,但由于复杂性而放弃了。

I use timed reloads of the index in order to ensure freshness but that creates a lot of garbage to be collected. 我使用索引的定时重装以确保新鲜度,但这会产生大量垃圾。 Lucene has over time optimized the process of reopening indexreaders, but the Bobo team is not really focused on supporting that. 随着时间的流逝,Lucene已经优化了重新打开索引读取器的过程,但是Bobo团队并没有真正致力于支持它。 https://linkedin.jira.com/browse/BOBO-31 describes this issue. https://linkedin.jira.com/browse/BOBO-31描述了此问题。

The Hibernate Search infrastructure should provide enough flexibility to integrate. Hibernate Search基础结构应提供足够的灵活性来进行集成。 Zoie is a real-time indexing system like Hibernate Search that is integrated with Bobo https://linkedin.jira.com/wiki/display/BOBO/Realtime+Faceting+with+Zoie Perhaps it can inspire your efforts Zoie是与Bobo集成的类似于Hibernate Search的实时索引系统https://linkedin.jira.com/wiki/display/BOBO/Realtime+Faceting+with+Zoie也许它可以激发您的努力

This is something of a solution to the multi-value facet-count problem for hibernate-search. 这是对休眠搜索的多值构面计数问题的一种解决方案。

Blog: http://outbottle.com/hibernate-search-multivalue-facet-counts/ 博客: http//outbottle.com/hibernate-search-multivalue-facet-counts/

The blog is complete with a Java Class that can be reused to generate facet-counts for single-value and multi-value fields. 该博客包含一个Java类,可以重复使用该类来为单值和多值字段生成构面计数。

The solution provided is based on the BitSet solution provided here: http://sujitpal.blogspot.ie/2007/04/lucene-search-within-search-with.html 提供的解决方案基于此处提供的BitSet解决方案: http : //sujitpal.blogspot.ie/2007/04/lucene-search-within-search-with.html

The blog has a Maven project which demonstrates the solution quite comprehensively. 该博客有一个Maven项目,该项目相当全面地演示了该解决方案。 The project demonstrates using the hibernate-search faceting API to filter on.... 该项目演示了使用hibernate-search faceting API进行过滤。

a date-range AND a 1-to-many (single-value) facet-group AND a many-to-many (multi-value) facet-group combined. 日期范围和一对多(单值)构面组以及多对多(多值)构面组的组合。

The solution is then invoked to correctly derive facet-counts for each facet-group. 然后调用该解决方案以正确导出每个构面组的构面计数。

The solution facilitates results similar to this jsFiddle emulation: http://goo.gl/y5C9UO (except that the emulation does not demo the range faceting). 该解决方案可促进类似于以下jsFiddle仿真的结果: http : //goo.gl/y5C9UO (除了该仿真不会演示范围刻面之外)。

The jsFiddle is part of a larger blog which explores the concept of facet searching in general: http://outbottle.com/understanding-faceted-searching/ . jsFiddle是较大的博客的一部分,该博客总体上探讨了构面搜索的概念: http : //outbottle.com/understanding-faceted-searching/ If you're like me and are finding the whole notion of facet-searching quite confusing then this will help. 如果您像我一样,并且发现整个方面搜索的概念相当混乱,那么这将有所帮助。

It may not be the best solution in the world so feel free to feedback. 它可能不是世界上最好的解决方案,请随时反馈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM