[ https://issues.apache.org/jira/browse/LUCENE-5275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13791857#comment-13791857 ]
Uwe Schindler commented on LUCENE-5275: --------------------------------------- The hasCode of TokenStream is the default hashCode of Object, which is identityHashCode(). This is why I said: make toString(), equals(), hashCode() final in TokenStream, because it makes absolutely no sense to compare tokenstreams. identityHashCode is defined as: "Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode(). The hash code for the null reference is zero." > Fix AttributeSource.toString() > ------------------------------ > > Key: LUCENE-5275 > URL: https://issues.apache.org/jira/browse/LUCENE-5275 > Project: Lucene - Core > Issue Type: Bug > Reporter: Robert Muir > Attachments: LUCENE-5275.patch, LUCENE-5275.patch > > > 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: > {code} > 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(); > } > {code} > Proposed output: > {noformat} > 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 > {noformat} -- This message was sent by Atlassian JIRA (v6.1#6144) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org