lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas McGilvray ...@weemondo.com>
Subject Drill down facet for multi valued groups of fields
Date Fri, 02 Oct 2015 16:48:26 GMT
Hi everyone, my first post to the list! I tried and failed to explain this on IRC, I hope I
can do a better job here.   

My document has a group of text fields: company, location, year. The group can have multiple
values and I would like to facet (drill down) beginning with any of the three fields. The
order of the groups is not important.

Example Doc1: 
{company1: Bolts, location1: NY, year1: 2002}
{company2: Nuts,  location2: SF, year2: 2010}

If I select two filters: fq=company:Bolts && fq=location:SF, Doc1 should not be in
the results, because although the two individual values occur in the document, they are not
within the same group.  

Following the instructions for facet.prefix based drill down (the link will explain this far
better than I can)
https://wiki.apache.org/solr/HierarchicalFaceting#A.27facet.prefix.27__Based_Drill_Down
I can create a custom field lets call it cly  which represents a drill-down hierarchy company
> location > year
So For the document above it would contain the following:

0:Bolts
1:Bolts>NY
2:Bolts>NY>2002
0:Nuts
1:Nuts>SF
2:Nuts>SF>2010

I can retrieve the facets for the Company using: facet.field={!key=company facet.prefix=“0:”}cly

If the user selects the company Bolts, I can filter the values using: fq=cly:”0:Bolts”
And I can retrieve the facets for the location using facet.field={!key=location facet.prefix=“1:Bolts”}cly

This is fine if I want to drill down company location year, but what if, after selecting company
I now want to select year? I make a field for each combination of values: cly, cyl, lyc …..

If the user selects Bolts, I can now retrieve the facets for year using facet.field={!key=year
facet.prefix=“1:Bolts”}cyl (NB the order of the letters here)

I hope the above makes sense, even if the idea itself is completely crazy. Obviously the number
of extra fields is factorial. I cant believe I am the first person to want to do this type
of search, which makes me think there is probably another (better) way to do this. Is there?

King Regards and many thanks in advance,
Douglas
Mime
View raw message