Index: build.xml =================================================================== RCS file: /home/cvspublic/jakarta-lucene/build.xml,v retrieving revision 1.65 diff -u -r1.65 build.xml --- build.xml 1 Jul 2004 17:40:41 -0000 1.65 +++ build.xml 28 Jul 2004 09:28:41 -0000 @@ -341,6 +341,7 @@ sourcepath="src/java" overview="src/java/overview.html" packagenames="org.apache.lucene.*" + access="package" destdir="${build.dir}/docs/api" encoding="${build.encoding}" author="true" Index: src/java/org/apache/lucene/index/CompoundFileReader.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/CompoundFileReader.java,v retrieving revision 1.7 diff -u -r1.7 CompoundFileReader.java --- src/java/org/apache/lucene/index/CompoundFileReader.java 12 Jul 2004 14:36:04 -0000 1.7 +++ src/java/org/apache/lucene/index/CompoundFileReader.java 28 Jul 2004 09:28:41 -0000 @@ -207,7 +207,7 @@ * position in the input. * @param b the array to read bytes into * @param offset the offset in the array to start storing bytes - * @param length the number of bytes to read + * @param len the number of bytes to read */ protected void readInternal(byte[] b, int offset, int len) throws IOException Index: src/java/org/apache/lucene/index/FieldInfos.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/FieldInfos.java,v retrieving revision 1.7 diff -u -r1.7 FieldInfos.java --- src/java/org/apache/lucene/index/FieldInfos.java 13 Jul 2004 14:07:34 -0000 1.7 +++ src/java/org/apache/lucene/index/FieldInfos.java 28 Jul 2004 09:28:41 -0000 @@ -46,8 +46,6 @@ * @param d The directory to open the InputStream from * @param name The name of the file to open the InputStream from in the Directory * @throws IOException - * - * @see #read */ FieldInfos(Directory d, String name) throws IOException { InputStream input = d.openFile(name); Index: src/java/org/apache/lucene/search/Scorer.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/Scorer.java,v retrieving revision 1.5 diff -u -r1.5 Scorer.java --- src/java/org/apache/lucene/search/Scorer.java 29 Mar 2004 22:48:03 -0000 1.5 +++ src/java/org/apache/lucene/search/Scorer.java 28 Jul 2004 09:28:41 -0000 @@ -18,11 +18,17 @@ import java.io.IOException; -/** Expert: Implements scoring for a class of queries. */ +/** Expert: Common scoring functionality for different types of queries. + *
A Scorer iterates over all documents matching a query, + * or provides an explanation of the score for a query for a given document. + *
Scores are computed using a given Similarity implementation. + */ public abstract class Scorer { private Similarity similarity; - /** Constructs a Scorer. */ + /** Constructs a Scorer. + * @param similarity The Similarity implementation used by this scorer. + */ protected Scorer(Similarity similarity) { this.similarity = similarity; } @@ -32,28 +38,36 @@ return this.similarity; } - /** Scores all documents and passes them to a collector. */ + /** Scores and collects all matching documents. + * @param hc The collector to which all matching documents are passed through + * {@link HitCollector#collect(int, float)}. + */ public void score(HitCollector hc) throws IOException { while (next()) { hc.collect(doc(), score()); } } - /** Advance to the next document matching the query. Returns true iff there - * is another match. */ + /** Advances to the next document matching the query. + * @return true iff there is another document matching the query. + */ public abstract boolean next() throws IOException; - /** Returns the current document number. Initially invalid, until {@link - * #next()} is called the first time. */ + /** Returns the current document number matching the query. + * Initially invalid, until {@link #next()} is called the first time. + */ public abstract int doc(); - /** Returns the score of the current document. Initially invalid, until - * {@link #next()} is called the first time. */ + /** Returns the score of the current document matching the query. + * Initially invalid, until {@link #next()} 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 target.

Returns true iff there is such - * a match.

Behaves as if written:

+   * greater than or equal to a given target. 
+   * @param target The target document number.
+   * @return true iff there is such a match.
+   * 

Behaves as if written:

    *   boolean skipTo(int target) {
    *     do {
    *       if (!next())
@@ -66,7 +80,11 @@
    */
   public abstract boolean skipTo(int target) throws IOException;
 
-  /** Returns an explanation of the score for doc. */
+  /** Returns an explanation of the score for a document.
+   * 
When this method is used, the {@link #next()} method + * and the {@link #score(HitCollector)} method should not be used. + * @param doc The document number for the explanation. + */ public abstract Explanation explain(int doc) throws IOException; } Index: src/java/org/apache/lucene/search/TermScorer.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/TermScorer.java,v retrieving revision 1.10 diff -u -r1.10 TermScorer.java --- src/java/org/apache/lucene/search/TermScorer.java 25 Jul 2004 15:10:36 -0000 1.10 +++ src/java/org/apache/lucene/search/TermScorer.java 28 Jul 2004 09:28:42 -0000 @@ -20,6 +20,8 @@ import org.apache.lucene.index.TermDocs; +/** Expert: A Scorer for documents matching a Term. + */ final class TermScorer extends Scorer { private Weight weight; private TermDocs termDocs; @@ -35,6 +37,12 @@ private static final int SCORE_CACHE_SIZE = 32; private float[] scoreCache = new float[SCORE_CACHE_SIZE]; + /** Construct a TermScorer. + * @param weight The weight of the Term in the query. + * @param td An iterator over the documents matching the Term. + * @param similarity The Similarity implementation to be used for score computations. + * @param norms The field norms of the document fields for the Term. + */ TermScorer(Weight weight, TermDocs td, Similarity similarity, byte[] norms) throws IOException { super(similarity); @@ -47,8 +55,16 @@ scoreCache[i] = getSimilarity().tf(i) * weightValue; } + /** Returns the current document number matching the query. + * Initially invalid, until {@link #next()} is called the first time. + */ public int doc() { return doc; } + /** Advances to the next document matching the query. + *
The iterator over the matching documents is buffered using + * {@link TermDocs#read(int[],int[])}. + * @return true iff there is another document matching the query. + */ public boolean next() throws IOException { pointer++; if (pointer >= pointerMax) { @@ -65,6 +81,15 @@ return true; } + /** Returns the score of the current document matching the Term. + * Initially invalid, until {@link #next()} is called the first time. + * @return The product of: + * + */ public float score() throws IOException { int f = freqs[pointer]; float raw = // compute tf(f)*weight @@ -75,6 +100,12 @@ return raw * Similarity.decodeNorm(norms[doc]); // normalize for field } + /** Skips to the first match beyond the current whose document number is + * greater than or equal to a given target. + *
The implementation uses {@link TermDocs#skipTo(int)}. + * @param target The target document number. + * @return true iff there is such a match. + */ public boolean skipTo(int target) throws IOException { // first scan in cache for (pointer++; pointer < pointerMax; pointer++) { @@ -97,6 +128,12 @@ return result; } + /** Returns an explanation of the score for a document. + *
When this method is used, the {@link #next()} method + * and the {@link #score(HitCollector)} method should not be used. + * @param doc The document number for the explanation. + * @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(); @@ -120,6 +157,6 @@ return tfExplanation; } + /** Returns a string representation of this TermScorer. */ public String toString() { return "scorer(" + weight + ")"; } - } Index: src/java/org/apache/lucene/search/Weight.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/Weight.java,v retrieving revision 1.3 diff -u -r1.3 Weight.java --- src/java/org/apache/lucene/search/Weight.java 29 Mar 2004 22:48:04 -0000 1.3 +++ src/java/org/apache/lucene/search/Weight.java 28 Jul 2004 09:28:42 -0000 @@ -25,7 +25,7 @@ *

A Weight is constructed by a query, given a Searcher ({@link * Query#createWeight(Searcher)}). The {@link #sumOfSquaredWeights()} method * is then called on the top-level query to compute the query normalization - * factor (@link Similarity#queryNorm(float)}). This factor is then passed to + * factor {@link Similarity#queryNorm(float)}. This factor is then passed to * {@link #normalize(float)}. At this point the weighting is complete and a * scorer may be constructed by calling {@link #scorer(IndexReader)}. */