org.apache.lucene.search.highlight

Class QueryScorer

public class QueryScorer extends Object implements Scorer

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.

Author: mark@searcharea.co.uk

Constructor Summary
QueryScorer(Query query)
QueryScorer(Query query, String fieldName)
QueryScorer(Query query, IndexReader reader, String fieldName)
QueryScorer(WeightedTerm[] weightedTerms)
Method Summary
voidallFragmentsProcessed()
floatgetFragmentScore()
floatgetMaxTermWeight()
floatgetTokenScore(Token token)
voidstartFragment(TextFragment newFragment)

Constructor Detail

QueryScorer

public QueryScorer(Query query)

Parameters: query a Lucene query (ideally rewritten using query.rewrite before being passed to this class and the searcher)

QueryScorer

public QueryScorer(Query query, String fieldName)

Parameters: 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

QueryScorer

public QueryScorer(Query query, IndexReader reader, String fieldName)

Parameters: 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 intensity fieldName the field on which Inverse Document Frequency (IDF) calculations are based

QueryScorer

public QueryScorer(WeightedTerm[] weightedTerms)

Method Detail

allFragmentsProcessed

public void allFragmentsProcessed()

getFragmentScore

public float getFragmentScore()

getMaxTermWeight

public float getMaxTermWeight()

Returns: The highest weighted term (useful for passing to GradientFormatter to set top end of coloring scale.

getTokenScore

public float getTokenScore(Token token)

startFragment

public void startFragment(TextFragment newFragment)
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.