You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de> on 2008/10/28 11:33:34 UTC

Override Similarity

Hello,

is there a chance to override the Similarity in my search ?
In fact I want that all result return a 1 (with the idf methode).

Greets -Ralf-

Re: Override Similarity

Posted by Walter Underwood <wu...@netflix.com>.
I'm curious, why do you want to disable idf? --wunder

On 10/28/08 5:37 AM, "Erik Hatcher" <er...@ehatchersolutions.com> wrote:

> 
> On Oct 28, 2008, at 6:33 AM, Kraus, Ralf | pixelhouse GmbH wrote:
>> is there a chance to override the Similarity in my search ?
>> In fact I want that all result return a 1 (with the idf methode).
> 
> Sure thing, see Solr 1.3.0's example/solr/conf/schema.xml....
> 
>   <!-- Similarity is the scoring routine for each document vs. a query.
>        A custom similarity may be specified here, but the default is
> fine
>        for most applications.  -->
>   <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/
>> -->
>   <!-- ... OR ...
>        Specify a SimilarityFactory class name implementation
>        allowing parameters to be used.
>   -->
>   <!--
>   <similarity class="com.example.solr.CustomSimilarityFactory">
>     <str name="paramkey">param value</str>
>   </similarity>
>   -->
> 
> 
> 


Re: Override Similarity

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Oct 28, 2008, at 6:33 AM, Kraus, Ralf | pixelhouse GmbH wrote:
> is there a chance to override the Similarity in my search ?
> In fact I want that all result return a 1 (with the idf methode).

Sure thing, see Solr 1.3.0's example/solr/conf/schema.xml....

  <!-- Similarity is the scoring routine for each document vs. a query.
       A custom similarity may be specified here, but the default is  
fine
       for most applications.  -->
  <!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/ 
 > -->
  <!-- ... OR ...
       Specify a SimilarityFactory class name implementation
       allowing parameters to be used.
  -->
  <!--
  <similarity class="com.example.solr.CustomSimilarityFactory">
    <str name="paramkey">param value</str>
  </similarity>
  -->




Re: Override Similarity

Posted by "Kraus, Ralf | pixelhouse GmbH" <rk...@pixelhouse.de>.
Rafał Kuć schrieb:
> Hello!
>
>    You can do it, by extending the DefaultSimilarity class from
> org.apache.lucene.search package. After that, You need to add one line
> to schema.xml file, which might look like this:
>
> <similarity class="com.company.CustomSimilarity" />
>
> After that, Solr will recognize Your new similarity class and will use
> it to compute score.
>
>   
thx ! Runs perfect ....

Greets

Re: Override Similarity

Posted by Rafał Kuć <ra...@alud.com.pl>.
Hello!

   You can do it, by extending the DefaultSimilarity class from
org.apache.lucene.search package. After that, You need to add one line
to schema.xml file, which might look like this:

<similarity class="com.company.CustomSimilarity" />

After that, Solr will recognize Your new similarity class and will use
it to compute score.

-- 
Regards,
 Rafał Kuć