lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: problems writing a custom Similarity class
Date Sat, 01 Oct 2011 01:39:39 GMT

:   I'm just starting to get into solr development and I want to try writing a
: custom Scoring Class.  I copied the DefaultSimilarity class and renamed it
: I then make  sure my TestSimilarity is always used by editing
: conf/schema.xml to have this line:
: <similarity class="" />
: Scoring seems to still be using an idf score that is not 1 and returning
: results sorted by rareness of a phrase instead of frequency of the word.

1) what version/branch of Solr are you developing against?
2) where did you put that <similarity /> declaration? do you see 
any INFO level log messages from solr on startup that mention 
"TestSimilarity" ?
3) what types of test queries are you running?

The method for configuring Similarity instances has changed a lot in the 
trunk of Solr now that Lucene uses per-field similarity instances, but 
i'm pretty sure having a declaration like that in the "root" of your 
schema.xml should still work for providing a "default" similarity for 
field types that don't override it.

If you "grep -ri similarity solr/core/src/test solr/core/src/test-files" 
you should see some tests (and test configs) demonstrating custom 
similarities in use. (although trunk has a lot more tests because there 
are a lot more out of the box Similarity classes on trunk)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message