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.

Andi just checked in the SimilarityDelegator method, which sounds
like what you want: see 
http://lists.osafoundation.org/pipermail/pylucene-dev/2007-March/001595.html

Hope this helps.

     Aaron Lav (http://www.pobox.com/~asl2)
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to