Sunday, April 1, 2018

FW: MatchMode in Dismax parser

-----Original Message-----
From: Shawn Heisey [mailto:apache@elyograg.org]
Sent: 29 March 2018 20:31
To: solr-user@lucene.apache.org
Subject: Re: MatchMode in Dismax parser

On 3/29/2018 1:42 AM, iamluckysharma.0910@gmail.com wrote:
> Just a suggestion , Shouldn't we need to use Math.round instead of
> direct int when watch mode is in %, example i have 3 boolean clauses
> if i go for mm=50%, currently it reduce it to ~1, instead it can be
> ~2,
>
> another example could be when we have 5 boolean clauses and mm=75%, we
> get calc as 3.75 currently it took 3, so instead of 3 it should have
> taken 4. as Math.round()

Maybe that is what it SHOULD do, but in most languages, converting a float
value to an integer truncates the decimal portion, it doesn't round.  To do
that requires a deliberate choice in the code, and that probably doesn't
exist in dismax/edismax.  If your assertion is that this should have been
done from day one, I'd say you're right.  But that decision is now ancient
history.  The person who wrote the code might have had a very good reason to
NOT do it that way.

At this point, if the functionality were changed, it would result in an
upgraded Solr version behaving VERY differently than the previous version. 
While new functionality is often added in any new minor release, changing
existing behavior that users rely on without a configuration option is
usually only done in a major version.  So for 7.x, dismax/edismax would need
an option to enable rounding on minimum-should-match calculations.  Sounds
like a great feature request to put into Jira, and patches are always
welcome.

Thanks,
Shawn

No comments:

Post a Comment