> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Lav
> Sent: Friday, March 16, 2007 8:24 AM
> To: [email protected]
> Subject: Re: [pylucene-dev] why isn't my custom 
> Similarityobjectchangingthebehavior?
> 
> On Thu, Mar 15, 2007 at 07:54:17PM -0500, Pete wrote:
> > On Thursday March 15 2007 6:31 pm, Ofer Nave wrote:
> > 
> > > class SimilaritySansTF(object):
> > ...
> > >     def idf(self, term, searcher):
> > >         return self.super.idf(term, searcher)
> > >
> > >     def idf(self, terms, searcher):
> > >         return self.super.idf(terms, searcher)
> > >
> > >     def idf(self, docFreq, numDocs):
> > >         return self.super.idf(docFreq, numDocs)
> > 
> > > 2) Python doesn't have declared/static types, so how does 
> Java know 
> > > which python idf() method to call?
> 
> Looking at cpp/PythonSearch.cpp, it maps different java 
> overloadings to different method names:
>   jfloat PythonSimilarity::idf(jint docFreq, jint numDocs) -> 
> "idf" method
>   jfloat PythonSimilarity::idf(::java::util::Collection *terms,
>                                
> ::org::apache::lucene::search::Searcher *searcher) -> 
> "idfTerms" method
>   jfloat 
> PythonSimilarity::idf(::org::apache::lucene::index::Term *term,
>                                
> ::org::apache::lucene::search::Searcher *searcher) -> "idfTerm" method
> 
> I've overridden the idfTerm method, and it works for me.

I scanned the README, and there's no mention of the python-side name
remapping.  Is it only possible to discover the python-side names (so that
one can override a specific java method in an overloaded set) by looking at
the .cpp files?

> Andi just checked in the SimilarityDelegator method, which 
> sounds like what you want: see 
> http://lists.osafoundation.org/pipermail/pylucene-dev/2007-Mar
> ch/001595.html
> 
> Hope this helps.
> 
>      Aaron Lav (http://www.pobox.com/~asl2) 

Looks like someone was asking almost the same question is me just a week
before. :)

Props to Andi for getting that fix in so soon.  I'll wait for the next minor
version release, though - makes life a little simpler.  Besides, not having
the Delegator class available to me has forced me to better understand the
art of extending PyLucene.

-ofer

_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to