org.apache.lucene.search.highlight

## Class WeightedSpanTermExtractor

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

-     public class WeightedSpanTermExtractor
      extends java.lang.Object

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WeightedSpanTermExtractor()`
    `WeightedSpanTermExtractor(java.lang.String defaultField)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getExpandMultiTermQuery()`
    `TokenStream` | `getTokenStream()`
    `java.util.Map` | `getWeightedSpanTerms(Query query, TokenStream tokenStream)` Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.
    `java.util.Map` | `getWeightedSpanTerms(Query query, TokenStream tokenStream, java.lang.String fieldName)` Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.
    `java.util.Map` | `getWeightedSpanTermsWithScores(Query query, TokenStream tokenStream, java.lang.String fieldName, IndexReader reader)` Creates a Map of `WeightedSpanTerms` from the given `Query` and `TokenStream`.
    `boolean` | `isCachedTokenStream()`
    `void` | `setExpandMultiTermQuery(boolean expandMultiTermQuery)`
    `void` | `setWrapIfNotCachingTokenFilter(boolean wrap)` By default, `TokenStream`s 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.

    - ### 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(java.lang.String defaultField)

  - ### Method Detail

    - #### getWeightedSpanTerms

          public java.util.Map getWeightedSpanTerms(Query query,
                                                    TokenStream tokenStream)
                                             throws java.io.IOException

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

      Parameters:
        `query` - that caused hit
        `tokenStream` - of text to be highlighted
      Returns:
        Map containing WeightedSpanTerms
      Throws:
        `java.io.IOException`

    - #### getWeightedSpanTerms

          public java.util.Map getWeightedSpanTerms(Query query,
                                                    TokenStream tokenStream,
                                                    java.lang.String fieldName)
                                             throws java.io.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:
        Map containing WeightedSpanTerms
      Throws:
        `java.io.IOException`

    - #### getWeightedSpanTermsWithScores

          public java.util.Map getWeightedSpanTermsWithScores(Query query,
                                                              TokenStream tokenStream,
                                                              java.lang.String fieldName,
                                                              IndexReader reader)
                                                       throws java.io.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:
        Map of WeightedSpanTerms with quasi tf/idf scores
      Throws:
        `java.io.IOException`

    - #### getExpandMultiTermQuery

          public boolean getExpandMultiTermQuery()

    - #### setExpandMultiTermQuery

          public void setExpandMultiTermQuery(boolean expandMultiTermQuery)

    - #### isCachedTokenStream

          public boolean isCachedTokenStream()

    - #### getTokenStream

          public TokenStream getTokenStream()

    - #### setWrapIfNotCachingTokenFilter

          public void setWrapIfNotCachingTokenFilter(boolean wrap)

      By default, `TokenStream`s 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.
      Parameters:
        `wrap` -

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