Hi,

        You can use something like:

(title:miracle title:cure title:for title:cancer)^5.0 +((+title:miracle 
+title:cure +title:for +title:cancer) (+content:miracle +content:cure 
+content:for +content:cancer))

        Should do the work.

        Regards,

                Gustavo

-----Mensaje original-----
De: Chun Wei Ho [mailto:[EMAIL PROTECTED] 
Enviado el: miƩrcoles, 21 de junio de 2006 16:49
Para: java-user@lucene.apache.org
Asunto: Giving weight to partial matches

I am performing searches on an index that includes a title field and a content 
field, and return results only if either title or content matches ALL the words 
searched. So searching for "miracle cure for cancer" might yield:

(+title:miracle +title:cure +title:for +title:cancer)^5.0 (+content:miracle 
+content:cure +content:for +content:cancer)

What I like to do now is to give additional weight to a result if the title 
field contains some of the words being search, for example the
document:

Title: Miracle Cure
Content: A miracle cure for cancer has been found!

would have higher weight/score because the title contains words that were 
searched for (although not fully matched), even tho the content field is the 
one that results in the match.

I've seen a few discussions on weighting on the list but they all seem to 
revolve around FunctionQuery from Solr. My current application does not use 
Solr and is based on Lucene 1.9.

Any suggestions would be great :)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to