facets in lucene

http://qwcode.blogspot.com/2011/09/facets-in-lucene.html

Sunday, September 11, 2011

facets in lucene

in short, doing "facets" directly in lucene (vs using the native support in something like solr) boils down to performing bitset intersections across lucene filters to get the intersection counts.

 

So, let's say in your app, someone does a search for cars, and you want a hit count breakdown relative to that search like so:

  • Honda (23)
  • Toyota (14)
  • Ford (8)
  • Hyundai (4)

 

You'll need to:

 

  1. contruct a query filter based on the "cars" query.
  2. have cached query filters already setup for Honda, Toyota, Ford, Hyundai. These need to be stored, so you'll need some kind of app server to hold them.
  3. then perform an intersection between each combination to get the counts

a live example is in lupyne in this module. lupyne is an open source python search server that uses pylucene and cherrypy.

你可能感兴趣的:(Lucene)