I'm trying toconvert some of my code over to Solr, but I keep getting class cast exceptions when I try to use my own similarity class, like this:

Caused by: java.lang.ClassCastException: dealcatcher.kolinka.lucene.similarity.T
estSimilarity cannot be cast to org.apache.lucene.search.Similarity
at org.apache.solr.schema.IndexSchema.readConfig(IndexSchema.java:363)
        ... 21 more

Here is TestSimilarity:

package dealcatcher.kolinka.lucene.similarity;

import org.apache.lucene.search.DefaultSimilarity;

public class TestSimilarity extends DefaultSimilarity
{
}

And my schema.xml:


<similarity class="dealcatcher.kolinka.lucene.similarity.TestSimilarity"/>

It works fine if I use:

<similarity class="org.apache.lucene.search.DefaultSimilarity"/>

The jar with my class is located in example/ext, I get a class not found if I put it elsewhere. Should I be locating this jar elsewhere? Do I need to put lucene-nightly in the same directory? I also get a class not found error if lucene isn't located there, which seems strange since solr should be able to find lucene classes without my help.

Reply via email to