lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvakumar netaji <vvekselva...@gmail.com>
Subject Re: Apache Lucene Analysis
Date Fri, 05 Oct 2012 14:24:19 GMT
Hi All,


In the TokenStreamAPI section  of the analysis documentation for lucene 4.0
beta, MyAnalyzer class is defined.

They've added the lengthFilter in the create components method. The length
filter doesn't accept method with three arguments in 4.0. Should I create a
length filter class for this tutorial, but the ambiguity is there's a
length filter defined in the analysis package.

Can you please correct me if I'm wrong.






On Fri, Oct 5, 2012 at 5:10 PM, selvakumar netaji <vvekselva.gm@gmail.com>wrote:

> Actually I'm getting results if I add it to the tokenStream instance.
>
>
> Can you please inform is it right?
>
>
> Thanks in advance.
>
>
>
> On Fri, Oct 5, 2012 at 5:02 PM, selvakumar netaji <vvekselva.gm@gmail.com>wrote:
>
>> Hi All,
>>
>>
>> I'm reading the docs of Apache Lucene.
>>
>> I just read through the docs of the analyser
>> docs/core/org/apache/lucene/analysis/package-summary.html.
>>
>>
>> Here they have given a code snippet,I've ambiguities in the add attribute
>> method. Should it be added to the token stream instance?
>>
>>  Version matchVersion = Version.LUCENE_XY; // Substitute desired Lucene version for
XY
>>     Analyzer analyzer = new StandardAnalyzer(matchVersion); // or any other analyzer
>>     TokenStream ts = analyzer.tokenStream("myfield", new StringReader("some text
goes here"));
>>     OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
>>
>>     try {
>>       ts.reset(); // Resets this stream to the beginning. (Required)
>>       while (ts.incrementToken()) {
>>         // Use AttributeSource.reflectAsString(boolean)
>>         // for token stream debugging.
>>         System.out.println("token: " + ts.reflectAsString(true));
>>
>>         System.out.println("token start offset: " + offsetAtt.startOffset());
>>         System.out.println("  token end offset: " + offsetAtt.endOffset());
>>       }
>>       ts.end();   // Perform end-of-stream operations, e.g. set the final offset.
>>     } finally {
>>       ts.close(); // Release resources associated with this stream.
>>     }
>>
>>
>>
>>
>>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message