Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: modules/analysis
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      I needed CharArraySet.clear() for something I was working on in Solr in a tokenstream.

      instead I ended up using CharArrayMap<Boolean> because it supported .clear()

      it would be better to use a set though, currently it will throw UOE for .clear() because AbstractSet will call iterator.remove() which throws UOE.

      In Solr, the very similar CharArrayMap.clear() looks like this:

        @Override
        public void clear() {
          count = 0;
          Arrays.fill(keys,null);
          Arrays.fill(values,null);
        }
      

      I think we can do a similar thing as long as we throw UOE for the UnmodifiableCharArraySet

      will submit a patch later tonight (unless someone is bored and has nothing better to do)

      1. LUCENE-2179.patch
        2 kB
        Uwe Schindler

        Activity

        Hide
        Uwe Schindler added a comment -

        Patch for clear() and modified test. The test already checks, that the unmodifiable set cannot be cleared.

        Show
        Uwe Schindler added a comment - Patch for clear() and modified test. The test already checks, that the unmodifiable set cannot be cleared.
        Hide
        Simon Willnauer added a comment -

        patch looks good uwe! +1 from my side

        Show
        Simon Willnauer added a comment - patch looks good uwe! +1 from my side
        Hide
        Uwe Schindler added a comment -

        I will commit this together with LUCENE-2169.

        Show
        Uwe Schindler added a comment - I will commit this together with LUCENE-2169 .
        Hide
        Uwe Schindler added a comment -

        For this to work, in BW branch the clear() test will be disabled.

        Show
        Uwe Schindler added a comment - For this to work, in BW branch the clear() test will be disabled.
        Hide
        Uwe Schindler added a comment -

        Committed revision: 893655

        Show
        Uwe Schindler added a comment - Committed revision: 893655

          People

          • Assignee:
            Uwe Schindler
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development