## org.apache.lucene.search.highlight
Class WeightedSpanTermExtractor

    java.lang.Object
      org.apache.lucene.search.highlight.WeightedSpanTermExtractor

    public class WeightedSpanTermExtractor

extends Object

Class used to extract `WeightedSpanTerm`s from a `Query` based on whether Terms from the query are contained in a supplied TokenStream.

Constructor Summary
`WeightedSpanTermExtractor()`
`WeightedSpanTermExtractor(String defaultField)`

Method Summary
`Map` `getWeightedSpanTerms(Query query, CachingTokenFilter cachingTokenFilter)` Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.
`Map` `getWeightedSpanTerms(Query query, CachingTokenFilter cachingTokenFilter, String fieldName)` Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.
`Map` `getWeightedSpanTermsWithScores(Query query, TokenStream tokenStream, String fieldName, IndexReader reader)` Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.
`boolean` `isHighlightCnstScrRngQuery()`
`void` `setHighlightCnstScrRngQuery(boolean highlightCnstScrRngQuery)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WeightedSpanTermExtractor

    public WeightedSpanTermExtractor()

### WeightedSpanTermExtractor

    public WeightedSpanTermExtractor(String defaultField)

Method Detail

### getWeightedSpanTerms

    public Map getWeightedSpanTerms(Query query,
                                    CachingTokenFilter cachingTokenFilter)
                             throws IOException

  Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.

  Parameters:
    `query` - that caused hit
    `tokenStream` - of text to be highlighted
  Returns:
  Throws:
    `IOException`

### getWeightedSpanTerms

    public Map getWeightedSpanTerms(Query query,
                                    CachingTokenFilter cachingTokenFilter,
                                    String fieldName)
                             throws IOException

  Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.

  Parameters:
    `query` - that caused hit
    `tokenStream` - of text to be highlighted
    `fieldName` - restricts Term's used based on field name
  Returns:
  Throws:
    `IOException`

### getWeightedSpanTermsWithScores

    public Map getWeightedSpanTermsWithScores(Query query,
                                              TokenStream tokenStream,
                                              String fieldName,
                                              IndexReader reader)
                                       throws IOException

  Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`. Uses a supplied `IndexReader` to properly weight terms (for gradient highlighting).

  Parameters:
    `query` - that caused hit
    `tokenStream` - of text to be highlighted
    `fieldName` - restricts Term's used based on field name
    `reader` - to use for scoring
  Returns:
  Throws:
    `IOException`

### isHighlightCnstScrRngQuery

    public boolean isHighlightCnstScrRngQuery()

### setHighlightCnstScrRngQuery

    public void setHighlightCnstScrRngQuery(boolean highlightCnstScrRngQuery)

Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.