[Xapian-discuss] Making Title Fields Have More Weight In Xapian Search

Benny Chan misterchan at gmail.com
Fri Jul 20 23:01:54 BST 2007


Hello,

I currently have about 5000 documents that I am indexing with scriptindex
with the following input file:

document_id: field=ref unique=Q boolean=Q
document_title: field=title weight=3 unhtml index
url: field=url
document_text: field=document_text unhtml index
abstract: field=abstract
category: field=category boolean=XC

This is working fine however the document results are not showing up with
the most relevant titles ranked highest. For example, if I search for the
term "trash can," I might get results like this:

1. How trash is stored
2. Talking trash can make you trash
3. Stories about cats

where the first result is obviously most relevant based on the text of the
document. However, I want to base my results more on the title of the
document, giving that more weight. When that happens, result #2 should
really become result #1 because it contains both words. So I tried changing
the line:

document_title: field=title weight=3 unhtml index

to

document_title: field=title weight=100 unhtml index

After re-indexing all the documents I tried such a search again and the
results were nearly identical. I'm not sure if I'm making the right
adjustments or if I'm missing some other adjustments to get the results I
want. If anyone has any ideas on how to increase the weight on the title,
I'd really appreciate the help. Thanks all.

Benny


More information about the Xapian-discuss mailing list