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

Add CachingTokenFilter.isCached and switch LinkedList to ArrayList

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      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

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: