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 Re: MyAnalyzer and Lucene version <= 4.9.1
Date Tue, 28 Oct 2014 16:22:59 GMT
Thanks a lot! :)

Ralf

On 28.10.2014 16:12, Uwe Schindler wrote:
> Hi,
>
> You have to implement createComponents(). The old way of Lucene 3 does no longer work
because Analyzers have to provide reusable TokenStreams.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
>> -----Original Message-----
>> From: Ralf Bierig [mailto:ralf.bierig@gmail.com]
>> Sent: Tuesday, October 28, 2014 3:07 PM
>> To: Lucene User List
>> Subject: MyAnalyzer and Lucene version <= 4.9.1
>>
>> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
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