lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <>
Subject TermScorer explain
Date Fri, 18 Aug 2006 15:35:52 GMT
Anyone see any reason why I shouldn't make the following commit to  
TermScorer explain per Otis' TODO comment on the method:     * @todo  
Modify to make use of {@link TermDocs#skipTo(int)}.

   public Explanation explain(int doc) throws IOException {
     TermQuery query = (TermQuery)weight.getQuery();
     Explanation tfExplanation = new Explanation();
     int tf = 0;
     while (pointer < pointerMax) {
       if (docs[pointer] == doc)
         tf = freqs[pointer];
     if (tf == 0) {
         if (termDocs.skipTo(doc))
             if (termDocs.doc() == doc)
                 tf = termDocs.freq();

     return tfExplanation;

I have also implemented TestTermScorer and will be committing that  
soon too.  Just came across this while writing up documentation on  
scoring and thought it sounded like a reasonable and easy fix.  I  
know Hoss has done a lot with Explanations, so he may know best if  
there are issues with skipTo and explain.  All tests still pass  
(including the new one for TermScorer (which also passed b4 the  
change).  If I don't hear from anyone by tomorrow I will go ahead  
with it.


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

View raw message