Thanks Hoss,

I was mainly looking for an explanation of such an answer only coz in the forum 
there were such replies posted for Hierarchical faceting.
I'll try out the method.

Thanks.
Sachit


-----Original Message-----
From: Chris Hostetter [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 26, 2008 11:43 PM
To: solr-user@lucene.apache.org
Subject: Re: Hierarchical Faceting


: Suppose, I have 3 categories like politics, science and sports. In the
: schema, I am defining a field type called 'Category'. I don't have a sub
: category field type (and don't want to have one). Now, Cricket and
: Football are some categories which can be considered to be under sports.
: When I search for something and if it is present in the 'sports'
: category, then it should show me the facets of cricket and football too.

: My question is: Do I need to specify cricket, football also as
: categories or sub categories of sports (for which I don't want to make a
: separate field)? And if I make these as categories only, then how will I
: achieve the drilling down of the data to cricket or football.

there are lots of solutions to problems like this, but picking the best
one tends to depend on what exactly you wnat the search experience to be
like.  based on your description of your problem, an approach where you
index all of the "ancestor breadcrumbs" for hte categories a document is
in along with the "depth" of each ancestor in the tree, and then facet on
those with a prefix restriction would probably work well. ie:

 docA:  cat = sport/cricket
 docB:  cat = sport/shateboarding
 docC:  cat = sport/skateboarding/vert
 docD:  cat = sport/skateboarding/street
 docE:  cat = finance
tokens indexed....

 docA:  cat = 0/sport, 1/sport/cricket
 docB:  cat = 0/sport, 1/sport/shateboarding
 docC:  cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/vert
 docD:  cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/street
 docE:  cat = 0/finance

so now your first request you use something like...
   q=foobar&facet=true&facet.field=cat&f.cat.facet.prefix=0/
..and you'll get facet counds for sport and finance.  if they pick "sport"
your next request is something like...
q=foobarfq=cat:0/sport&facet=true&facet.field=cat&f.cat.facet.prefix=1/sport/
...and you'll get facet counds for all the subcats of sport ... etc.


-Hoss


This message (including attachment if any) is confidential and may be 
privileged. If you have received this message by mistake please notify the 
sender by return e-mail and delete this message from your system. Any 
unauthorized use or dissemination of this message in whole or in part is 
strictly prohibited. E-mail may contain viruses. Before opening attachments 
please check them for viruses and defects. While MindTree Limited (MindTree) 
has put in place checks to minimize the risks, MindTree will not be responsible 
for any viruses or defects or any forwarded attachments emanating either from 
within MindTree or outside.

Please note that e-mails are susceptible to change and MindTree shall not be 
liable for any improper, untimely or incomplete transmission.

MindTree reserves the right to monitor and review the content of all messages 
sent to or from MindTree e-mail address. Messages sent to or from this e-mail 
address may be stored on the MindTree e-mail system or else where.

Reply via email to