2011/3/14 Hardy Ferentschik <hibernate(a)ferentschik.de>:
Thanks, great feedback as always.
> the filtering idea is looking great.
> I'm wondering how this affects performance, but I guess we can focus
> on API and feature for now.
Right. I am most interested in getting the API right atm.
Do you think that filtering has a worse performance than executing a new
query? Obviously we can wrap the FacetFilters in CachingWrapperFilter.
No I assume that filtering should be better, but I wonder if we can
skip both filtering and querying, it seems you already have collected
all what is needed. But I agree it's not a concern at this point, just
making notes for when we'll have time to explore this - if there's any
need.
One thing I am still not sure about is my use of NumericRangeFilter for
the numeric range facets. This requires that the faceted field is actually
a @NumericField. Given the performance benefits of a numeric field, it just
makes sense to use in your mapping, but should we cater for other cases as
well?
I'd say this is fine. There are corner cases in which people want to
avoid NumericField,
but they are very rare and I guess the cases in which this coincides
with a range faceting need should be even less.
> I'm a bit concerned on the result type of a faceting query, it seems
> that even your own tests need a three-liner helper method to get to
> the value you actually need.
> What about trying to improve that, like from the current form:
> List<Facet> facetList = query.getFacetResults().get( facetName
> ).getFacets();
> shorter:
> List<Facet> facetList = query.getFacets( facetName );
> WDYT?
You are right. FacetResult does not contain much information. Once could
even
think about pushing the field name into Facet (even though it would be
duplicated
then in each Facet).
I guess it comes at a cost of a pointer, quite cheap.
What you are loosing by query.getFacets( facetName ) is the ability to
iterate over the
enabled facets. At the very least you have to take care yourself of which
facet names are set.
In intermediate step would be to get rid of FacetResult, but keep returning
a Map.
So instead of Map<String, FacetResult> we have a Map<String,
List<Facet>>.
Or we go query.getFacets( facetName ), but also add a
query.getEnabledFacetNames()
In which case you do iterate per facets? I couldn't find examples, but
your mid-in suggestions seems fine.
Sanne
--Hardy