[Xapian-discuss] Index-time weight of a document and weight per document field

Maciej Zięba maciej.zieba at stxnext.pl
Wed Feb 25 16:10:56 GMT 2009


Hello :-)

When indexing documents, I would like to influence future search results order. 
I've used the verb "influence", because I don't want to change the ordering 
completely but only to give a "hint" about it.

There are two ways in which I would like to do that:

1. Weight of a document
I would like to be able to say that some documents are more important than the 
other and should therefore end up higher in the results. An example:
- Document A has weight of 2
- Document B has weight of 1
- Document C has weight of 3
- We search for "xyz" and find it in all 3 documents
- The order in which results are given would be: C, A, B

(Of course this is just an example, so I'm disregarding all other things that 
influence relevance, like number of "xyz" occurences, document length, etc.)

2. Weight of a field (per document, not in general)
I would like to be able to say that a given field in a particular document is 
more important than in another. An example:
- Let's say that we have a "keywords" field
- Document A has weight of 1 and it's keywords field has weight of 3
- Document B has weight of 1 and it's keywords field has weight of 1
- Document C has weight of 1 and it's keywords field has weight of 2
- We search for "xyz" and find it in "keywords" fields of all 3 documents
- The order in which results are given would be: A, C, B

I've tried searching myself for information on how to make something like this 
but without success (not giving up yet, though ;-) ). I would be really, 
really grateful for any suggestions how I could achieve something like this 
and/or if it is possible at all.

I guess this can't be done with any existing tool (for example with 
scriptindex) and I would have to write my own indexer (I will try to use 
Python bindings).  Am I right?

Please excuse if my explanations are not clear enough (English is not my 
mother tongue), I'm glad to answer any questions :-)

Best regards,
Maciej



More information about the Xapian-discuss mailing list