lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ype Kingma <>
Subject Re: Scoring documents by Click Count
Date Thu, 06 May 2004 22:23:03 GMT
On Thursday 06 May 2004 23:26, Boris Goldowsky wrote:
> On Thu, 2004-05-06 at 13:58, Ype Kingma wrote:
> > Changing the click count this way is ok, but along with that you could
> > change the (field) norm for the document to increase it's score
> > in subsequent queries.
> > You can use Document.setBoost() and/or Field.setBoost() just before
> > IndexWriter.addDocument() to do this.
> There may be workable ways to do this, but the one time I tried
> adjusting boosts of already-indexed documents I found it didn't work
> quite as I expected.  The documentation has a warning which explains
> why:
> getBoost
>         Returns the boost factor for hits on any field of this document.
>         [...]
>         Note: This value is not stored directly with the document in the
>         index. Documents returned from IndexReader.document(int) and
>         Hits.doc(int) may thus not have the same value present as when
>         this document was indexed.
> So be cautious and test carefully if you try this -- and let us on the
> list know how it goes!

Then use Field.setBoost() only. Note that this is stored with only
3 bits precision in the index. So when you know which field is queried for
your scores, multiply the previous value with at least with 9/8 to be
sure to increase the score. Or use the score of the next higher
scoring doc as a baseline.

That may not be enough. I seem to recall that the inverse square root
of the boost is stored as the norm, so you may have to multiply
with at least 91/64 to see a guaranteed difference in the score.

At the moment I have no time left to check the details. Please have a look at
the default Similarity implementation for more.

Good night,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message