You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dmitry Kan <so...@gmail.com> on 2013/02/14 13:40:57 UTC
MockAnalyzer in Lucene: attach stemmer or any custom filter?
Hello,
Asked a question on SO:
http://stackoverflow.com/questions/14873207/mockanalyzer-in-lucene-attach-stemmer-or-any-custom-filter
Is there a way to configure a stemmer or a custom filter with the
MockAnalyzer class?
Version: LUCENE_34
Dmitry
Re: MockAnalyzer in Lucene: attach stemmer or any custom filter?
Posted by Dmitry Kan <so...@gmail.com>.
Amazing. Thanks!
On Fri, Feb 15, 2013 at 7:07 PM, Robert Muir <rc...@gmail.com> wrote:
> For 3.4, extend ReusableAnalyzerBase
>
> On Fri, Feb 15, 2013 at 12:06 PM, Dmitry Kan <so...@gmail.com> wrote:
> > Thanks a lot, Robert.
> >
> > I need to study a bit more closely the link you have sent. I have tried
> to
> > override the Analyzer class, but couldn't find a method
> createComponents(String
> > fieldName,Reader reader) in LUCENE_34. Instead, there is a method
> required
> > to override: tokenStream(String fieldName, Reader reader). Is there a way
> > of incorporating the custom filter into the TokenStream?
> >
> >
> > Dmitry
> >
> > On Thu, Feb 14, 2013 at 5:37 PM, Robert Muir <rc...@gmail.com> wrote:
> >
> >> MockAnalyzer is really just MocKTokenizer+MockTokenFilter+....
> >>
> >> Instead you just define your own analyzer chain using MockTokenizer.
> >> This is the way all lucene's own analysis tests work: e.g.
> >>
> >>
> http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/en/TestEnglishMinimalStemFilter.java
> >>
> >> On Thu, Feb 14, 2013 at 7:40 AM, Dmitry Kan <so...@gmail.com>
> wrote:
> >> > Hello,
> >> >
> >> > Asked a question on SO:
> >> >
> >> >
> >>
> http://stackoverflow.com/questions/14873207/mockanalyzer-in-lucene-attach-stemmer-or-any-custom-filter
> >> >
> >> > Is there a way to configure a stemmer or a custom filter with the
> >> > MockAnalyzer class?
> >> > Version: LUCENE_34
> >> >
> >> > Dmitry
> >>
>
Re: MockAnalyzer in Lucene: attach stemmer or any custom filter?
Posted by Robert Muir <rc...@gmail.com>.
For 3.4, extend ReusableAnalyzerBase
On Fri, Feb 15, 2013 at 12:06 PM, Dmitry Kan <so...@gmail.com> wrote:
> Thanks a lot, Robert.
>
> I need to study a bit more closely the link you have sent. I have tried to
> override the Analyzer class, but couldn't find a method createComponents(String
> fieldName,Reader reader) in LUCENE_34. Instead, there is a method required
> to override: tokenStream(String fieldName, Reader reader). Is there a way
> of incorporating the custom filter into the TokenStream?
>
>
> Dmitry
>
> On Thu, Feb 14, 2013 at 5:37 PM, Robert Muir <rc...@gmail.com> wrote:
>
>> MockAnalyzer is really just MocKTokenizer+MockTokenFilter+....
>>
>> Instead you just define your own analyzer chain using MockTokenizer.
>> This is the way all lucene's own analysis tests work: e.g.
>>
>> http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/en/TestEnglishMinimalStemFilter.java
>>
>> On Thu, Feb 14, 2013 at 7:40 AM, Dmitry Kan <so...@gmail.com> wrote:
>> > Hello,
>> >
>> > Asked a question on SO:
>> >
>> >
>> http://stackoverflow.com/questions/14873207/mockanalyzer-in-lucene-attach-stemmer-or-any-custom-filter
>> >
>> > Is there a way to configure a stemmer or a custom filter with the
>> > MockAnalyzer class?
>> > Version: LUCENE_34
>> >
>> > Dmitry
>>
Re: MockAnalyzer in Lucene: attach stemmer or any custom filter?
Posted by Dmitry Kan <so...@gmail.com>.
Thanks a lot, Robert.
I need to study a bit more closely the link you have sent. I have tried to
override the Analyzer class, but couldn't find a method createComponents(String
fieldName,Reader reader) in LUCENE_34. Instead, there is a method required
to override: tokenStream(String fieldName, Reader reader). Is there a way
of incorporating the custom filter into the TokenStream?
Dmitry
On Thu, Feb 14, 2013 at 5:37 PM, Robert Muir <rc...@gmail.com> wrote:
> MockAnalyzer is really just MocKTokenizer+MockTokenFilter+....
>
> Instead you just define your own analyzer chain using MockTokenizer.
> This is the way all lucene's own analysis tests work: e.g.
>
> http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/en/TestEnglishMinimalStemFilter.java
>
> On Thu, Feb 14, 2013 at 7:40 AM, Dmitry Kan <so...@gmail.com> wrote:
> > Hello,
> >
> > Asked a question on SO:
> >
> >
> http://stackoverflow.com/questions/14873207/mockanalyzer-in-lucene-attach-stemmer-or-any-custom-filter
> >
> > Is there a way to configure a stemmer or a custom filter with the
> > MockAnalyzer class?
> > Version: LUCENE_34
> >
> > Dmitry
>
Re: MockAnalyzer in Lucene: attach stemmer or any custom filter?
Posted by Robert Muir <rc...@gmail.com>.
MockAnalyzer is really just MocKTokenizer+MockTokenFilter+....
Instead you just define your own analyzer chain using MockTokenizer.
This is the way all lucene's own analysis tests work: e.g.
http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/en/TestEnglishMinimalStemFilter.java
On Thu, Feb 14, 2013 at 7:40 AM, Dmitry Kan <so...@gmail.com> wrote:
> Hello,
>
> Asked a question on SO:
>
> http://stackoverflow.com/questions/14873207/mockanalyzer-in-lucene-attach-stemmer-or-any-custom-filter
>
> Is there a way to configure a stemmer or a custom filter with the
> MockAnalyzer class?
> Version: LUCENE_34
>
> Dmitry