otis 2004/08/17 13:38:46 Modified: src/java/org/apache/lucene/index CompoundFileReader.java FieldInfos.java src/java/org/apache/lucene/search Scorer.java TermScorer.java Weight.java . build.xml CHANGES.txt Log: - Applied patch from http://issues.apache.org/bugzilla/show_bug.cgi?id=30360 PR: 30360 Submitted by: Paul Elschot Reviewed by: Otis Gospodnetic Revision Changes Path 1.10 +2 -2 jakarta-lucene/src/java/org/apache/lucene/index/CompoundFileReader.java Index: CompoundFileReader.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/CompoundFileReader.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CompoundFileReader.java 8 Aug 2004 14:08:18 -0000 1.9 +++ CompoundFileReader.java 17 Aug 2004 20:38:45 -0000 1.10 @@ -203,7 +203,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 len the number of bytes to read + * @param length the number of bytes to read */ protected void readInternal(byte[] b, int offset, int len) throws IOException 1.9 +0 -2 jakarta-lucene/src/java/org/apache/lucene/index/FieldInfos.java Index: FieldInfos.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/FieldInfos.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- FieldInfos.java 6 Aug 2004 20:44:51 -0000 1.8 +++ FieldInfos.java 17 Aug 2004 20:38:45 -0000 1.9 @@ -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); 1.6 +30 -12 jakarta-lucene/src/java/org/apache/lucene/search/Scorer.java Index: Scorer.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/Scorer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Scorer.java 29 Mar 2004 22:48:03 -0000 1.5 +++ Scorer.java 17 Aug 2004 20:38:45 -0000 1.6 @@ -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. + * <br>A <code>Scorer</code> iterates over all documents matching a query, + * or provides an explanation of the score for a query for a given document. + * <br>Scores are computed using a given <code>Similarity</code> implementation. + */ public abstract class Scorer { private Similarity similarity; - /** Constructs a Scorer. */ + /** Constructs a Scorer. + * @param similarity The <code>Similarity</code> 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 + * [EMAIL PROTECTED] 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 [EMAIL PROTECTED] - * #next()} is called the first time. */ + /** 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. Initially invalid, until - * [EMAIL PROTECTED] #next()} is called the first time. */ + /** Returns the score of the current document matching the query. + * Initially invalid, until [EMAIL PROTECTED] #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 <i>target</i>. <p>Returns true iff there is such - * a match. <p>Behaves as if written: <pre> + * greater than or equal to a given target. + * @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()) @@ -66,7 +80,11 @@ */ public abstract boolean skipTo(int target) throws IOException; - /** Returns an explanation of the score for <code>doc</code>. */ + /** Returns an explanation of the score for a document. + * <br>When this method is used, the [EMAIL PROTECTED] #next()} method + * and the [EMAIL PROTECTED] #score(HitCollector)} method should not be used. + * @param doc The document number for the explanation. + */ public abstract Explanation explain(int doc) throws IOException; } 1.12 +29 -1 jakarta-lucene/src/java/org/apache/lucene/search/TermScorer.java Index: TermScorer.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/TermScorer.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- TermScorer.java 6 Aug 2004 20:19:12 -0000 1.11 +++ TermScorer.java 17 Aug 2004 20:38:45 -0000 1.12 @@ -20,6 +20,8 @@ import org.apache.lucene.index.TermDocs; +/** Expert: A <code>Scorer</code> for documents matching a <code>Term</code>. + */ 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 <code>TermScorer</code>. + * @param weight The weight of the <code>Term</code> in the query. + * @param td An iterator over the documents matching the <code>Term</code>. + * @param similarity The </code>Similarity</code> implementation to be used for score computations. + * @param norms The field norms of the document fields for the <code>Term</code>. + */ TermScorer(Weight weight, TermDocs td, Similarity similarity, byte[] norms) { super(similarity); @@ -47,8 +55,16 @@ scoreCache[i] = getSimilarity().tf(i) * weightValue; } + /** Returns the current document number matching the query. + * Initially invalid, until [EMAIL PROTECTED] #next()} is called the first time. + */ public int doc() { return doc; } + /** Advances to the next document matching the query. + * <br>The iterator over the matching documents is buffered using + * [EMAIL PROTECTED] TermDocs#read(int[],int[])}. + * @return true iff there is another document matching the query. + */ public boolean next() throws IOException { pointer++; if (pointer >= pointerMax) { @@ -75,6 +91,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. + * <br>The implementation uses [EMAIL PROTECTED] 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 +119,12 @@ return result; } + /** Returns an explanation of the score for a document. + * <br>When this method is used, the [EMAIL PROTECTED] #next()} method + * and the [EMAIL PROTECTED] #score(HitCollector)} method should not be used. + * @param doc The document number for the explanation. + * @todo Modify to make use of [EMAIL PROTECTED] TermDocs#skipTo(int)}. + */ public Explanation explain(int doc) throws IOException { TermQuery query = (TermQuery)weight.getQuery(); Explanation tfExplanation = new Explanation(); @@ -120,6 +148,6 @@ return tfExplanation; } + /** Returns a string representation of this <code>TermScorer</code>. */ public String toString() { return "scorer(" + weight + ")"; } - } 1.4 +1 -1 jakarta-lucene/src/java/org/apache/lucene/search/Weight.java Index: Weight.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/Weight.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Weight.java 29 Mar 2004 22:48:04 -0000 1.3 +++ Weight.java 17 Aug 2004 20:38:45 -0000 1.4 @@ -25,7 +25,7 @@ * <p>A Weight is constructed by a query, given a Searcher ([EMAIL PROTECTED] * Query#createWeight(Searcher)}). The [EMAIL PROTECTED] #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 [EMAIL PROTECTED] Similarity#queryNorm(float)}. This factor is then passed to * [EMAIL PROTECTED] #normalize(float)}. At this point the weighting is complete and a * scorer may be constructed by calling [EMAIL PROTECTED] #scorer(IndexReader)}. */ 1.66 +21 -0 jakarta-lucene/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-lucene/build.xml,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- build.xml 1 Jul 2004 17:40:41 -0000 1.65 +++ build.xml 17 Aug 2004 20:38:46 -0000 1.66 @@ -355,6 +355,27 @@ </javadoc> </target> + <target name="javadocs-internal"> + <mkdir dir="${build.dir}/docs/api-internal"/> + <javadoc + sourcepath="src/java" + overview="src/java/overview.html" + packagenames="org.apache.lucene.*" + access="package" + destdir="${build.dir}/docs/api-internal" + encoding="${build.encoding}" + author="true" + version="true" + use="true" + link="${javadoc.link}" + windowtitle="${Name} ${version} public and internal API" + doctitle="${Name} ${version} public and internal API" + bottom="Copyright &copy; ${year} Apache Software Foundation. All Rights Reserved." + > + <tag name="todo" description="To Do:"/> + </javadoc> + </target> + <!-- ================================================================== --> <!-- D I S T R I B U T I O N --> <!-- ================================================================== --> 1.102 +4 -1 jakarta-lucene/CHANGES.txt Index: CHANGES.txt =================================================================== RCS file: /home/cvs/jakarta-lucene/CHANGES.txt,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- CHANGES.txt 17 Aug 2004 13:36:53 -0000 1.101 +++ CHANGES.txt 17 Aug 2004 20:38:46 -0000 1.102 @@ -24,6 +24,9 @@ 5. Disk usage (peak requirements during indexing and optimization) in case of compound file format has been improved. (Bernhard, Dmitry, and Christoph) + + 6. Added javadoc-internal to build.xml - bug #30360 + (Paul Elschot via Otis) 1.4.1
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]