facets in lucene

本文介绍如何在Lucene中直接实现Facets功能,即通过Lucene过滤器执行位集交集操作来获取交集计数。例如,在应用中进行汽车搜索后,可以得到按搜索结果分类的车辆品牌数量,如:Honda(23)、Toyota(14)、Ford(8)、Hyundai(4)。具体实现包括构建基于搜索查询的过滤器、预先设置缓存的查询过滤器以及执行组合交集操作。

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值