I got a bit of a surprise trying to re-implement the ConjunctionScorer. It turns out that skipTo(0) does not always return the same thing as next() on a newly created scorer. Some scorers give invalid results if skipTo() is called before next().
The javddoc is unclear on the subject, but the javadoc for both score() and skipTo() suggest that calling skipTo() first is valid, and that seems to make more sense. Thoughts? /** Returns the current document number matching the query. * Initially invalid, until [EMAIL PROTECTED] #next()} is called the first time. */ public abstract int doc(); /** Returns the score of the current document matching the query. * Initially invalid, until [EMAIL PROTECTED] #next()} or [EMAIL PROTECTED] #skipTo(int)} * is called the first time. */ public abstract float score() throws IOException; /** Skips to the first match beyond the current whose document number is * greater than or equal to a given target. * <br>When this method is used the [EMAIL PROTECTED] #explain(int)} method should not be used. * @param target The target document number. * @return true iff there is such a match. * <p>Behaves as if written: <pre> * boolean skipTo(int target) { * do { * if (!next()) * return false; * } while (target > doc()); * return true; * } * </pre>Most implementations are considerably more efficient than that. */ public abstract boolean skipTo(int target) throws IOException; -Yonik http://incubator.apache.org/solr Solr, the open-source Lucene search server --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]