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