lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Najib <>
Subject Re: not the length that matters, but the content
Date Sat, 02 May 2009 10:31:49 GMT
I think one way to realize it is to run a phrase query.In your example for example:
if you run phrasequery with " the quick brown  fox" you will only have maches like "*"+"the
quickbrown fox"+"*",the * is any other string. that's mean a doc will be considered as a match
only  if the doc contans a field that contains the whole query  as a substring.
when you instantiate the Query Object you should do somthing like this:
QueryParser parser = new QueryParser("contents",analyser);
Query query =parser.parse('"'+queryString+'"');

if the machtes are still not precise enough for you, you have to do it with the similarity
score , for example:
if the score similarity between " the quick brown  fox" and doc1 is: 2.5654
 and between " the quick brown  fox" and doc2 : 7.8982 you should take only the matches with
higher score, it's just an idea.
best regards.
Original Message:

I want documents which have more number of query term matches to be
<br />returned, not the one with less number of terms to matter.
<br />that is, if I submit the query " the quickbrown fox" have two
<br />documents doc1: brown fox
<br />doc2: the quick brown fox jumps over the lazzy dog.
<br />I want the search result be doc2 .
<br />How can I do so.
<br />peice of code will be helpfull
<br />
<br />
<br />Thanks a lot
<br />
<br />Seid M
<br />-- 
<br />
<br />---------------------------------------------------------------------
<br />To unsubscribe, e-mail:
<br />For additional commands, e-mail:
<br />
<br />


View raw message