| Constructor and Description |
|---|
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) |
| Modifier and Type | Method and Description |
|---|---|
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() |
boolean |
isUsePayloads()
Whether or not we should capture payloads in
MemoryIndex at each position so that queries can access them. |
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 |
setUsePayloads(boolean usePayloads) |
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.
|
public QueryScorer(Query query)
query - Query to use for highlightingpublic QueryScorer(Query query, String field)
query - Query to use for highlightingfield - Field to highlight - pass null to ignore fieldspublic 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 scoringpublic 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 fieldspublic 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 WeightedSpanTermspublic 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.IOException - If there is a low-level I/O errorpublic WeightedSpanTerm getWeightedSpanTerm(String token)
WeightedSpanTerm for the specified token. Useful for passing
Span information to a Fragmenter.token - to get WeightedSpanTerm forprotected WeightedSpanTermExtractor newTermExtractor(String defaultField)
public void startFragment(TextFragment newFragment)
ScorerstartFragment 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 boolean isUsePayloads()
MemoryIndex at each position so that queries can access them.
This does not apply to term vector based TokenStreams, which support payloads only when the term vector has them.public void setUsePayloads(boolean usePayloads)
public 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. Note that term-vector based tokenstreams are detected and won't be
wrapped either.public void setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.