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

Add CachingTokenFilter.isCached and switch LinkedList to ArrayList

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0, 6.0
    • None
    • None
    • New

    Description

      CachingTokenFilter could use a simple boolean isCached() method implemented as-such:

        /** If the underlying token stream was consumed and cached */
        public boolean isCached() {
          return cache != null;
        }
      

      It's useful for the highlighting code to remove its wrapping of CachingTokenFilter if after handing-off to parts of its framework it turns out that it wasn't used.

      Furthermore, use an ArrayList, not a LinkedList. ArrayList is leaner when the token count is high, and this class doesn't manipulate the list in a way that might favor LL.

      A separate patch will come that actually uses this method.

      Attachments

        1. LUCENE-6033_boolean_resetInput_option.patch
          5 kB
          David Smiley
        2. LUCENE-6033.patch
          1 kB
          David Smiley

        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: