Boosting Lucene Terms When Building the Index

前端 未结 1 950
眼角桃花
眼角桃花 2020-12-11 05:23

Is it possible to determine that specific terms are more important then other when creating the index (not when querying it) ?

Consider for example a synonym filter:

相关标签:
1条回答
  • 2020-12-11 06:06

    Setting boost on a filed affects all terms in that field so this wouldn't work in your case.

    But it should be posible using Lucene payloads (a byte array that can be set for every term). You would use them to set term specific boosts (vehicle to 0.5 for doc 1, for example). Then you'll implement your own Similarity and override scorePayload() method to decode that boost and then use PayloadTermQuery which allows you to contribute to the score based on the boots you have in the payload for that term.

    0 讨论(0)
提交回复
热议问题