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

Add reflection API to AttributeSource/AttributeImpl

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.1, 4.0-ALPHA
    • modules/analysis
    • None
    • New, Patch Available

    Description

      AttributeSource/TokenStream inspection in Solr needs to have some insight into the contents of AttributeImpls. As LUCENE-2302 has some problems with toString() [which is not structured and conflicts with CharSequence's definition for CharTermAttribute], I propose an simple API that get a default implementation in AttributeImpl (just like toString() current):

      • Iterator<Map.Entry<String,?>> AttributeImpl.contentsIterator() returns an iterator (for most attributes its a singleton) of a key-value pair, e.g. "term">"foobar","startOffset">Integer.valueOf(0),...
      • AttributeSource gets the same method, it just concat the iterators of each getAttributeImplsIterator() AttributeImpl

      No backwards problems occur, as the default toString() method will work like before (it just gets iterator and lists), but we simply remove the documentation for the format. (Char)TermAttribute gets a special impl fo toString() according to CharSequence and a corresponding iterator.

      I also want to remove the abstract hashCode() and equals() methods from AttributeImpl, as they are not needed and just create work for the implementor.

      Attachments

        1. LUCENE-2374.patch
          78 kB
          Uwe Schindler
        2. LUCENE-2374.patch
          78 kB
          Uwe Schindler
        3. LUCENE-2374.patch
          77 kB
          Uwe Schindler
        4. LUCENE-2374-3x.patch
          81 kB
          Uwe Schindler
        5. LUCENE-2374-3x.patch
          79 kB
          Uwe Schindler
        6. LUCENE-2374-3x.patch
          62 kB
          Uwe Schindler
        7. LUCENE-2374-3x.patch
          52 kB
          Uwe Schindler
        8. LUCENE-2374-3x.patch
          33 kB
          Uwe Schindler
        9. LUCENE-2374-3x.patch
          18 kB
          Uwe Schindler
        10. shot1.png
          163 kB
          Uwe Schindler
        11. shot2.png
          141 kB
          Uwe Schindler
        12. shot3.png
          134 kB
          Uwe Schindler
        13. shot4.png
          137 kB
          Uwe Schindler

        Issue Links

          Activity

            People

              uschindler Uwe Schindler
              uschindler Uwe Schindler
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: