lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3364) Add score threshold into Scorer.score()
Date Thu, 13 Oct 2011 19:03:12 GMT


Robert Muir commented on LUCENE-3364:

checkout the TermScorer method for an example:
note it overrides score(Collector) too and just passes to Integer.MAX_VALUE for end.
  public boolean score(Collector c, int end, int firstDocID) throws IOException {
    while (doc < end) {                           // for docs in window
      //System.out.println("TS: collect doc=" + doc);
      c.collect(doc);                      // collect score
      if (++pointer >= pointerMax) {
        pointerMax =;  // refill
        if (pointerMax != 0) {
          pointer = 0;
        } else {
          doc = NO_MORE_DOCS;                // set to sentinel value
          return false;
      doc = docs[pointer];
      freq = freqs[pointer];
    return true;

so your scorer and collector can totally work in tandem here...
> Add score threshold into Scorer.score()
> ---------------------------------------
>                 Key: LUCENE-3364
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/query/scoring
>            Reporter: John Wang
> This is an optimization for scoring.
> Given a Scorer.score() implementation, where features are gathered to calculate a score.
> Proposal, add a parameter to score, e.g. score(float threshold)
> This threshold is the minimum score to "beat" to make it to the current PriorityQueue.
This could potential save a great deal of wasted calculation in the cases where recall is
> In our case specifically, some of the features needed to do calculation can be expensive
to obtain, it would be nice to have a place to decide whether or not even fetching these features
are necessary.
> Also, if we know the score would be low, simply threshold can be returned.
> Let me know if this makes sense and I can work on a patch.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message