Bruno Albuquerque wrote on 3/5/17 10:26 AM:
Resurrecting a very old topic.

It turns out I managed to do this to create a "new" analyzer it it has been
working flawlessly. Recently I saw the need to add attributes to my
analyzer (more specifically, I need to pass  a language to it).

My first attempt was to use the same method to subclass EasyAnalyzer
instead of Analyzer (basically replacing ANALYZER by EASYANALYZER and
adapting everything else as needed) to use the fact that EasyAnalyzer
already has a language field, but this did not work (i.e. my overridden
transform method was never called and the EasyAnalyzer one was being called
instead).

So, my question is: Using the trick of overriding specific methods form
Analyzer during runtime, is there a way I can also create my own ivars and
attach it to my overriden analyzer?

While we are at this, this is all Lucy 0.4.2 (yeah, I know, old) and I am
considering moving to the latest version mostly due to the now included
golang bindings. I didn't look a lot at the golang bindings yet but will it
be possible to create a new analyzer in a non-hackish way and entirely in
go using it?


Assuming you are doing this in Perl, there was documentation added recently on how to do this:

https://github.com/apache/lucy/commit/040bb290f12f8df015b1d9ae99758f1600a52f18#diff-3bbd01088ea5a113c55f839852dfba1fR62

You need to use the inside-out object pattern.

I'm not sure about the corresponding way to do this in C or other host 
languages.

--
Peter Karman  .  https://peknet.com/  .  https://keybase.io/peterkarman

Reply via email to