-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Multiple facet values per document
PostPosted: Sat Apr 14, 2012 9:58 pm 
Newbie

Joined: Tue Oct 09, 2007 10:48 pm
Posts: 11
Hi,

I'm running into a problem which I'm not sure is configuration-related or a Hibernate Search limitation.

We have Hibernate Search working well, and are successfully faceting on a number of fields. However, our application is not correctly returning facet values for when there are multiple values for the same facet for a document.

For the following (simplified) domain object:
Code:
@Entity
@Indexed(index = "Item")
public class PhysicalItem extends AbstractMaterialItem implements Serializable {
   @Embedded
   @IndexedEmbedded
   @Field(name = "preservation_facet", index = Index.UN_TOKENIZED)
   @FieldBridge(impl = PreservationBridge.class)
   private Preservation preservation;
}


and the following bridge (again, simplified for example's sake):
Code:
public class PreservationBridge implements FieldBridge {

   @Override
   public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
      luceneOptions.addFieldToDocument(name, "test1", document);
      luceneOptions.addFieldToDocument(name, "test2", document);
   }
}


Ten PhysicalItems are committed. When querying the Lucene index through Hibernate search, we get the following for the facet values:

  • test1 - 2 values
  • test2 - 8 values

I would have expected to see 10 values for both. This almost suggests that Hibernate Search isn't correctly dealing with multiple facet values of the same type for a document. I can confirm through Luke that all ten documents match for both preservation_facet:test1 and preservation_facet:test2.

If it's of any relevance, we're building the faceting request via the following code snippet:

Code:
QueryBuilder builder = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(PhysicalItem.class).get();
FacetingRequest facetingRequest = builder.facet().name("Preservation").onField("preservation_facet").discrete().includeZeroCounts(false).maxFacetCount(20).createFacetingRequest();


We're using Hibernate Search 3.4.0.Final (this is because we're using Hibernate Tools in our project which still doesn't support Hibernate 4.x, so we're kinda stuck at the moment unless we run two versions of Hibernate in parallel).

What am I missing?

Thanks,
Matt


Top
 Profile  
 
 Post subject: Re: Multiple facet values per document
PostPosted: Mon Apr 16, 2012 3:04 am 
Newbie

Joined: Wed Sep 21, 2011 2:20 pm
Posts: 16
this is a limitation on HS implementation of facetting. see: viewtopic.php?f=9&t=1010472


Top
 Profile  
 
 Post subject: Re: Multiple facet values per document
PostPosted: Mon Apr 16, 2012 4:51 am 
Newbie

Joined: Tue Oct 09, 2007 10:48 pm
Posts: 11
qwertz12345 wrote:
this is a limitation on HS implementation of facetting. see: viewtopic.php?f=9&t=1010472

Thank you so much for that thread; certainly very useful information to proceed (and I'm glad it's not just something dumb on my side!). I'm both surprised and puzzled how this issue isn't viewed as a bug nor high priority (for faceting at least), but there you go...

May be time to investigate circumventing Hibernate Search for faceting and adopt more drastic measures, if this issue actually isn't resolved (it's hard to tell how related HSEARCH-726 (open) and HSEARCH-776 (closed) are)

Regards,
Matt


Top
 Profile  
 
 Post subject: Re: Multiple facet values per document
PostPosted: Tue Apr 17, 2012 3:52 am 
Newbie

Joined: Wed Sep 21, 2011 2:20 pm
Posts: 16
actually I really like HS and I am using it for years now. But I think the facetting solution is not usable for most real words usecases. I am still using bobobrowse for facetting. I would be glad, if could switch to HS for this. But facetting is essential in our application and the HS solution is (unfortunately) to limited for us.


Top
 Profile  
 
 Post subject: Re: Multiple facet values per document
PostPosted: Tue Apr 17, 2012 7:39 pm 
Newbie

Joined: Tue Oct 09, 2007 10:48 pm
Posts: 11
qwertz12345 wrote:
actually I really like HS and I am using it for years now. But I think the facetting solution is not usable for most real words usecases. I am still using bobobrowse for facetting. I would be glad, if could switch to HS for this. But facetting is essential in our application and the HS solution is (unfortunately) to limited for us.

Likewise. Out of interest, I tried interacting directly with Lucene's faceting, however it appears to require data to be indexed differently - and as soon as one naively tries to do that, one - quite understandably - runs into transaction issues with Hibernate Search.

Lose/lose situation until Hibernate Search is upgraded, I fear.


Top
 Profile  
 
 Post subject: Re: Multiple facet values per document
PostPosted: Wed May 16, 2012 2:57 pm 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
We also use Bobo Browse and Hibernate Search. Out of curiosity, did anyone ever manage to integrate the two for near real time scenario's?
I'm stuck with reloading the BoboIndexReader periodically which is not efficient. Any suggestions on this?

Kind regards,
Marc


Top
 Profile  
 
 Post subject: Re: Multiple facet values per document
PostPosted: Wed Nov 20, 2013 3:04 pm 
Newbie

Joined: Tue Sep 17, 2013 12:46 pm
Posts: 5
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://jsfiddle.net/jralston/EeW97/embedded/result/ (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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.