Hello Koji, Can't it be done via tokenStrem.reflectWith(AttributeReflector) with reflector which puts all attrs properties into Token via reflection or into AttributeSource? WDYT?
2012/3/20 Koji Sekiguchi <[email protected]> > Is there any general way of getting/looking what attributes a token stream > has? > > I want to use spell checker with a query analyzer, which the analyzer > generates > ReadingAttribute for each tokens, and I want to use the ReadingAttributes > for > spell checking. I think I can have my own SpellingQueryConverter extension > to > override analyze method, but I saw the TODO comment in > SpellingQueryConverter: > > protected void analyze(Collection<Token> result, Reader text, int offset) > throws IOException { > TokenStream stream = analyzer.reusableTokenStream("", text); > // TODO: support custom attributes > CharTermAttribute termAtt = > stream.addAttribute(CharTermAttribute.class); > FlagsAttribute flagsAtt = stream.addAttribute(FlagsAttribute.class); > TypeAttribute typeAtt = stream.addAttribute(TypeAttribute.class); > PayloadAttribute payloadAtt = > stream.addAttribute(PayloadAttribute.class); > PositionIncrementAttribute posIncAtt = > stream.addAttribute(PositionIncrementAttribute.class); > OffsetAttribute offsetAtt = stream.addAttribute(OffsetAttribute.class); > : > > If we can have a general way of getting such information, I think it would > be helpful > not only for spell checking. (For example, SynonymFilter can add > PartOfSpeechAttribute > if the original token has.) > > koji > -- > Query Log Visualizer for Apache Solr > http://soleami.com/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Sincerely yours Mikhail Khludnev Lucid Certified Apache Lucene/Solr Developer Grid Dynamics <http://www.griddynamics.com> <[email protected]>
