Returning Facets that match a search

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Returning Facets that match a search

rpsandiford
This post has NOT been accepted by the mailing list yet.
Hi,

I have a scenario where I want to return only facets whose values match a search.

Example:

Suppose I have an indexed record, with a 'AUTHOR' field, that I use for getting facets.  I want to be able to do an AUTHOR search for "tom AND clancy" (and a fuzzy match on the same terms) to determine the documents with "tom clancy" (or close variation from the fuzzy match) as an Author, and then return only the Facet values that ALSO match "tom AND clancy".  I.E. if a single hit has two values for AUTHOR, "Clancy, Tom" and "Clancy, Joe", then I only want the "Clancy, Tom" returned.

I've looked at both Facet Filter (which only reduces documents used for computing results, not reducing WHICH facets from the document set are returned), and Filter Facets (which allows counts of hits matching the filter) - neither actually allows the set of Facets returned with a Query to be restricted.

I can't do this manually after the fact because we would have to take into account the analyzer behaviour, as well as doing our own fuzzy matching.

Any ideas?

(We are currently using Solr, and handled this by customizing the Solr faceting logic.  If there's no way to handle this through the API, then where would be a good place to start poking in the ElasticSearch code?)

Thanks!

Bob.
Bob.