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 Yonik Seeley <ys...@gmail.com> on 2005/04/12 23:41:55 UTC

zero boost / zero score

It seems like different search methods treat zero scoring docs a
little differently.  Is this OK?

Some search methods on IndexSearcher check for score > 0.0f :
    scorer.score(new HitCollector() {
        public final void collect(int doc, float score) {
          if (score > 0.0f &&			  // ignore zeroed buckets

The search method that accepts a HitCollector doesn't check for a score of 0.
I wrote a test program and got a surprising result... instead of
getting a score of 0, I got a score of NaN.  Now the NaN is passed to
the HitCollector, but excluded from the other search methods (since
NaN > 0.0f is false.... only NaN != 0.0f would be true).  Is this
intended/OK?

Test Program Output:
Query=a:aaa^0.0
number of hits = 0
Found doc 0 with score NaN

Test Program: attached.

-Yonik


Re: zero boost / zero score

Posted by Paul Elschot <pa...@xs4all.nl>.
On Tuesday 12 April 2005 23:41, Yonik Seeley wrote:
> It seems like different search methods treat zero scoring docs a
> little differently.  Is this OK?
> 
> Some search methods on IndexSearcher check for score > 0.0f :
>     scorer.score(new HitCollector() {
>         public final void collect(int doc, float score) {
>           if (score > 0.0f &&			  // ignore zeroed buckets
> 
> The search method that accepts a HitCollector doesn't check for a score of 
0.
> I wrote a test program and got a surprising result... instead of
> getting a score of 0, I got a score of NaN.  Now the NaN is passed to
> the HitCollector, but excluded from the other search methods (since
> NaN > 0.0f is false.... only NaN != 0.0f would be true).  Is this
> intended/OK?

The NaN is from the division by the zero to normalize the score
for the query weights, so this is a feature.

I think for a document to be counted in the result of a query should only
depend on next(), skipTo()  and doc() of the scorer, and not on score().
However, other external code already depends on this code in IndexSearcher,
so I'm using another IndexSearcher that does not use the score.

Regards,
Paul Elschot.


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