diff --git a/src/java/org/apache/lucene/document/Field.java b/src/java/org/apache/lucene/document/Field.java index 7b406d84242..99535f8a3a6 100644 --- a/src/java/org/apache/lucene/document/Field.java +++ b/src/java/org/apache/lucene/document/Field.java @@ -111,7 +111,7 @@ public final class Field { return new Field(name, value); } - /** The name of the field (e.g., "date", "subject", "title", "body", etc.) + /** The name of the field (e.g., "date", "subject", "title", or "body") as an interned string. */ public String name() { return name; } diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java index 6abba52971d..e49bd4dc348 100644 --- a/src/java/org/apache/lucene/index/IndexWriter.java +++ b/src/java/org/apache/lucene/index/IndexWriter.java @@ -84,7 +84,7 @@ import org.apache.lucene.analysis.Analyzer; method should be called before the index is closed. */ -public final class IndexWriter { +public class IndexWriter { private Directory directory; // where this index resides private Analyzer analyzer; // how to analyze text @@ -140,7 +140,7 @@ public final class IndexWriter { /** Flushes all changes to an index, closes all associated files, and closes the directory that the index is stored in. */ - public final synchronized void close() throws IOException { + public synchronized void close() throws IOException { flushRamSegments(); ramDirectory.close(); writeLock.release(); // release write lock @@ -149,7 +149,7 @@ public final class IndexWriter { } /** Release the write lock, if needed. */ - protected final void finalize() throws IOException { + protected void finalize() throws IOException { if (writeLock != null) { writeLock.release(); // release write lock writeLock = null; @@ -157,7 +157,7 @@ public final class IndexWriter { } /** Returns the number of documents currently in this index. */ - public final synchronized int docCount() { + public synchronized int docCount() { int count = 0; for (int i = 0; i < segmentInfos.size(); i++) { SegmentInfo si = segmentInfos.info(i); @@ -175,7 +175,7 @@ public final class IndexWriter { public int maxFieldLength = 10000; /** Adds a document to this index.*/ - public final void addDocument(Document doc) throws IOException { + public void addDocument(Document doc) throws IOException { DocumentWriter dw = new DocumentWriter(ramDirectory, analyzer, maxFieldLength); String segmentName = newSegmentName(); @@ -214,7 +214,7 @@ public final class IndexWriter { /** Merges all segments together into a single segment, optimizing an index for search. */ - public final synchronized void optimize() throws IOException { + public synchronized void optimize() throws IOException { flushRamSegments(); while (segmentInfos.size() > 1 || (segmentInfos.size() == 1 && @@ -234,7 +234,7 @@ public final class IndexWriter { * with this method. * *

After this completes, the index is optimized. */ - public final synchronized void addIndexes(Directory[] dirs) + public synchronized void addIndexes(Directory[] dirs) throws IOException { optimize(); // start with zero or 1 seg for (int i = 0; i < dirs.length; i++) { diff --git a/src/java/org/apache/lucene/search/BooleanClause.java b/src/java/org/apache/lucene/search/BooleanClause.java index 831314f8a80..84b512e75a9 100644 --- a/src/java/org/apache/lucene/search/BooleanClause.java +++ b/src/java/org/apache/lucene/search/BooleanClause.java @@ -55,7 +55,7 @@ package org.apache.lucene.search; */ /** A clause in a BooleanQuery. */ -public final class BooleanClause { +public class BooleanClause { /** The query whose matching documents are combined by the boolean query. */ public Query query; /** If true, documents documents which do not diff --git a/src/java/org/apache/lucene/search/BooleanQuery.java b/src/java/org/apache/lucene/search/BooleanQuery.java index 084219e4933..9a8fd582585 100644 --- a/src/java/org/apache/lucene/search/BooleanQuery.java +++ b/src/java/org/apache/lucene/search/BooleanQuery.java @@ -61,7 +61,7 @@ import org.apache.lucene.index.IndexReader; /** A Query that matches documents matching boolean combinations of other queries, typically {@link TermQuery}s or {@link PhraseQuery}s. */ -final public class BooleanQuery extends Query { +public class BooleanQuery extends Query { private Vector clauses = new Vector(); /** Constructs an empty boolean query. */ @@ -79,12 +79,12 @@ final public class BooleanQuery extends Query { It is an error to specify a clause as both required and prohibited. */ - public final void add(Query query, boolean required, boolean prohibited) { + public void add(Query query, boolean required, boolean prohibited) { clauses.addElement(new BooleanClause(query, required, prohibited)); } /** Adds a clause to a boolean query. */ - public final void add(BooleanClause clause) { + public void add(BooleanClause clause) { clauses.addElement(clause); } @@ -95,7 +95,7 @@ final public class BooleanQuery extends Query { } } - final float sumOfSquaredWeights(Searcher searcher) + float sumOfSquaredWeights(Searcher searcher) throws IOException { float sum = 0.0f; @@ -108,7 +108,7 @@ final public class BooleanQuery extends Query { return sum; } - final void normalize(float norm) { + void normalize(float norm) { for (int i = 0 ; i < clauses.size(); i++) { BooleanClause c = (BooleanClause)clauses.elementAt(i); if (!c.prohibited) @@ -116,7 +116,7 @@ final public class BooleanQuery extends Query { } } - final Scorer scorer(IndexReader reader) + Scorer scorer(IndexReader reader) throws IOException { if (clauses.size() == 1) { // optimize 1-term queries diff --git a/src/java/org/apache/lucene/search/DateFilter.java b/src/java/org/apache/lucene/search/DateFilter.java index ec6e1e628c5..e7e1a7ef910 100644 --- a/src/java/org/apache/lucene/search/DateFilter.java +++ b/src/java/org/apache/lucene/search/DateFilter.java @@ -69,7 +69,7 @@ import org.apache.lucene.index.IndexReader;

For this to work, documents must have been indexed with a {@link DateField}. */ -public final class DateFilter extends Filter { +public class DateFilter extends Filter { String field; String start = DateField.MIN_DATE_STRING(); @@ -126,7 +126,7 @@ public final class DateFilter extends Filter { /** Returns a BitSet with true for documents which should be permitted in search results, and false for those that should not. */ - final public BitSet bits(IndexReader reader) throws IOException { + public BitSet bits(IndexReader reader) throws IOException { BitSet bits = new BitSet(reader.maxDoc()); TermEnum enum = reader.terms(new Term(field, start)); TermDocs termDocs = reader.termDocs(); @@ -153,7 +153,7 @@ public final class DateFilter extends Filter { return bits; } - public final String toString() { + public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(field); buffer.append(":"); diff --git a/src/java/org/apache/lucene/search/IndexSearcher.java b/src/java/org/apache/lucene/search/IndexSearcher.java index f5a9988d395..b6886042308 100644 --- a/src/java/org/apache/lucene/search/IndexSearcher.java +++ b/src/java/org/apache/lucene/search/IndexSearcher.java @@ -63,8 +63,12 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; import org.apache.lucene.util.PriorityQueue; -/** Implements search over a single IndexReader. */ -public final class IndexSearcher extends Searcher { +/** Implements search over a single IndexReader. + * + *

Applications usually need only call the inherited {@link #search(Query)} + * or {@link #search(Query,Filter)} methods. + */ +public class IndexSearcher extends Searcher implements Searchable { IndexReader reader; /** Creates a searcher searching the index in the named directory. */ @@ -83,24 +87,40 @@ public final class IndexSearcher extends Searcher { } /** Frees resources associated with this Searcher. */ - public final void close() throws IOException { + public void close() throws IOException { reader.close(); } - final int docFreq(Term term) throws IOException { + /** Expert: Returns the number of documents containing term. + * Called by search code to compute term weights. + * @see IndexReader#docFreq(Term). + */ + public int docFreq(Term term) throws IOException { return reader.docFreq(term); } /** For use by {@link HitCollector} implementations. */ - public final Document doc(int i) throws IOException { + public Document doc(int i) throws IOException { return reader.document(i); } - final int maxDoc() throws IOException { + /** Expert: Returns one greater than the largest possible document number. + * Called by search code to compute term weights. + * @see IndexReader#maxDoc(). + */ + public int maxDoc() throws IOException { return reader.maxDoc(); } - final TopDocs search(Query query, Filter filter, final int nDocs) + /** Expert: Low-level search implementation. Finds the top n + * hits for query, applying filter if non-null. + * + *

Called by {@link Hits}. + * + *

Applications should usually call {@link #search(Query)} or {@link + * #search(Query,Filter)} instead. + */ + public TopDocs search(Query query, Filter filter, final int nDocs) throws IOException { Scorer scorer = Query.scorer(query, this, reader); if (scorer == null) @@ -147,8 +167,8 @@ public final class IndexSearcher extends Searcher { * @param filter if non-null, a bitset used to eliminate some documents * @param results to receive hits */ - public final void search(Query query, Filter filter, - final HitCollector results) throws IOException { + public void search(Query query, Filter filter, + final HitCollector results) throws IOException { HitCollector collector = results; if (filter != null) { final BitSet bits = filter.bits(reader); diff --git a/src/java/org/apache/lucene/search/MultiSearcher.java b/src/java/org/apache/lucene/search/MultiSearcher.java index 760d9abcf31..c7e8f2e0583 100644 --- a/src/java/org/apache/lucene/search/MultiSearcher.java +++ b/src/java/org/apache/lucene/search/MultiSearcher.java @@ -61,49 +61,53 @@ import org.apache.lucene.document.Document; import org.apache.lucene.index.Term; import org.apache.lucene.util.PriorityQueue; -/** Implements search over a set of Searchers. */ -public final class MultiSearcher extends Searcher { - private Searcher[] searchers; +/** Implements search over a set of Searchables. + * + *

Applications usually need only call the inherited {@link #search(Query)} + * or {@link #search(Query,Filter)} methods. + */ +public class MultiSearcher extends Searcher implements Searchable { + private Searchable[] searchables; private int[] starts; private int maxDoc = 0; - /** Creates a searcher which searches searchers. */ - public MultiSearcher(Searcher[] searchers) throws IOException { - this.searchers = searchers; + /** Creates a searcher which searches searchables. */ + public MultiSearcher(Searchable[] searchables) throws IOException { + this.searchables = searchables; - starts = new int[searchers.length + 1]; // build starts array - for (int i = 0; i < searchers.length; i++) { + starts = new int[searchables.length + 1]; // build starts array + for (int i = 0; i < searchables.length; i++) { starts[i] = maxDoc; - maxDoc += searchers[i].maxDoc(); // compute maxDocs + maxDoc += searchables[i].maxDoc(); // compute maxDocs } - starts[searchers.length] = maxDoc; + starts[searchables.length] = maxDoc; } /** Frees resources associated with this Searcher. */ - public final void close() throws IOException { - for (int i = 0; i < searchers.length; i++) - searchers[i].close(); + public void close() throws IOException { + for (int i = 0; i < searchables.length; i++) + searchables[i].close(); } - final int docFreq(Term term) throws IOException { + public int docFreq(Term term) throws IOException { int docFreq = 0; - for (int i = 0; i < searchers.length; i++) - docFreq += searchers[i].docFreq(term); + for (int i = 0; i < searchables.length; i++) + docFreq += searchables[i].docFreq(term); return docFreq; } /** For use by {@link HitCollector} implementations. */ - public final Document doc(int n) throws IOException { + public Document doc(int n) throws IOException { int i = searcherIndex(n); // find searcher index - return searchers[i].doc(n - starts[i]); // dispatch to searcher + return searchables[i].doc(n - starts[i]); // dispatch to searcher } /** For use by {@link HitCollector} implementations to identify the * index of the sub-searcher that a particular hit came from. */ - public final int searcherIndex(int n) { // find searcher for doc n: + public int searcherIndex(int n) { // find searcher for doc n: // replace w/ call to Arrays.binarySearch in Java 1.2 int lo = 0; // search starts array - int hi = searchers.length - 1; // for first element less + int hi = searchables.length - 1; // for first element less // than n, return its index while (hi >= lo) { int mid = (lo + hi) >> 1; @@ -118,18 +122,18 @@ public final class MultiSearcher extends Searcher { return hi; } - final int maxDoc() throws IOException { + public int maxDoc() throws IOException { return maxDoc; } - final TopDocs search(Query query, Filter filter, int nDocs) - throws IOException { + public TopDocs search(Query query, Filter filter, int nDocs) + throws IOException { HitQueue hq = new HitQueue(nDocs); float minScore = 0.0f; int totalHits = 0; - for (int i = 0; i < searchers.length; i++) { // search each searcher - TopDocs docs = searchers[i].search(query, filter, nDocs); + for (int i = 0; i < searchables.length; i++) { // search each searcher + TopDocs docs = searchables[i].search(query, filter, nDocs); totalHits += docs.totalHits; // update totalHits ScoreDoc[] scoreDocs = docs.scoreDocs; for (int j = 0; j < scoreDocs.length; j++) { // merge scoreDocs into hq @@ -168,14 +172,13 @@ public final class MultiSearcher extends Searcher { * @param filter if non-null, a bitset used to eliminate some documents * @param results to receive hits */ - public final void search(Query query, Filter filter, - final HitCollector results) + public void search(Query query, Filter filter, final HitCollector results) throws IOException { - for (int i = 0; i < searchers.length; i++) { + for (int i = 0; i < searchables.length; i++) { final int start = starts[i]; - searchers[i].search(query, filter, new HitCollector() { + searchables[i].search(query, filter, new HitCollector() { public void collect(int doc, float score) { results.collect(doc + start, score); } diff --git a/src/java/org/apache/lucene/search/PhraseQuery.java b/src/java/org/apache/lucene/search/PhraseQuery.java index 903795d8a0d..e85fd1361e9 100644 --- a/src/java/org/apache/lucene/search/PhraseQuery.java +++ b/src/java/org/apache/lucene/search/PhraseQuery.java @@ -65,7 +65,7 @@ import org.apache.lucene.index.IndexReader; /** A Query that matches documents containing a particular sequence of terms. This may be combined with other terms with a {@link BooleanQuery}. */ -final public class PhraseQuery extends Query { +public class PhraseQuery extends Query { private String field; private Vector terms = new Vector(); private float idf = 0.0f; @@ -92,12 +92,12 @@ final public class PhraseQuery extends Query { results are sorted by exactness.

The slop is zero by default, requiring exact matches.*/ - public final void setSlop(int s) { slop = s; } + public void setSlop(int s) { slop = s; } /** Returns the slop. See setSlop(). */ - public final int getSlop() { return slop; } + public int getSlop() { return slop; } /** Adds a term to the end of the query phrase. */ - public final void add(Term term) { + public void add(Term term) { if (terms.size() == 0) field = term.field(); else if (term.field() != field) @@ -148,7 +148,7 @@ final public class PhraseQuery extends Query { } /** Prints a user-readable version of this query. */ - public final String toString(String f) { + public String toString(String f) { StringBuffer buffer = new StringBuffer(); if (!field.equals(f)) { buffer.append(field); diff --git a/src/java/org/apache/lucene/search/PrefixQuery.java b/src/java/org/apache/lucene/search/PrefixQuery.java index 29163661fae..4525f26347b 100644 --- a/src/java/org/apache/lucene/search/PrefixQuery.java +++ b/src/java/org/apache/lucene/search/PrefixQuery.java @@ -61,7 +61,7 @@ import org.apache.lucene.index.TermDocs; import org.apache.lucene.index.IndexReader; /** A Query that matches documents containing terms with a specified prefix. */ -final public class PrefixQuery extends Query { +public class PrefixQuery extends Query { private Term prefix; private IndexReader reader; private BooleanQuery query; diff --git a/src/java/org/apache/lucene/search/RangeQuery.java b/src/java/org/apache/lucene/search/RangeQuery.java index 083afe49c8a..dbeec4a4568 100644 --- a/src/java/org/apache/lucene/search/RangeQuery.java +++ b/src/java/org/apache/lucene/search/RangeQuery.java @@ -61,7 +61,7 @@ import org.apache.lucene.index.TermDocs; import org.apache.lucene.index.IndexReader; /** A Query that matches documents within an exclusive range. */ -public final class RangeQuery extends Query +public class RangeQuery extends Query { private Term lowerTerm; private Term upperTerm; diff --git a/src/java/org/apache/lucene/search/ScoreDoc.java b/src/java/org/apache/lucene/search/ScoreDoc.java index 5e2f010c939..a3087998f2f 100644 --- a/src/java/org/apache/lucene/search/ScoreDoc.java +++ b/src/java/org/apache/lucene/search/ScoreDoc.java @@ -54,12 +54,20 @@ package org.apache.lucene.search; * . */ -final class ScoreDoc { - float score; - int doc; +/** Expert: Returned by low-level search implementations. + * @see TopDocs */ +public class ScoreDoc { + /** Expert: The score of this document for the query. */ + public float score; - ScoreDoc(int d, float s) { - doc = d; - score = s; + /** Expert: A hit document's number. + * @see Searcher#doc(int) + */ + public int doc; + + /** Expert: Constructs a ScoreDoc. */ + public ScoreDoc(int doc, float score) { + this.doc = doc; + this.score = score; } } diff --git a/src/java/org/apache/lucene/search/Searchable.java b/src/java/org/apache/lucene/search/Searchable.java new file mode 100644 index 00000000000..442cdffbe5f --- /dev/null +++ b/src/java/org/apache/lucene/search/Searchable.java @@ -0,0 +1,112 @@ +package org.apache.lucene.search; + +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" and + * "Apache Lucene" must not be used to endorse or promote products + * derived from this software without prior written permission. For + * written permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * "Apache Lucene", nor may "Apache" appear in their name, without + * prior written permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +import java.io.IOException; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.Term; +import org.apache.lucene.index.IndexReader; + +/** The interface for search implementations. */ +public interface Searchable { + /** Lower-level search API. + * + *

{@link HitCollector#collect(int,float)} is called for every non-zero + * scoring document. + * + *

Applications should only use this if they need all of the + * matching documents. The high-level search API ({@link + * Searcher#search(Query)}) is usually more efficient, as it skips + * non-high-scoring hits. + * + * @param query to match documents + * @param filter if non-null, a bitset used to eliminate some documents + * @param results to receive hits + */ + public abstract void search(Query query, Filter filter, HitCollector results) + throws IOException; + + /** Frees resources associated with this Searcher. */ + public abstract void close() throws IOException; + + /** Expert: Returns the number of documents containing term. + * Called by search code to compute term weights. + * @see IndexReader#docFreq(Term). + */ + public abstract int docFreq(Term term) throws IOException; + + /** Expert: Returns one greater than the largest possible document number. + * Called by search code to compute term weights. + * @see IndexReader#maxDoc(). + */ + public abstract int maxDoc() throws IOException; + + /** Expert: Low-level search implementation. Finds the top n + * hits for query, applying filter if non-null. + * + *

Called by {@link Hits}. + * + *

Applications should usually call {@link Searcher#search(Query)} or + * {@link Searcher#search(Query,Filter)} instead. + */ + public abstract TopDocs search(Query query, Filter filter, int n) + throws IOException; + + /** Expert: Returns the stored fields of document i. + * Called by {@link HitCollector} implementations. + * @see IndexReader#document(int). + */ + public abstract Document doc(int i) throws IOException; +} diff --git a/src/java/org/apache/lucene/search/Searcher.java b/src/java/org/apache/lucene/search/Searcher.java index d177d356699..ec68c33c3ce 100644 --- a/src/java/org/apache/lucene/search/Searcher.java +++ b/src/java/org/apache/lucene/search/Searcher.java @@ -57,12 +57,14 @@ package org.apache.lucene.search; import java.io.IOException; import org.apache.lucene.document.Document; import org.apache.lucene.index.Term; +import org.apache.lucene.index.IndexReader; /** The abstract base class for search implementations. -

Subclasses implement search over a single index, over multiple indices, - and over indices on remote servers. + * + *

Subclasses implement search over a single index, over multiple indices, + * and over indices on remote servers. */ -public abstract class Searcher { +public abstract class Searcher implements Searchable { /** Returns the documents matching query. */ public final Hits search(Query query) throws IOException { @@ -88,32 +90,4 @@ public abstract class Searcher { throws IOException { search(query, (Filter)null, results); } - - /** Lower-level search API. - * - *

{@link HitCollector#collect(int,float)} is called for every non-zero - * scoring document. - * - *

Applications should only use this if they need all of the - * matching documents. The high-level search API ({@link - * Searcher#search(Query)}) is usually more efficient, as it skips - * non-high-scoring hits. - * - * @param query to match documents - * @param filter if non-null, a bitset used to eliminate some documents - * @param results to receive hits - */ - public abstract void search(Query query, Filter filter, HitCollector results) - throws IOException; - - /** Frees resources associated with this Searcher. */ - abstract public void close() throws IOException; - - abstract int docFreq(Term term) throws IOException; - abstract int maxDoc() throws IOException; - abstract TopDocs search(Query query, Filter filter, int n) - throws IOException; - - /** For use by {@link HitCollector} implementations. */ - public abstract Document doc(int i) throws IOException; } diff --git a/src/java/org/apache/lucene/search/TermQuery.java b/src/java/org/apache/lucene/search/TermQuery.java index bb55a3086cc..2fd54bc80c8 100644 --- a/src/java/org/apache/lucene/search/TermQuery.java +++ b/src/java/org/apache/lucene/search/TermQuery.java @@ -62,7 +62,7 @@ import org.apache.lucene.index.IndexReader; /** A Query that matches documents containing a term. This may be combined with other terms with a {@link BooleanQuery}. */ -final public class TermQuery extends Query { +public class TermQuery extends Query { private Term term; private float idf = 0.0f; private float weight = 0.0f; diff --git a/src/java/org/apache/lucene/search/TopDocs.java b/src/java/org/apache/lucene/search/TopDocs.java index 52506bfdd26..9cf732666cd 100644 --- a/src/java/org/apache/lucene/search/TopDocs.java +++ b/src/java/org/apache/lucene/search/TopDocs.java @@ -54,12 +54,19 @@ package org.apache.lucene.search; * . */ -final class TopDocs { - int totalHits; - ScoreDoc[] scoreDocs; +/** Expert: Returned by low-level search implementations. + * @see Searcher#search(Query,Filter,int) */ +public class TopDocs { + /** Expert: The total number of hits for the query. + * @see Hits#length() + */ + public int totalHits; + /** Expert: The top hits for the query. */ + public ScoreDoc[] scoreDocs; - TopDocs(int th, ScoreDoc[] sds) { - totalHits = th; - scoreDocs = sds; + /** Expert: Constructs a TopDocs.*/ + TopDocs(int totalHits, ScoreDoc[] scoreDocs) { + this.totalHits = totalHits; + this.scoreDocs = scoreDocs; } } diff --git a/src/java/org/apache/lucene/search/WildcardQuery.java b/src/java/org/apache/lucene/search/WildcardQuery.java index 78fd8ebd437..644ff6cdef0 100644 --- a/src/java/org/apache/lucene/search/WildcardQuery.java +++ b/src/java/org/apache/lucene/search/WildcardQuery.java @@ -59,7 +59,7 @@ import org.apache.lucene.index.Term; import java.io.IOException; /** Implements the wildcard search query */ -final public class WildcardQuery extends MultiTermQuery { +public class WildcardQuery extends MultiTermQuery { private Term wildcardTerm; public WildcardQuery(Term term) { diff --git a/src/java/org/apache/lucene/search/package.html b/src/java/org/apache/lucene/search/package.html index 0f877ccfa75..c5827c69725 100644 --- a/src/java/org/apache/lucene/search/package.html +++ b/src/java/org/apache/lucene/search/package.html @@ -6,5 +6,10 @@ Search over indices. + +Applications usually call {@link +org.apache.lucene.search.Searcher#search(Query)} or {@link +org.apache.lucene.search.Searcher#search(Query,Filter)}. + diff --git a/src/java/overview.html b/src/java/overview.html index 35378eff218..8f9dd0ca7b9 100644 --- a/src/java/overview.html +++ b/src/java/overview.html @@ -4,8 +4,7 @@ -

Jakarta Lucene API

-The Jakarta Lucene API is divided into several packages: +The Jakarta Lucene API is divided into several packages.