lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralf Bierig <ralf.bie...@gmail.com>
Subject MyAnalyzer and Lucene version <= 4.9.1
Date Tue, 28 Oct 2014 14:06:32 GMT
How to write an own Analyzer in Lucene <= 4.9.1?

Here my code, somehow the method tokenStream is not final and cannot be 
extended any more. How is one supposed to extend it?

--- code ---
class PayloadAnalyzer extends Analyzer {
     private PayloadEncoder encoder;

     PayloadAnalyzer(PayloadEncoder encoder) {
         this.encoder = encoder;
     }

     public TokenStream tokenStream(String fieldName, Reader reader) {
         TokenStream result = new WhitespaceTokenizer(reader);
         result = new LowerCaseFilter(result);
         result = new DelimitedPayloadTokenFilter(result, '|', encoder);
         return result;
     }
}
--- end of code ---

Best,
Ralf

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message