lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gustavo Comba" <>
Subject RE: Giving weight to partial matches
Date Wed, 21 Jun 2006 14:59:22 GMT

	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.



-----Mensaje original-----
De: Chun Wei Ho [] 
Enviado el: miƩrcoles, 21 de junio de 2006 16:49
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

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:
For additional commands, e-mail:

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

View raw message