From 304884c660824409d88cdc91ddabaa875819f7fe Mon Sep 17 00:00:00 2001
From: Otis Gospodnetic
SHOULD -- Use this operator when a clause can occur in the result set, but is not required. +
SHOULD — 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.
MUST -- Use this operator when a clause is required to occur in the result set. Every +
MUST — 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.
MUST NOT -- Use this operator when a +
MUST NOT — Use this operator when a clause must not occur in the result set. No document in the result set will match any such clauses.
Another common search is to find documents containing certain phrases. This - is handled in two different ways. + is handled two different ways:
PhraseQuery - -- Matches a sequence of + — Matches a sequence of Terms. PhraseQuery uses a slop factor to determine how many positions may occur between any two terms in the phrase and still be considered a match.
SpanNearQuery - -- Matches a sequence of other + — Matches a sequence of other SpanQuery instances. SpanNearQuery 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. In summary, here are a few use cases:
SweetSpotSimilarity -- SweetSpotSimilarity — SweetSpotSimilarity 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.
Overriding tf -- In some applications, it doesn't matter what the score of a document is as long as a +
Overriding tf — 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.
Changing Length Normalization -- By overriding Changing Length Normalization — By overriding lengthNorm,
it is possible to discount how the length of a field contributes
to a score. In DefaultSimilarity,
@@ -227,7 +227,7 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}.
Similarity method.
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)}. three main classes:
In some sense, the @@ -259,13 +259,13 @@ org.apache.lucene.search.Searcher#search(Query,Filter)}. Query class has several methods that are important for derived classes: