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

Fix AttributeSource.toString()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.6, 6.0
    • None
    • None
    • New

    Description

      Its currently just Object.toString, e.g.:

      org.apache.lucene.analysis.en.PorterStemFilter@8a32165c

      But I think we should make it more useful, to end users trying to see what their chain is doing, and to make SOPs easier when debugging:

      EnglishAnalyzer analyzer = new EnglishAnalyzer(TEST_VERSION_CURRENT);
      try (TokenStream ts = analyzer.tokenStream("body", "Its 2013, let's fix this already!")) {
        ts.reset();
        while (ts.incrementToken()) {
          System.out.println(ts.toString());
        }
        ts.end();
      }
      

      Proposed output:

      PorterStemFilter@8a32165c term=it,bytes=[69 74],startOffset=0,endOffset=3,positionIncrement=1,type=<ALPHANUM>,keyword=false
      PorterStemFilter@987b9eea term=2013,bytes=[32 30 31 33],startOffset=4,endOffset=8,positionIncrement=1,type=<NUM>,keyword=false
      PorterStemFilter@6b5dbd1f term=let,bytes=[6c 65 74],startOffset=10,endOffset=15,positionIncrement=1,type=<ALPHANUM>,keyword=false
      PorterStemFilter@45cbde1b term=fix,bytes=[66 69 78],startOffset=16,endOffset=19,positionIncrement=1,type=<ALPHANUM>,keyword=false
      PorterStemFilter@bcd8f627 term=alreadi,bytes=[61 6c 72 65 61 64 69],startOffset=25,endOffset=32,positionIncrement=2,type=<ALPHANUM>,keyword=false
      

      Attachments

        1. LUCENE-5275.patch
          0.5 kB
          Robert Muir
        2. LUCENE-5275.patch
          0.5 kB
          Robert Muir

        Activity

          People

            Unassigned Unassigned
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: