- LUCENE-891 doc patch

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@541702 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Otis Gospodnetic 2007-05-25 16:07:18 +00:00
parent 9fbee15671
commit 304884c660
1 changed files with 31 additions and 31 deletions

View File

@ -52,8 +52,8 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
TermQuery tq = new TermQuery(new Term("fieldName", "term"));
</pre>In this example, the <a href="Query.html">Query</a> identifies all <a
href="../document/Document.html">Document</a>s that have the <a
href="../document/Field.html">Field</a> named <tt>"fieldName"</tt> and
contain the word <tt>"term"</tt>.
href="../document/Field.html">Field</a> named <tt>"fieldName"</tt>
containing the word <tt>"term"</tt>.
</p>
<h4>
<a href="BooleanQuery.html">BooleanQuery</a>
@ -70,15 +70,15 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
describing how that sub-query is combined with the other clauses:
<ol>
<li><p>SHOULD -- Use this operator when a clause can occur in the result set, but is not required.
<li><p>SHOULD &mdash; Use this operator when a clause can occur in the result set, but is not required.
If a query is made up of all SHOULD clauses, then every document in the result
set matches at least one of these clauses.</p></li>
<li><p>MUST -- Use this operator when a clause is required to occur in the result set. Every
<li><p>MUST &mdash; Use this operator when a clause is required to occur in the result set. Every
document in the result set will match
all such clauses.</p></li>
<li><p>MUST NOT -- Use this operator when a
<li><p>MUST NOT &mdash; Use this operator when a
clause must not occur in the result set. No
document in the result set will match
any such clauses.</p></li>
@ -100,18 +100,18 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
<h4>Phrases</h4>
<p>Another common search is to find documents containing certain phrases. This
is handled in two different ways.
is handled two different ways:
<ol>
<li>
<p><a href="PhraseQuery.html">PhraseQuery</a>
-- Matches a sequence of
&mdash; Matches a sequence of
<a href="../index/Term.html">Terms</a>.
<a href="PhraseQuery.html">PhraseQuery</a> uses a slop factor to determine
how many positions may occur between any two terms in the phrase and still be considered a match.</p>
</li>
<li>
<p><a href="spans/SpanNearQuery.html">SpanNearQuery</a>
-- Matches a sequence of other
&mdash; Matches a sequence of other
<a href="spans/SpanQuery.html">SpanQuery</a>
instances. <a href="spans/SpanNearQuery.html">SpanNearQuery</a> allows for
much more
@ -203,15 +203,15 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
href="http://www.nabble.com/Overriding-Similarity-tf2128934.html">Overriding Similarity</a>.
In summary, here are a few use cases:
<ol>
<li><p><a href="api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> -- <a
<li><p><a href="api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> &mdash; <a
href="api/org/apache/lucene/misc/SweetSpotSimilarity.html">SweetSpotSimilarity</a> gives small increases
as the frequency increases a small amount
and then greater increases when you hit the "sweet spot", i.e. where you think the frequency of terms is
more significant.</p></li>
<li><p>Overriding tf -- In some applications, it doesn't matter what the score of a document is as long as a
<li><p>Overriding tf &mdash; In some applications, it doesn't matter what the score of a document is as long as a
matching term occurs. In these
cases people have overridden Similarity to return 1 from the tf() method.</p></li>
<li><p>Changing Length Normalization -- By overriding <a
<li><p>Changing Length Normalization &mdash; By overriding <a
href="Similarity.html#lengthNorm(java.lang.String,%20int)">lengthNorm</a>,
it is possible to discount how the length of a field contributes
to a score. In <a href="DefaultSimilarity.html">DefaultSimilarity</a>,
@ -227,7 +227,7 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
Similarity method.</blockquote>
</p>
<a name="scoring"></a>
<h2>Changing Scoring -- Expert Level</h2>
<h2>Changing Scoring &mdash; Expert Level</h2>
<p>Changing scoring is an expert level task, so tread carefully and be prepared to share your code if
you want help.
@ -238,16 +238,16 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
<span >three main classes</span>:
<ol>
<li>
<a href="Query.html">Query</a> -- The abstract object representation of the
<a href="Query.html">Query</a> &mdash; The abstract object representation of the
user's information need.</li>
<li>
<a href="Weight.html">Weight</a> -- The internal interface representation of
<a href="Weight.html">Weight</a> &mdash; The internal interface representation of
the user's Query, so that Query objects may be reused.</li>
<li>
<a href="Scorer.html">Scorer</a> -- An abstract class containing common
<a href="Scorer.html">Scorer</a> &mdash; An abstract class containing common
functionality for scoring. Provides both scoring and explanation capabilities.</li>
</ol>
Details on each of these classes, and their children can be found in the subsections below.
Details on each of these classes, and their children, can be found in the subsections below.
</p>
<h4>The Query Class</h4>
<p>In some sense, the
@ -259,13 +259,13 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
<a href="Query.html">Query</a> class has several methods that are important for
derived classes:
<ol>
<li>createWeight(Searcher searcher) -- A
<li>createWeight(Searcher searcher) &mdash; A
<a href="Weight.html">Weight</a> is the internal representation of the
Query, so each Query implementation must
provide an implementation of Weight. See the subsection on <a
href="#The Weight Interface">The Weight Interface</a> below for details on implementing the Weight
interface.</li>
<li>rewrite(IndexReader reader) -- Rewrites queries into primitive queries. Primitive queries are:
<li>rewrite(IndexReader reader) &mdash; Rewrites queries into primitive queries. Primitive queries are:
<a href="TermQuery.html">TermQuery</a>,
<a href="BooleanQuery.html">BooleanQuery</a>, <span
>OTHERS????</span></li>
@ -277,26 +277,26 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
interface provides an internal representation of the Query so that it can be reused. Any
<a href="Searcher.html">Searcher</a>
dependent state should be stored in the Weight implementation,
not in the Query class. The interface defines 6 methods that must be implemented:
not in the Query class. The interface defines six methods that must be implemented:
<ol>
<li>
<a href="Weight.html#getQuery()">Weight#getQuery()</a> -- Pointer to the
<a href="Weight.html#getQuery()">Weight#getQuery()</a> &mdash; Pointer to the
Query that this Weight represents.</li>
<li>
<a href="Weight.html#getValue()">Weight#getValue()</a> -- The weight for
<a href="Weight.html#getValue()">Weight#getValue()</a> &mdash; The weight for
this Query. For example, the TermQuery.TermWeight value is
equal to the idf^2 * boost * queryNorm <!-- DOUBLE CHECK THIS --></li>
<li>
<a href="Weight.html#sumOfSquaredWeights()">
Weight#sumOfSquaredWeights()</a> -- The sum of squared weights. Tor TermQuery, this is (idf *
Weight#sumOfSquaredWeights()</a> &mdash; The sum of squared weights. For TermQuery, this is (idf *
boost)^2</li>
<li>
<a href="Weight.html#normalize(float)">
Weight#normalize(float)</a> -- Determine the query normalization factor. The query normalization may
Weight#normalize(float)</a> &mdash; Determine the query normalization factor. The query normalization may
allow for comparing scores between queries.</li>
<li>
<a href="Weight.html#scorer(IndexReader)">
Weight#scorer(IndexReader)</a> -- Construct a new
Weight#scorer(IndexReader)</a> &mdash; Construct a new
<a href="Scorer.html">Scorer</a>
for this Weight. See
<a href="#The Scorer Class">The Scorer Class</a>
@ -305,7 +305,7 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
</li>
<li>
<a href="Weight.html#explain(IndexReader, int)">
Weight#explain(IndexReader, int)</a> -- Provide a means for explaining why a given document was
Weight#explain(IndexReader, int)</a> &mdash; Provide a means for explaining why a given document was
scored
the way it was.</li>
</ol>
@ -318,29 +318,29 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
must be implemented:
<ol>
<li>
<a href="Scorer.html#next()">Scorer#next()</a> -- Advances to the next
<a href="Scorer.html#next()">Scorer#next()</a> &mdash; Advances to the next
document that matches this Query, returning true if and only
if there is another document that matches.</li>
<li>
<a href="Scorer.html#doc()">Scorer#doc()</a> -- Returns the id of the
<a href="Scorer.html#doc()">Scorer#doc()</a> &mdash; Returns the id of the
<a href="../document/Document.html">Document</a>
that contains the match. Is not valid until next() has been called at least once.
that contains the match. It is not valid until next() has been called at least once.
</li>
<li>
<a href="Scorer.html#score()">Scorer#score()</a> -- Return the score of the
<a href="Scorer.html#score()">Scorer#score()</a> &mdash; Return the score of the
current document. This value can be determined in any
appropriate way for an application. For instance, the
<a href="http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java?view=log">TermScorer</a>
returns the tf * Weight.getValue() * fieldNorm.
</li>
<li>
<a href="Scorer.html#skipTo(int)">Scorer#skipTo(int)</a> -- Skip ahead in
<a href="Scorer.html#skipTo(int)">Scorer#skipTo(int)</a> &mdash; Skip ahead in
the document matches to the document whose id is greater than
or equal to the passed in value. In many instances, skipTo can be
implemented more efficiently than simply looping through all the matching documents until
the target document is identified.</li>
<li>
<a href="Scorer.html#explain(int)">Scorer#explain(int)</a> -- Provides
<a href="Scorer.html#explain(int)">Scorer#explain(int)</a> &mdash; Provides
details on why the score came about.</li>
</ol>
</p>