[Xapian-discuss] Strange Weighting issue

John Wards jwards at whiteoctober.co.uk
Tue Sep 8 13:45:07 BST 2009


Hello,

Our client has asked us for the ability to boost documents on a
document type basis. So we have a scale or 1-5 for the client to pick
from and in the background we had a sort of logarithmic scale between
1 and 100.

I am seeing very strange results however.

I have about 450 documents, I have set all of them to a weight of 1 like so:

$indexer->index_text($this->getTitle(), 1);
$indexer->index_text($this->getDescription(), 1);
$indexer->index_text($contenttext, 1);

One document I set to a weight of 100 like so:

$indexer->index_text($this->getTitle(), 100);
$indexer->index_text($this->getDescription(), 100);
$indexer->index_text($contenttext, 100);

If I search using the two words that is in the title of the document
with a weight of 100, the document with the 100 weight returns last.

If I re-index every document with a weight of 0 and leave the other
document as a weight of 100 it appears as the top document.

If I re-index every document leaving the weight to default and leave
the other document as 100 the 100 document appears at the bottom.

If I re-index every document with a weight of 1000 and leave the other
document as a weight of 100 it appears as the second top document!

I do a reindex with everything as 10000 and the 100 document as 10 the
100 document returns in position 3.

As a base line I have reindexed with no weighting on any document and
the document I am trying to give a boost to appears on page 2
(position 11 or rank 10 in xapian speak).

Am I doing the weighting wrong? I am really confused about this.

Thanks
John



More information about the Xapian-discuss mailing list