开发者

Document boosting in Hibernate Search / Lucene

Everything else remaining the same, some o开发者_开发知识库f my objects are more valuable than others.

Is it possible to boost objects at index time, let's say according to the USD price?

Or if you have a limited number of values, I was hoping that this would work:

f:aaa^4 f:bbb^3 f:ccc^2 animal:elephant

but I must be missing something.


What you are saying will work. However, you will probably want to reformat it as (boost query) +(original query), e.g. (f:a^4 f:b^3 b:c^2) +animal:elephant. The way you have it now will find things which only have f:aaa, regardless of animal:elephant.

You can see Lucene in Action for an example of how to write a custom scorer which allows you to do somethign more like boosting according to price. I'm not aware of any way you can do this without writing some code though.


If you are using hibernate-search, you can add boosting directly to fields using annotation. There are two type of boost: dynamic boost which apply to the whole object, or field level boost. You probably want dynamic boost, and can be specified using: @DynamicBoost(impl = VIPBoostStrategy.class)

See http://docs.jboss.org/hibernate/search/3.2/reference/en-US/html/search-mapping.html#section-boost-annotation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜