开发者

How to score only one field when using multi-field query?

The scen开发者_如何学编程erio is like this: I have to use multi-field query, which indexed several field. When scoring, I want to only consider one field. Say the query is "name='Chris' and age='25'", the final score is calculated according to age only. How can I do this?


It's some time since I last played with Lucene, but I guess you can:

  1. Use BooleanQuery consisting of two queries and set individual boosts on them (see here).
  2. Use CustomScoreQuery (a bit verbose example here).
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜