Re: Inserting a filter into an Analyzer

Michael Sokolov <[email protected]> Wed, 13 Aug 2025 13:03:35 -0400
Newsgroups gmane.comp.jakarta.lucene.user
Message-ID <CAGUSZHB_AjhrDd_aer1dWTMOUp==Ca_ywpEnynsZw_WnGYTi3w@mail.gmail.com>
have a look at FreeTextSuggester.addShingles, which demonstrates an
example of exactly what you are asking about - creates an
AnalyzerWrapper that appends a TokenFilter to the TokenStream returned
by the wrapped analyzer

On Wed, Aug 13, 2025 at 12:09=E2=80=AFPM Viliam =C4=8Eurina <viliam.durina@=
gmail.com> wrote:
>
> Hi all,
>
> I'm trying to figure out how to wrap an Analyzer instance and inject a
> TokenFilter at the end of its filtering chain. I couldn't find a working
> combination, including by using AnalyzerWrapper. The only way that worked
> is copying the original analyzer code and modifying it. However, in my ca=
se
> the Analyzer is user-supplied and I don't have control over it.
>
> Could you hint me on a way how to do this?
>
> Thanks,
> Viliam