Lucene.NET Boost for different type of entity

267 views Asked by At

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 importance 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!

2

There are 2 answers

0
Brian Vander Plaats On BEST ANSWER

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)

0
Wyatt Barnett On

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.