|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lucene.search.highlight.QueryTermScorer
public class QueryTermScorer
Scorer implementation which scores text fragments by the number of
unique query terms found. This class uses the QueryTermExtractor
class to process determine the query terms and their boosts to be used.
| Constructor Summary | |
|---|---|
QueryTermScorer(Query query)
|
|
QueryTermScorer(Query query,
IndexReader reader,
String fieldName)
|
|
QueryTermScorer(Query query,
String fieldName)
|
|
QueryTermScorer(WeightedTerm[] weightedTerms)
|
|
| Method Summary | |
|---|---|
void |
allFragmentsProcessed()
|
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. |
TokenStream |
init(TokenStream tokenStream)
Called to init the Scorer with a TokenStream. |
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 QueryTermScorer(Query query)
query - a Lucene query (ideally rewritten using query.rewrite before
being passed to this class and the searcher)
public QueryTermScorer(Query query,
String fieldName)
query - a Lucene query (ideally rewritten using query.rewrite before
being passed to this class and the searcher)fieldName - the Field name which is used to match Query terms
public QueryTermScorer(Query query,
IndexReader reader,
String fieldName)
query - a Lucene query (ideally rewritten using query.rewrite before
being passed to this class and the searcher)reader - used to compute IDF which can be used to a) score selected
fragments better b) use graded highlights eg set font color
intensityfieldName - the field on which Inverse Document Frequency (IDF)
calculations are basedpublic QueryTermScorer(WeightedTerm[] weightedTerms)
| Method Detail |
|---|
public TokenStream init(TokenStream tokenStream)
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.public void startFragment(TextFragment newFragment)
Scorer
startFragment in interface ScorernewFragment - the fragment that will be scored nextpublic 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 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 void allFragmentsProcessed()
public float getMaxTermWeight()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||