Add faceting over multivalued to application using Hibernate Search

ⅰ亾dé卋堺 提交于 2019-12-11 19:13:48

问题


we use Hibernate Search in our application. 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.

I can currently think of a couple two solutions:

  • use bobo-browse (http://code.google.com/p/bobo-browse/)
  • 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). 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). 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. 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?


回答1:


As a Hibernate Search developer, I'd suggest to join us and help implement what you need.

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. 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.

I guess we could do the same with 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.

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




回答2:


I also use Bobo Browse in combination with 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.

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. https://linkedin.jira.com/browse/BOBO-31 describes this issue.

The Hibernate Search infrastructure should provide enough flexibility to integrate. 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




回答3:


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/

The blog is complete with a Java Class that can be reused to generate facet-counts for single-value and multi-value fields.

The solution provided is based on the BitSet solution provided here: http://sujitpal.blogspot.ie/2007/04/lucene-search-within-search-with.html

The blog has a Maven project which demonstrates the solution quite comprehensively. The project demonstrates using the hibernate-search faceting API to filter on....

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).

The jsFiddle is part of a larger blog which explores the concept of facet searching in general: 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.



来源:https://stackoverflow.com/questions/12674316/add-faceting-over-multivalued-to-application-using-hibernate-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!