You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Andrew Nagy <an...@villanova.edu> on 2007/03/07 16:05:17 UTC
Hierarchical Facets
I am running into a stumbling block and can only find a way to solve the
problem with some sort of hierarchical faceting system. I am in the
process of moving my records from eXist (http://exist.sf.net) to Solr,
but the problem is with the lack of a "directory structure" that exist
has. I figure I could easily solve this problem by setting a field
called "collection" and then faceting on that field to get my list of
"directories" however this will not allow me to do subdirectories.
Any ideas on how to implement such a thing in solr?
Thanks!
Andrew
Re: Hierarchical Facets
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 8, 2007, at 10:52 PM, Chris Hostetter wrote:
> or something like...
>
> <level1>Dir1</level1>
> <level2>Subdir1</level2>
> <level3>SubSubDir1</level3>
>
> ...but this is why Hierarchical facets are hard.
I've not yet tackled hierarchical facets myself despite the demand
being there. It seems there are various ways this could be
implemented, and ironing out the pros/cons of each is necessary.
Using the suggestion above is just like having normal facets, yet the
user interface takes care of making things seem hierarchical. Once
Dir1 becomes a constraint only its level2 subdirs would be returned.
Using a single field to represent hierarchy also would work by using
PrefixQuery's:
<dir>Dir1/Subdir1/SubSubDir1</dir>
Again, the UI would need to display this appropriately, and allow a
user to select levels in the hierarchy and send to Solr "dir:Dir1/*"
and so on.
Certainly Solr can, and likely eventually will, implement some type
of built-in support for hierarchical facets, we can still hack them
in with what we've got I believe.
I like what I see with Flamenco and hierarchical facets: <http://
orange.sims.berkeley.edu/cgi-bin/flamenco.cgi/nobel/Flamenco> - in
this example, Affiliation and Year have levels below them that appear
after the broader selection is made (or you can hover and see the
tool-tip popup too).
Erik
RE: Hierarchical Facets
Posted by Chris Hostetter <ho...@fucit.org>.
: <level1>Dir1</level1>
: <level2>Dir1/Subdir1</level2>
: <level3>Dir1/Subdir1/SubSubDir1</level3>
or something like...
<level1>Dir1</level1>
<level2>Subdir1</level2>
<level3>SubSubDir1</level3>
...but this is why Hierarchical facets are hard.
(it just occured to me that this is a differnet hiearchical facets thread
then the one i thought it was .. you may want to check the arcives for
some other recent discussion on this)
-Hoss
RE: Hierarchical Facets
Posted by "Binkley, Peter" <Pe...@ualberta.ca>.
That would work in the facet query, but it implies using truncation in
the facet.field too, doesn't it? (Assuming you want to group the
higher-level facets like "Dir1" rather than getting all the possible
paths beginning with "Dir1").
I had assumed I'd have to do something like this:
<level1>Dir1</level1>
<level2>Dir1/Subdir1</level2>
<level3>Dir1/Subdir1/SubSubDir1</level3>
Then set up the application to take note of the current level:
Top level: facet.field=level1
Level 1: fq=level1:Dir1&facet.field=level2
Level 2: fq=level2:Dir1/Subdir1&facet.field=level3
And so on. But if I don't need to duplicate the info in multiple fields
like that, I'd be happier.
Peter
-----Original Message-----
From: Chris Hostetter [mailto:hossman_lucene@fucit.org]
Sent: Wednesday, March 07, 2007 10:47 AM
To: solr-user@lucene.apache.org
Subject: Re: Hierarchical Facets
Assuming I'm understanding your question correctly, something like that
would probably work just fine -- just do prefix searches on your
directories when you want to find all files in that directory or any
decendent directory, and use facet counds to see the list of decendent
directories and the number of files under each that match.
: Date: Wed, 07 Mar 2007 10:11:54 -0500
: From: Andrew Nagy <an...@villanova.edu>
: Reply-To: solr-user@lucene.apache.org
: To: Andrew Nagy <an...@villanova.edu>
: Cc: solr-user@lucene.apache.org
: Subject: Re: Hierarchical Facets
:
: Hmm ... I had a brain storm.
:
: Could I do something like this:
: <collection>Dir1/Subdir1/SubSubDir1</collection>
:
: Then query collection:"Dir1/Subdir1" and get the facets on collection
at
: that point to see all of the subsubdirectories?
:
: Is their any better method?
:
: Andrew
:
: Andrew Nagy wrote:
: > I am running into a stumbling block and can only find a way to solve
: > the problem with some sort of hierarchical faceting system. I am in
: > the process of moving my records from eXist (http://exist.sf.net) to
: > Solr, but the problem is with the lack of a "directory structure"
that
: > exist has. I figure I could easily solve this problem by setting a
: > field called "collection" and then faceting on that field to get my
: > list of "directories" however this will not allow me to do
: > subdirectories.
: >
: > Any ideas on how to implement such a thing in solr?
: >
: > Thanks!
: > Andrew
: >
:
-Hoss
Re: Hierarchical Facets
Posted by Chris Hostetter <ho...@fucit.org>.
Assuming I'm understanding your question correctly, something like that
would probably work just fine -- just do prefix searches on your
directories when you want to find all files in that directory or any
decendent directory, and use facet counds to see the list of decendent
directories and the number of files under each that match.
: Date: Wed, 07 Mar 2007 10:11:54 -0500
: From: Andrew Nagy <an...@villanova.edu>
: Reply-To: solr-user@lucene.apache.org
: To: Andrew Nagy <an...@villanova.edu>
: Cc: solr-user@lucene.apache.org
: Subject: Re: Hierarchical Facets
:
: Hmm ... I had a brain storm.
:
: Could I do something like this:
: <collection>Dir1/Subdir1/SubSubDir1</collection>
:
: Then query collection:"Dir1/Subdir1" and get the facets on collection at
: that point to see all of the subsubdirectories?
:
: Is their any better method?
:
: Andrew
:
: Andrew Nagy wrote:
: > I am running into a stumbling block and can only find a way to solve
: > the problem with some sort of hierarchical faceting system. I am in
: > the process of moving my records from eXist (http://exist.sf.net) to
: > Solr, but the problem is with the lack of a "directory structure" that
: > exist has. I figure I could easily solve this problem by setting a
: > field called "collection" and then faceting on that field to get my
: > list of "directories" however this will not allow me to do
: > subdirectories.
: >
: > Any ideas on how to implement such a thing in solr?
: >
: > Thanks!
: > Andrew
: >
:
-Hoss
Re: Hierarchical Facets
Posted by Andrew Nagy <an...@villanova.edu>.
Hmm ... I had a brain storm.
Could I do something like this:
<collection>Dir1/Subdir1/SubSubDir1</collection>
Then query collection:"Dir1/Subdir1" and get the facets on collection at
that point to see all of the subsubdirectories?
Is their any better method?
Andrew
Andrew Nagy wrote:
> I am running into a stumbling block and can only find a way to solve
> the problem with some sort of hierarchical faceting system. I am in
> the process of moving my records from eXist (http://exist.sf.net) to
> Solr, but the problem is with the lack of a "directory structure" that
> exist has. I figure I could easily solve this problem by setting a
> field called "collection" and then faceting on that field to get my
> list of "directories" however this will not allow me to do
> subdirectories.
>
> Any ideas on how to implement such a thing in solr?
>
> Thanks!
> Andrew
>