开发者

Lucene.NET Boost for different type of entity

I am new to Lucene.NET and have already run into a (I think) difficult problem. I have an object lets say a "Company", now there are 3 different types of companies ordered by impo开发者_运维问答rtance from low to high.

If I query for a search term I would like to give a "boost" factor to companies which have a high importance for example (pseudo code):

[Boost("If Importance is = 1 then 1, If Importance is 2 then 2, If Importance is 3 then 3")] public int Importance {get;set;}

Hopefully you know what I mean, thanks!


Try storing importance as a field, and sorting your search results by that field.

Section 5.2.4 in Lucene In Action covers this.

You could also try looking into Function Queries (section 5.7)


2 separate problems here. If you need to split companies so you have "paid" links a-la the first few things you see when using google, you need to have a separate field and pull those guys out separately.

To pass in boost, just pass in the setting where you are indexing using the Document.SetBoost() method. If you can post some code, we can probably get a better answer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜