Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6445

Highlighter TokenSources simplification; just one getAnyTokenStream()

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.2
    • modules/highlighter
    • None
    • New

    Description

      The Highlighter "TokenSources" class has quite a few utility methods pertaining to getting a TokenStream from either term vectors or analyzed text. I think it's too much:

      • some go to term vectors, some don't. But if you don't want to go to term vectors, then it's quite easy for the caller to invoke the Analyzer for the field value, and to get that field value.
      • Some methods return null, some never null; I forget which at a glance.
      • Some methods read the Document (to get a field value) from the IndexReader, some don't. Furthermore, it's not an ideal place to get the doc since your app might be using an IndexSearcher with a document cache (e.g. SolrIndexSearcher).
      • None of the methods accept a Fields instance from term vectors as a parameter. Based on how Lucene's term vector format works, this is a performance trap if you don't re-use an instance across fields on the document that you're highlighting.

      Attachments

        Issue Links

          Activity

            People

              dsmiley David Smiley
              dsmiley David Smiley
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: