Hi I'm implementing a custom normalization analyzer and it would be convenient to let it inherit from the default implementation, but I'm having trouble with the serialization and deserialization.
I override dump to add some extra data to the serialized object, which
seems to be the part with the problem.
Minimal test case:
package My::Normalizer;
use base qw( Lucy::Analysis::Normalizer );
sub dump {
shift->SUPER::dump(@_);
}
1;
Adding this to a schema causes an exception to be throw when the schema
is deserialized:
Can't downcast from Lucy::Object::CharBuf to Lucy::Object::BoolNum
lucy_Normalizer_load at .../Normalizer.c line 151
at /usr/lib/perl5/Lucy.pm line 239
Lucy::Index::Indexer::new('Lucy::Index::Indexer', 'index',
'index.1246/', 'schema', 'Lucy::Plan::Schema=SCALAR(0x2e4fc90)',
'create', 1)
Looking at schema.json a Lucy::Analysis::Normalizer is serialized to:
{
"_class": "Lucy::Analysis::Normalizer",
"case_fold": true,
"normalization_form": "NFKC",
"strip_accents": false
},
while my subclassed instance is serialized to:
{
"_class": "My::Normalizer",
"case_fold": "1",
"normalization_form": "NFKC",
"strip_accents": "0"
},
So it looks like the serializer doesn't correctly handle boolean values
when called from perl?
--
Knut Arne Bjørndal, Tekniker Easy Connect AS - http://1890.no
E-post: [email protected]
signature.asc
Description: OpenPGP digital signature
