Hi Robert and Manuel.

The DefaultSimilarity indeed sets discountOverlap to true by default.
BUT, the *factory*, aka DefaultSimilarityFactory, when called by
IndexSchema (the getSimilarity method), explicitly sets this value to the
value of its corresponding class member.
This class member is initialized to be FALSE  when the instance is created
(like every boolean variable in the world). It should be set when "init"
method is called. If the parameter is not set in schema.xml, the default is
true.

Everything seems to be alright, but the issue is that "init" method is NOT
called, if the similarity is not *explicitly* declared in schema.xml. In
that case, init method is not called, the discountOverlaps member (of the
factory class) remains FALSE, and getSimilarity explicitly calls
setDiscountOverlaps with value of FALSE.

This is very easy to reproduce and debug.


On Mon, Dec 9, 2013 at 9:19 PM, Robert Muir <rcm...@gmail.com> wrote:

> no, its turned on by default in the default similarity.
>
> as i said, all that is necessary is to fix your analyzer to emit the
> proper position increments.
>
> On Mon, Dec 9, 2013 at 12:27 PM, Manuel Le Normand
> <manuel.lenorm...@gmail.com> wrote:
> > In order to set discountOverlaps to true you must have added the
> > <similarity class="solr.DefaultSimilarityFactory"> to the schema.xml,
> which
> > is commented out by default!
> >
> > As by default this param is false, the above situation is expected with
> > correct positioning, as said.
> >
> > In order to fix the field norms you'd have to reindex with the similarity
> > class which initializes the param to true.
> >
> > Cheers,
> > Manu
>

Reply via email to