tags:

views:

2018

answers:

5

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.

A: 

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?

Avi
I also encounter another problem: after removing and adding a document (for updating) it goes down in the list of results. I'll see if I can arrange a simple example.
zvikico
A: 

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!

Jay Kominek
My experience says it does affect the general position. Besides, the doc has a setBoost method (which sets all the fields). What's the point in that when the boost only affects fields?
zvikico
Looks like you're right, its there, and the docs do indeed say it will behave as you describe. I guess it just wasn't something I stumbled across in my previous usage.
Jay Kominek
A: 

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

KenE
Yes, it is, but thanks. Besides, I can see that it has an affect, just not that great.
zvikico
+1  A: 

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.

Yuval F
A: 

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.