lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Jelsma <markus.jel...@openindex.io>
Subject Re: Similarity
Date Mon, 23 May 2011 21:03:02 GMT
Hmm. I don't add code to Apache packages but create my own packages and 
namespaces, build a jar and add it to the lib directory as specified in 
solrconfig. Then you can use the FQCN to in the similarity config to point to 
the class.

May be it can work when messing inside the apache namespace but then you have 
to build Lucene as well.


> Okay well this is encouraging. I changed SweetSpotSimilarity to
> MyClassSimilarity. I created this class in:
> 
> lucene/contrib/misc/src/java/org/apache/lucene/misc/
> 
> I am getting a ClassNotFoundException when I try to start solr.
> 
> Here is the contents of the MyClassSimilarity file:
> 
> package org.apache.lucene.misc;
> import org.apache.lucene.search.DefaultSimilarity;
> 
> public class MyClassSimilarity extends DefaultSimilarity {
>   public MyClassSimilarity() { super(); }
>   public float idf(int a1, int a2) { return 1; }
> }
> 
> So then this raises two questions. Why am I getting a
> classNotFoundException and how can I go about fixing it?
> 
> Thanks,
> 
> Brian Lamb
> 
> On Mon, May 23, 2011 at 3:41 PM, Markus Jelsma
> 
> <markus.jelsma@openindex.io>wrote:
> > As far as i know, SweetSpotSimilarty needs be configured. I did use it
> > once but
> > wrapped a factory around it to configure the sweet spot. It worked just
> > as expected and explained in that paper about the subject.
> > 
> > If you use a custom similarity that , for example, caps tf to 1. Does it
> > then
> > work?
> > 
> > > Hi all,
> > > 
> > > I'm having trouble getting the basic similarity example to work. If you
> > > notice at the bottom of the schema.xml file, there is a line there that
> > 
> > is
> > 
> > > commented out:
> > > 
> > > <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/>
> > > -->
> > > 
> > > I uncomment that line and replace it with the following:
> > > 
> > > <similarity class="org.apache.lucene.misc.SweetSpotSimilarity"/>
> > > 
> > > Which comes natively with lucene. However, the scores before and after
> > > making this change are the same. I did a full import both times but
> > > that didn't seem to help.
> > > 
> > > I ran svn up on both my solr directory and my lucene directory.
> > > Actually, my lucene directory was not previously under svn so I
> > > removed everything in there and did svn co
> > > http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/
> > > 
> > > So why isn't my installation taking the SweetSpot Similarity change?
> > > 
> > > Thanks,
> > > 
> > > Brian Lamb

Mime
View raw message