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 Christian Reuschling <re...@dfki.uni-kl.de> on 2014/08/07 18:42:17 UTC
BooleanWeight.scorer() gives a TermScorer
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I try to get the scorer for a result document, for further computation.
List<AtomicReaderContext> leafContexts = indexReader.leaves();
int n = ReaderUtil.subIndex(scoreDoc.doc, leafContexts);
AtomicReaderContext ctx = leafContexts.get(n);
Scorer scorer = weight.scorer(ctx, ctx.reader().getLiveDocs());
in most cases, the type of the scorer is DisjunctionSumScorer. But for one result document, the
type of scorer is surprisingly a TermScorer.
the weight object is in any case the same - the only different thing is the scoreDoc.doc doc
number. It seems that it is the result doc with the smallest doc number, all other result
documents are from a different subIndex (n).
For DisjunctionSumScorer, my code works just fine. What is the reason that a BooleanWeight can
return a TermScorer? And can I force the weight to do not?
best regards
Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlPjrGkACgkQ6EqMXq+WZg/d/ACgilM3iLefG5LQzVXX9bv6xIV7
4asAoLWg4yIaaJa/VLoRU7QjS6Vaqnn2
=I3ZD
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: BooleanWeight.scorer() gives a TermScorer
Posted by Robert Muir <rc...@gmail.com>.
This can happen in some cases: for example if you are doing a
disjunction of "foo" and "bar" with coordination factor disabled, and
the segment has no postings for "bar".
In this case the optimum scorer to return is just a termscorer for "foo".
On Thu, Aug 7, 2014 at 12:42 PM, Christian Reuschling
<re...@dfki.uni-kl.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> I try to get the scorer for a result document, for further computation.
>
> List<AtomicReaderContext> leafContexts = indexReader.leaves();
> int n = ReaderUtil.subIndex(scoreDoc.doc, leafContexts);
> AtomicReaderContext ctx = leafContexts.get(n);
> Scorer scorer = weight.scorer(ctx, ctx.reader().getLiveDocs());
>
> in most cases, the type of the scorer is DisjunctionSumScorer. But for one result document, the
> type of scorer is surprisingly a TermScorer.
>
> the weight object is in any case the same - the only different thing is the scoreDoc.doc doc
> number. It seems that it is the result doc with the smallest doc number, all other result
> documents are from a different subIndex (n).
>
> For DisjunctionSumScorer, my code works just fine. What is the reason that a BooleanWeight can
> return a TermScorer? And can I force the weight to do not?
>
> best regards
>
> Christian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.19 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAlPjrGkACgkQ6EqMXq+WZg/d/ACgilM3iLefG5LQzVXX9bv6xIV7
> 4asAoLWg4yIaaJa/VLoRU7QjS6Vaqnn2
> =I3ZD
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org