|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.search.highlight.SpanScorer
public class SpanScorer
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 | |
---|---|
SpanScorer(Query query,
String field,
CachingTokenFilter cachingTokenFilter)
|
|
SpanScorer(Query query,
String field,
CachingTokenFilter cachingTokenFilter,
IndexReader reader)
|
|
SpanScorer(Query query,
String field,
CachingTokenFilter cachingTokenFilter,
IndexReader reader,
String defaultField)
As above, but with ability to pass in an IndexReader |
|
SpanScorer(Query query,
String field,
CachingTokenFilter cachingTokenFilter,
String defaultField)
|
|
SpanScorer(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 tokens passed to getTokenScore(). |
float |
getMaxTermWeight()
|
float |
getTokenScore(Token token)
Called for each token in the current fragment |
WeightedSpanTerm |
getWeightedSpanTerm(String token)
Retrieve the WeightedSpanTerm for the specified token. |
static boolean |
isHighlightCnstScrRngQuery()
|
void |
reset()
If you call Highlighter#getBestFragment() more than once you must reset the SpanScorer between each call. |
static void |
setHighlightCnstScrRngQuery(boolean highlight)
Turns highlighting of ConstantScoreRangeQuery on/off. |
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 SpanScorer(Query query, String field, CachingTokenFilter cachingTokenFilter) throws IOException
query
- Query to use for highlightingfield
- Field to highlight - pass null to ignore fieldstokenStream
- of source text to be highlighted
IOException
public SpanScorer(Query query, String field, CachingTokenFilter cachingTokenFilter, IndexReader reader) throws IOException
query
- Query to use for highlightingfield
- Field to highlight - pass null to ignore fieldstokenStream
- of source text to be highlightedreader
-
IOException
public SpanScorer(Query query, String field, CachingTokenFilter cachingTokenFilter, IndexReader reader, String defaultField) throws IOException
IOException
public SpanScorer(Query query, String field, CachingTokenFilter cachingTokenFilter, String defaultField) throws IOException
defaultField
- - The default field for queries with the field name unspecified
IOException
public SpanScorer(WeightedSpanTerm[] weightedTerms)
weightedTerms
- Method Detail |
---|
public float getFragmentScore()
Scorer
getFragmentScore
in interface Scorer
public float getMaxTermWeight()
public float getTokenScore(Token token)
Scorer
getTokenScore
in interface Scorer
token
- The token to be scored
public WeightedSpanTerm getWeightedSpanTerm(String token)
token
-
public static boolean isHighlightCnstScrRngQuery()
public void reset()
public static void setHighlightCnstScrRngQuery(boolean highlight)
highlightCnstScrRngQuery
- public void startFragment(TextFragment newFragment)
Scorer
startFragment
in interface Scorer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |