Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform a faceted search?

I'd like to know how to perform a faceted search using lucene.facet. I'll explain exactly what I want to do: I've got a taxonomy of htmlfiles (similar to ODP) and I want that, given a query, display results by categories and number of hits per category. Is there any example describing that with lucene?

Edit: I already get results as categories by adding a category field in each document. What i want is that results appear as:

Cat1 N1
Cat2 N2
  ...

Instead of:

Cat1
Cat1
...    xN1 times
Cat1
Cat2
...    xN2 times
Cat2
...

Also, this category field only refers to a level of the taxonomy tree and I want to exploit the taxonomy structure by, for example, being able to select the depth of the search in the taxonomy (I don't know if this is clear..).

Thank you!

like image 951
synack Avatar asked May 21 '12 15:05

synack


1 Answers

Since solr and lucene are merged together since 3.0 anyway, I would strongly recommend to use solr instead of plain lucene to do facetted search.

You do not have to use the whole solr with a http server.

Try an EmbeddedSolrServer

like image 118
Roman K Avatar answered Oct 02 '22 08:10

Roman K