You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucy.apache.org by Knut Arne Bjørndal <kn...@easyconnect.no> on 2017/05/15 10:51:56 UTC

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

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: knut.arne.bjorndal@easyconnect.no


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

Posted by Nick Wellnhofer <we...@aevum.de>.
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