:    I would like to alter the similarity behaviour of solr to remove
: the fieldnorm factor in  the similarity calculations. As far as I
: read, I need to recreate my own similarity class and import it into
: solr using the <similarity> config in schema.xml.
:
:    Has anybody already tweaked or played with this topic, and might
: give me some code or advices ?

as you're already noticed, you can specify the Similarity class at runtime
via the schema.xml -- the only Solr specific aspect of this making sure
your Similarity class is in your servlet containers classpath (exactly how
you do this depends on your servlet container)

searching the java-dev and java-user Lucene mailing lists is the best bet
for finding discussions on writing your own similarity, there are also
some examples in the main Lucene code base...

contrib/miscellaneous/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java
src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java

...if your main interest is just eliminating norms, there is a special
option for that in Lucene Fields called "Omit Norms" (it not only
eliminates the effects of norms on scoring, but it saves space in your
index as well) in Solr you can turn it on/off per <field> or <fieldtype>
using the omitNorms="true" option in the schema.xml



-Hoss

Reply via email to