2
votes

I'm using Lucene to index components with names and types. Some components are more important, thus, get a bigger boost. However, I cannot get my boost to work properly. I sill get some components appear later (get worse score), even though they have a higher boost.

Note that the indexing is done on one field only and I've set the boost to that field alone. I'm using Lucene in Java.

I don't think it has anything to do with the field length. I've seen components with the same name (but different type) get the wrong score.

5
Can you post some code? Both on the indexing side, and the search side. At least what the query looks like.bajafresh4life

5 Answers

2
votes

Use Searcher.explain to find out how the scores for each document are derived. One of the key criteria in score is length of the field. A match in shorter field gets higher score.

1
votes

I suggest you use luke to see exactly what is stored in your index. Are you using document boosting? See the scoring documentation to check possible explanations.

0
votes

Boost is just one factor in the Lucene score for a hit. But it should work. Can you give a more complete example of the behavior you are seeing, and what you would expect?

0
votes

As I recall, boosting is intended to make one field more important than another. If you have only one field, boosting won't change the order of the results at all.

added: no, looks like you can indeed boost specific documents. oops!

0
votes

Make sure field.omitNorms is set to false on the field you want to boost.