When faced with this type of situation where the data is entirely
available at index-time, simply create an aggregated field that glues
the two pieces together, and facet on that.
Erik
On Jan 29, 2010, at 6:16 AM, Peter S wrote:
Hi,
I was wondering if anyone had come across this use case, and if this
type of faceting is possible:
The requirement is to build a query such that an aggregated facet
count of common (and'ed) field values form the basis of each
returned facet count.
For example:
Let's say I have a number of documents in an index with, among
others, the fields 'host' and 'user':
Doc1 host:machine_1 user:user_1
Doc2 host:machine_1 user:user_2
Doc3 host:machine_1 user:user_1
Doc3 host:machine_1 user:user_1
Doc4 host:machine_2 user:user_1
Doc5 host:machine_2 user:user_1
Doc6 host:machine_2 user:user_4
Doc7 host:machine_1 user:user_4
Is it possible to get facets back that would give the count of
documents that have common host AND user values (preferably ordered
- i.e. host then user for this example, so as not to create a
factorial explosion)? Note that the caller wouldn't know what
machine and user values exist, only the field names.
I've tried using facet queries in various ways to see if they could
work for this, but I believe facet queries work on a different plane
than this requirement (narrowing the term count, a.o.t. aggregating).
For the example above, the desired result would be:
machine_1/user_1 (3)
machine_1/user_2 (1)
machine_1/user_4 (1)
machine_2/user_1 (2)
machine_2/user_4 (1)
Has anyone had a need for this type of faceting and found a way to
achieve it?
Many thanks,
Peter
_________________________________________________________________
We want to hear all your funny, exciting and crazy Hotmail stories.
Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/