lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Hebnes Pedersen <martinhpeder...@easyconnect.no>
Subject Re: [lucy-user] Subclassing Lucy::Analysis::Analyzer
Date Tue, 03 Jul 2012 07:58:54 GMT
On 02. juli 2012 22:00, Marvin Humphrey wrote:
> On Mon, Jul 2, 2012 at 8:22 AM, Marvin Humphrey<marvin@rectangular.com>  wrote:
>> On Mon, Jul 2, 2012 at 6:31 AM, Martin Hebnes Pedersen
>> <martinhpedersen@easyconnect.no>  wrote:
>>> So far I've overridden 'new' and 'transform' and indexing seems to work.
>>>
>>> The problem is that I need some parameters like minLength, but they are not
>>> in schema_x.json and My::Analysis::EdgeNGramTokenizer's contructor is never
>>> called when I load the IndexSearcher.
>>>
>>> I have tried to override dump and load, but that only results in segfaults.
>> I've investigated a bit, and it seems that while overriding dump() works,
>> overriding load() fails.
>> I'll look deeper and get back to you.
> The problem should be fixed by commit r1356440.
>
>    http://svn.apache.org/viewvc?view=revision&revision=1356440
>    svn diff -c 1356440 http://svn.apache.org/repos/asf/lucy/trunk
>
> You will also need to override equals() in your Analyzer subclass:
>
>    sub equals {
>      my ($self, $other) = @_;
>      return 0 unless $other;
>      return 0 unless ref($self) eq ref($other);
>      return 0 unless $min_length{$$self} == $min_length{$$other};
>      return $self->SUPER::equals($other);
>    }
>
> Marvin Humphrey
I can confirm that this fixed the problems we were having.

Thank you for your fast response and fix, hopefully we can contribute 
back by putting these analyzers on cpan when ready :)

--
Martin Hebnes Pedersen
Easy Connect AS


Mime
View raw message