You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by eks dev <ek...@yahoo.co.uk> on 2008/01/24 16:48:43 UTC

ConjuctionScorer bug?

this code snippet in ConjuctionScorer does not do what the comment describes, or I have problems understanding it?

    // If first-time skip distance is any predictor of
    // scorer sparseness, then we should always try to skip first on
    // those scorers.
    // Keep last scorer in it's last place (it will be the first
    // to be skipped on), but reverse all of the others so that
    // they will be skipped on in order of original high skip.
    int end=(scorers.length-1)-1;
    for (int i=0; i<(end>>1); i++) {
      Scorer tmp = scorers[i];
      scorers[i] = scorers[end-i];
      scorers[end-i] = tmp;
    }




It has not been detected so far as it has only performance implications (I think?), and it sometimes works and sometimes not, depending on number of scorers:

to see what I am talking about, try this "simulator":

  public static void main(String[] args) {
    int[] scorers = new int[7]; //3 and 7 do not work
    
    for (int i=0; i<scorers.length; i++) {
      scorers[i]=i;
    }
    
    System.out.println(Arrays.toString(scorers));
    
    
    int end=(scorers.length-1)-1;
    for (int i=0; i<(end>>1); i++) {
      int tmp = scorers[i];
      scorers[i] = scorers[end-i];
      scorers[end-i] = tmp;
    }

    System.out.println(Arrays.toString(scorers));

  }

for 7 you get:
[0, 1, 2, 3, 4, 5, 6]
[5, 4, 2, 3, 1, 0, 6]

instead of [5, 4, 3, 2, 1, 0, 6]

and for 3 
[0, 1, 2]
[0, 1, 2] (should be [1, 0, 2])







      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 


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