浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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.

posted on 2011-12-18 12:40  lexus  阅读(247)  评论(0)    收藏  举报