[pylucene-dev] Cutomizing Similarities

Pranshu Sharma pranshus at gmail.com
Fri Feb 23 06:28:01 PST 2007


Hi,

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.

One by-pass i have thought of, is to change the source i
PyLucene/cpp/PythonSearch.cpp. instead of returning the correct lengthNorm
value, i would return my custom value. But this seems a crude hack, i am not
even sure wether it will work or not. Anywayz that does not solve my
problem, i still do not have any control over the Similarity functions as I
used to have when i used the JAVA version.

Is there a way to write a customSimilarity class, inherit it from the
DefaultSimilarity class and dynamicaaly allocate what class to use according
to the query type (as in pass it at the search time). If some-one can advise
me on this it would be great.

Though some-one got me really worried, he said that : "as PyLucene being a
gcj compilation of Lucene, we have to write code in java and then re-install
the binaries to get the customizations we need"


regards,
-- 
Pranshu Sharma
==============
everytime i think i have found the key to success, god changes the lock !!
==============
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/pylucene-dev/attachments/20070223/be4025b7/attachment.html


More information about the pylucene-dev mailing list