You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Karthik N S <ka...@controlnet.co.in> on 2004/08/04 08:50:46 UTC

Hit & Score [ Between ]

Hi 

Apologies....

If I want to get all the  hits for Scores  between  0.5f  to 0.8f, 
I usally use
query = QueryParser.parse(srchkey,Fields, analyzer);
int tothits = searcher.search(query);

for (int i = 0; i<tothits ; i++) {
        docs = hits.doc(i);
        Score = hits.score(i);
         
        if ((Score > 0.5f ) && (Score < 0.8f) ) {
            System.out.println(" FileName  : " + docs.get("filename");
        }
}

Is there any other way to Do this ,
Please Advise me..........

Thx.

        
      WITH WARM REGARDS 
      HAVE A NICE DAY 
      [ N.S.KARTHIK] 
     



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Hit & Score [ Between ]

Posted by Doug Cutting <cu...@apache.org>.
You could instead use a HitCollector to gather only documents with 
scores in that range.

Doug

Karthik N S wrote:
> Hi 
> 
> Apologies....
> 
> If I want to get all the  hits for Scores  between  0.5f  to 0.8f, 
> I usally use
> query = QueryParser.parse(srchkey,Fields, analyzer);
> int tothits = searcher.search(query);
> 
> for (int i = 0; i<tothits ; i++) {
>         docs = hits.doc(i);
>         Score = hits.score(i);
>          
>         if ((Score > 0.5f ) && (Score < 0.8f) ) {
>             System.out.println(" FileName  : " + docs.get("filename");
>         }
> }
> 
> Is there any other way to Do this ,
> Please Advise me..........
> 
> Thx.
> 
>         
>       WITH WARM REGARDS 
>       HAVE A NICE DAY 
>       [ N.S.KARTHIK] 
>      
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org