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:
- Use
BooleanQuery
consisting of two queries and set individual boosts on them (see here). - Use
CustomScoreQuery
(a bit verbose example here).
精彩评论