|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lucene.search.highlight.QueryScorer
public class QueryScorer
Scorer implementation which scores text fragments by the number of
unique query terms found. This class converts appropriate Querys to
SpanQuerys and attempts to score only those terms that participated in
generating the 'hit' on the document.
| Constructor Summary | |
|---|---|
QueryScorer(Query query)
|
|
QueryScorer(Query query,
IndexReader reader,
String field)
|
|
QueryScorer(Query query,
IndexReader reader,
String field,
String defaultField)
|
|
QueryScorer(Query query,
String field)
|
|
QueryScorer(Query query,
String field,
String defaultField)
|
|
QueryScorer(WeightedSpanTerm[] weightedTerms)
|
|
| Method Summary | |
|---|---|
float |
getFragmentScore()
Called when the Highlighter has no more tokens for the current fragment -
the Scorer returns the weighting it has derived for the most recent
fragment, typically based on the results of Scorer.getTokenScore(). |
float |
getMaxTermWeight()
|
float |
getTokenScore()
Called for each token in the current fragment. |
WeightedSpanTerm |
getWeightedSpanTerm(String token)
Retrieve the WeightedSpanTerm for the specified token. |
TokenStream |
init(TokenStream tokenStream)
Called to init the Scorer with a TokenStream. |
boolean |
isExpandMultiTermQuery()
|
protected WeightedSpanTermExtractor |
newTermExtractor(String defaultField)
|
void |
setExpandMultiTermQuery(boolean expandMultiTermQuery)
Controls whether or not multi-term queries are expanded against a MemoryIndex IndexReader. |
void |
setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze)
|
void |
setWrapIfNotCachingTokenFilter(boolean wrap)
By default, TokenStreams that are not of the type
CachingTokenFilter are wrapped in a CachingTokenFilter to
ensure an efficient reset - if you are already using a different caching
TokenStream impl and you don't want it to be wrapped, set this to
false. |
void |
startFragment(TextFragment newFragment)
Called when a new fragment is started for consideration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QueryScorer(Query query)
query - Query to use for highlighting
public QueryScorer(Query query,
String field)
query - Query to use for highlightingfield - Field to highlight - pass null to ignore fields
public QueryScorer(Query query,
IndexReader reader,
String field)
query - Query to use for highlightingfield - Field to highlight - pass null to ignore fieldsreader - IndexReader to use for quasi tf/idf scoring
public QueryScorer(Query query,
IndexReader reader,
String field,
String defaultField)
query - to use for highlightingreader - IndexReader to use for quasi tf/idf scoringfield - to highlight - pass null to ignore fieldsdefaultField -
public QueryScorer(Query query,
String field,
String defaultField)
defaultField - - The default field for queries with the field name unspecifiedpublic QueryScorer(WeightedSpanTerm[] weightedTerms)
weightedTerms - an array of pre-created WeightedSpanTerms| Method Detail |
|---|
public float getFragmentScore()
ScorerHighlighter has no more tokens for the current fragment -
the Scorer returns the weighting it has derived for the most recent
fragment, typically based on the results of Scorer.getTokenScore().
getFragmentScore in interface Scorerpublic float getMaxTermWeight()
public float getTokenScore()
ScorerHighlighter will
increment the TokenStream passed to init on every call.
getTokenScore in interface ScorerHighlighter class to influence the
mark-up of the text (this return value is NOT used to score the
fragment)
public TokenStream init(TokenStream tokenStream)
throws IOException
ScorerTokenStream. You can grab references to
the attributes you are interested in here and access them from Scorer.getTokenScore().
init in interface ScorertokenStream - the TokenStream that will be scored.
TokenStream that the Highlighter should continue using (eg
if you read the tokenSream in this method) or null to continue
using the same TokenStream that was passed in.
IOExceptionpublic WeightedSpanTerm getWeightedSpanTerm(String token)
WeightedSpanTerm for the specified token. Useful for passing
Span information to a Fragmenter.
token - to get WeightedSpanTerm for
protected WeightedSpanTermExtractor newTermExtractor(String defaultField)
public void startFragment(TextFragment newFragment)
Scorer
startFragment in interface ScorernewFragment - the fragment that will be scored nextpublic boolean isExpandMultiTermQuery()
public void setExpandMultiTermQuery(boolean expandMultiTermQuery)
MemoryIndex IndexReader.
expandMultiTermQuery - true if multi-term queries should be expandedpublic void setWrapIfNotCachingTokenFilter(boolean wrap)
TokenStreams that are not of the type
CachingTokenFilter are wrapped in a CachingTokenFilter to
ensure an efficient reset - if you are already using a different caching
TokenStream impl and you don't want it to be wrapped, set this to
false.
wrap - public void setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||