What version of Solr are you using? Seems to be not quite trunk at least, as IndexSchema.java:449 isn't the the similarity stuff currently).

Does your CustomSimilarity have a no-arg constructor?

        Erik



On Jul 16, 2008, at 9:19 PM, Sébastien Rainville wrote:

Hi,

I'm trying to make solr use my custom similarity class:

import org.apache.lucene.search.DefaultSimilarity;

public class CustomSimilarity extends DefaultSimilarity {
}

but I keep getting this error:

com.example.CustomSimilarity cannot be cast to
org.apache.lucene.search.Similarity
at org.apache.solr.schema.IndexSchema.readConfig(IndexSchema.java: 449)
   ... 28 more

and in schema.xml I have this:
<similarity class="com.example.CustomSimilarity"/>

I even tried to extend Similarity directly just to make sure and it's not working either. It means that it finds the class, it's able to instantiate
it but somehow it's not the right kind of object?!? What am I missing?

Thanks in advance,
Sebastien

Reply via email to