[lucy-user] Survey: How do you subclass/extend Lucy from Perl?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Nick Wellnhofer
Greetings, Lucy users!

The Lucy developers plan to rework Lucy's subclassing mechanism to support
more host languages and to make it easier to use from Perl. We hope that
you'll soon be able to write Lucy subclasses based on hashrefs instead of
inside-out objects. While this entails slight API changes, we're trying to
make the transition as painless as possible.

So far, Lucy allows to subclass any of its classes from Perl. This is a
powerful feature, but it makes it hard for us to track which classes are
actually extended by users. In the future, we're trying to stick more closely
to the rule formulated by Joshua Bloch in his book "Effective Java":

 > Design and document for inheritance or else prohibit it.

You can help by telling us which Lucy classes you extend from Perl. Here are
some of the candidates:

- Lucy::Analysis::Analyzer
- Lucy::Highlight::Highlighter
- Lucy::Index::IndexManager
- Lucy::Index::Similarity
- Lucy::Search::Query, Lucy::Search::Compiler, and Lucy::Search::Matcher
- Lucy::Search::QueryParser

We're particularly interested if you're extending classes *not* listed above.
If you're subclassing IndexManager for other purposes than NoMergeManager and
LightMergeManager as described in Lucy::Docs::Cookbook::FastUpdates, we'd also
like to know.

If you know of Lucy users with interesting setups who might not be subscribed
to this list, please point them to this survey.

I'll start with the classes that I subclassed as a user of Lucy's Perl bindings:

- Lucy::Analysis::Analyzer
- Lucy::Index::IndexManager (as LightMergeManager)
- Lucy::Index::Similarity

Thanks in advance for taking the time,
Nick

Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Peter Karman
Nick Wellnhofer wrote on 3/12/17 8:53 AM:

> You can help by telling us which Lucy classes you extend from Perl. Here are
> some of the candidates:
>
> - Lucy::Search::Query, Lucy::Search::Compiler, and Lucy::Search::Matcher


https://github.com/karpet?tab=repositories&q=lucyx+query

There ^^ are three examples, 2 of which are in active use in Dezi as part of
https://github.com/karpet/search-query-dialect-lucy-perl


--
Peter Karman  .  https://peknet.com/  .  https://keybase.io/peterkarman
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Kieron Taylor
Hi Peter,

Are your search-wildcard extensions any more than a toy example? I found myself in need of such functionality recently, but not the time to develop an extension.

Needless to say I have not extended the Perl classes myself.

Regards,

Kieron


Kieron Taylor PhD.
Ensembl Developer

EMBL, European Bioinformatics Institute






> On 15 Mar 2017, at 03:54, Peter Karman <[hidden email]> wrote:
>
> Nick Wellnhofer wrote on 3/12/17 8:53 AM:
>
>> You can help by telling us which Lucy classes you extend from Perl. Here are
>> some of the candidates:
>>
>> - Lucy::Search::Query, Lucy::Search::Compiler, and Lucy::Search::Matcher
>
>
> https://github.com/karpet?tab=repositories&q=lucyx+query
>
> There ^^ are three examples, 2 of which are in active use in Dezi as part of
> https://github.com/karpet/search-query-dialect-lucy-perl
>
>
> --
> Peter Karman  .  https://peknet.com/  .  https://keybase.io/peterkarman

Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Peter Karman
Kieron Taylor wrote on 3/15/17 5:20 AM:
> Hi Peter,
>
> Are your search-wildcard extensions any more than a toy example? I found
> myself in need of such functionality recently, but not the time to develop an
> extension.
>


Definitely more than toys. I've been running them in production for 4+ years.


--
Peter Karman  .  https://peknet.com/  .  https://keybase.io/peterkarman
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Peter Karman
In reply to this post by Kieron Taylor
Kieron Taylor wrote on 3/15/17 5:20 AM:

> Are your search-wildcard extensions any more than a toy example? I found
> myself in need of such functionality recently, but not the time to develop an
> extension.
>

I should also add: if you want easy use of wildcards, proximity operators,
ranges, and other query-parsing niceties, switch your code from the Lucy
QueryParser to
https://metacpan.org/pod/Search::Query::Dialect::Lucy


--
Peter Karman  .  https://peknet.com/  .  https://keybase.io/peterkarman
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Knut Arne Bjørndal
In reply to this post by Nick Wellnhofer
Hi

On 12/03/17 14:53, Nick Wellnhofer wrote:

> You can help by telling us which Lucy classes you extend from Perl. Here
> are some of the candidates:
>
> - Lucy::Analysis::Analyzer
> - Lucy::Highlight::Highlighter
> - Lucy::Index::IndexManager
> - Lucy::Index::Similarity
> - Lucy::Search::Query, Lucy::Search::Compiler, and Lucy::Search::Matcher
> - Lucy::Search::QueryParser
>
> We're particularly interested if you're extending classes *not* listed
> above. If you're subclassing IndexManager for other purposes than
> NoMergeManager and LightMergeManager as described in
> Lucy::Docs::Cookbook::FastUpdates, we'd also like to know.
In addition to some of those mentioned (Analyzer, QueryParser, Query,
Compiler, Matcher) we are subclassing Analyzer::Normalizer and
PolyQuery/PolyMatcher.

The PolyQuery/PolyMatcher implementation is to get custom scoring (we
need max(), not sum()), and iirc subclassing ORQuery/ORMatcher turned
out to be problematic, so I ended up basing in on Poly* instead.

--
Knut Arne Bjørndal, Tekniker Easy Connect AS - http://1890.no
E-post: [hidden email]


signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Survey: How do you subclass/extend Lucy from Perl?

Nick Wellnhofer
On 15/05/2017 12:51, Knut Arne Bjørndal wrote:
> In addition to some of those mentioned (Analyzer, QueryParser, Query,
> Compiler, Matcher)

Which QueryParser methods do you override?

> we are subclassing Analyzer::Normalizer and
> PolyQuery/PolyMatcher.

How and why do you subclass Normalizer? Would it be possible for you to write
a separate Analyzer instead that creates its own Normalizer (composition vs.
inheritance)?

> The PolyQuery/PolyMatcher implementation is to get custom scoring (we
> need max(), not sum()), and iirc subclassing ORQuery/ORMatcher turned
> out to be problematic, so I ended up basing in on Poly* instead.

Do you reimplement ORQuery and all related classes in Perl just to get a
custom Score method for ORScorer? Or you do somehow delegate to the ORQuery
classes? To make custom scoring easier, we'd probably need something like a
Scorer class that could be attached to a Query.

Nick