-->
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.  [ 8 posts ] 
Author Message
 Post subject: hierarchical / nested facets?
PostPosted: Fri Sep 23, 2011 6:24 pm 
Beginner
Beginner

Joined: Sun Sep 18, 2011 4:44 pm
Posts: 22
Is it possible to create hierarchical facets like states - cities?
So the first level shows entries grouped by states and below the second level grouped by cities, like a tree structure.

Thanks


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Mon Sep 26, 2011 11:59 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
of course

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Mon Sep 26, 2011 12:42 pm 
Beginner
Beginner

Joined: Sun Sep 18, 2011 4:44 pm
Posts: 22
Well, does the api support this? I don't see it.
Of course I can create two facets and combine them after execution "by hand".
My idea was that a Facet object has a set of sub Facets, already filled when returning from getFacets().


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Mon Sep 26, 2011 2:22 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Well I'm not very practical with that API myself, but these two functional tests aim to mimick the "drill down" menus as found on many web shops:

https://github.com/hibernate/hibernate- ... pTest.java
https://github.com/hibernate/hibernate- ... gTest.java

org.hibernate.search.test.query.facet.FacetFilteringTest
org.hibernate.search.test.query.facet.WebShopTest

hope it helps; If I didn't understand your question could you post an example of what you're needing to do?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Mon Sep 26, 2011 2:43 pm 
Beginner
Beginner

Joined: Sun Sep 18, 2011 4:44 pm
Posts: 22
Thanks for the examples.
However, these have independent, one-level facets (color, size).
In my case I am looking for a hierarchy of facets like cities within a state. The city facet elements depend on the superior state facet element.
Ideally, one would define this structure for the facets and the execution of the query returns the state facets, each with a set of city facets.
But I think hibernate search does not support this currently. So I will implement two independent facets and combine them in my code.


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Tue Sep 27, 2011 6:59 am 
Beginner
Beginner

Joined: Sun Sep 18, 2011 4:44 pm
Posts: 22
Another way to explain what I am looking for is the SQL equivalent: a 'group by' of various columns:
group by state_id, city_id order by state_name, city_name

This seems not to be possible with HS facets. The workaround equivalent in SQL is to execute two selects
group by state_id
group by city_id
and to combine the result in my code, looping over both result sets.


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Tue Sep 27, 2011 8:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

Quote:
However, these have independent, one-level facets (color, size). In my case I am looking for a hierarchy of facets like cities within a state. The city facet elements depend on the superior state facet element.


That the facets are related is really a semantic problem. The question is whether the API allows for calculations for sub facets. It does not matter whether these facets are related or not semantically. The size facet of the example can be treated as a sub-facet of the color facet as well.
That said, there is indeed no API to select a facet and automatically calculate all selected sub facets. You would have to loop through your first facet, call facetManager.getFacetGroup( "myFacetName" ).selectFacets( selectedFacet ) and then inspect the result for the second facet. Very similar to what happens in the test mentioned above, but just in a loop.

Quote:
Ideally, one would define this structure for the facets and the execution of the query returns the state facets, each with a set of city facets.


Do you have any concrete ideas on how the API should look like. We are in the process on extending faceting (see HSEARCH-809 and in the process of collecting requirements. The new approach uses Lucene's native faceting which knows the concept of category path. I think that goes into the direction your want to go. There are several questions around this topic. First of all the new approach requires that you make faceting decisions (configuration) at index time. ATM, faceting uses the standard index information and you can facet on any discrete field without configuring this field for faceting. This need to to change and we probably end up adding a new annotation, for example @FacetPath. But how to do connect two entity properties and create a nested category path via annotations.
The other question is how to extend the FacetManager API to enable sub-faceting.
I am aware that this goes now far beyond your initial question, but I am looking for feedback on improving the current API and all help is welcome :-)

--Hardy


Top
 Profile  
 
 Post subject: Re: hierarchical / nested facets?
PostPosted: Wed Sep 28, 2011 8:02 am 
Beginner
Beginner

Joined: Sun Sep 18, 2011 4:44 pm
Posts: 22
Thanks for the detailed reply.
Currently I am drowned in work, we are just a few days before a production release.
I hope to give it a thought as soon as I can.

Cheers,
Ulrich


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.