You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Koji Sekiguchi (JIRA)" <ji...@apache.org> on 2010/10/05 02:43:33 UTC

[jira] Updated: (LUCENE-2686) DisjunctionSumScorer should not call .score on sub scorers until consumer calls .score

     [ https://issues.apache.org/jira/browse/LUCENE-2686?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Koji Sekiguchi updated LUCENE-2686:
-----------------------------------

    Attachment: Test2LUCENE2590.java

Thanks Mike for opening this!

The attached program is what I want to do - I'd like to know which field a match occurred. TestSubScorerFreqs of LUCENE-2590 calls BooleanScorer2.freq() and it returns expected freq count. In my program, I get TermScorer from BooleanScorer2 via ScorerVisitor and try to call TermScorer.freq() in collect() method:

{code}
public void collect(int doc) throws IOException {
  int freq = 0;
  for( TermQueryScorer tqs : tqsSet ){
    Scorer scorer = tqs.scorer;
    int matchId = scorer.docID();    // matchId isn't expected
    if( matchId == doc ){
      freq += scorer.freq();              // this line is never executed
    }
  }
  docCounts.put(doc + docBase, freq);
  collector.collect(doc);
}
{code}

but TermScorer.docID() returns unexpected id and TermScorer.freq() isn't executed (even if I remove "matchId == doc" condition, TermScorer.freq() returns unexpected number anyway).

> DisjunctionSumScorer should not call .score on sub scorers until consumer calls .score
> --------------------------------------------------------------------------------------
>
>                 Key: LUCENE-2686
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2686
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: Test2LUCENE2590.java
>
>
> Spinoff from java-user thread "question about Scorer.freq()" from Koji...
> BooleanScorer2 uses DisjunctionSumScorer to score only-SHOULD-clause boolean queries.
> But, this scorer does too much work for collectors that never call .score, because it scores while it's matching.  It should only call .score on the subs when the caller calls its .score.
> This also has the side effect of messing up advanced collectors that gather the freq() of the subs (using LUCENE-2590).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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