[pylucene-dev] Cutomizing Similarities
Andi Vajda
vajda at osafoundation.org
Fri Feb 23 22:25:51 PST 2007
On Fri, 23 Feb 2007, Pranshu Sharma wrote:
> I have been trying to customize the similarity function in Lucene (the
> primary objective was to shut off the lengthNorm factor in Similarity
> Class). I was unsuccessful in it, then i got a couple of archived mails on
> this mailing lists. I got a fair idea, but I am still not so sure how to
> proceed in the PyLucene-2.0 version.
Similarity can be implemented in Python by creating a Python class that
implements the Similarity methods (the native methods declared in [1]).
You can pass instances of this class to any Lucene API expecting a Similarity
instance. PyLucene will wrap this instance with a Java instance of
PythonSimilarity [1], the actual Similarity Java subclass visible to Lucene,
but which calls into your Python implementation class.
For examples see:
- test/test_Similarity.py
- samples/LuceneInAction/lia/searching/ScoreTest.py
Andi..
[1] http://svn.osafoundation.org/pylucene/trunk/java/org/osafoundation/search/PythonSimilarity.java
More information about the pylucene-dev
mailing list