GitHub user laimis opened a pull request:
https://github.com/apache/lucenenet/pull/148
calculate max boost once
This is a bit long, but the issue is a bit messy so putting as much info as
possible. Troubleshooting the failing tests shown here:
http://teamcity.codebetter.com/viewLog.html?buildId=191414&tab=buildResultsDiv&buildTypeId=LuceneNet_Core#testNameId-6371662534320583798
There is something odd going on with float number comparison that is
triggered by the environment that the code is running. No matter how many times
this is run on my machine in release or debug builds it never fails, but fails
all the time on TC. A separate branch was created with more logging to see what
the difference is between passing and failing cases and I arrived at the change
that is in this PR.
What the diagnostic output is showing is that Bottom >
CalculateMaxBoost(MaxEdits) is evaluating to true in the failing cases when it
really should be false.
Here is the link to verbose branch so you can see what output means what:
https://github.com/apache/lucenenet/blob/61c2d06814fa942331ce229e26553d6148a292fe/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs#L236
Here is diagnostics info when the failure occurs:
FuzzyTermsEnum bottom changed, lastTerm=, init=True, MaxEdits=1
termAfter=False, Bottom=0.857142866
subtract. <----- this should never happen
oldMaxEdits=1, maxEdits=0
Max distance changed
Here is the passing output:
FuzzyTermsEnum bottom changed, lastTerm=, init=True, MaxEdits=1
termAfter=False, Bottom=0.857142866
oldMaxEdits=1, maxEdits=1 <-- note maxEdits=1 and not 0
Max distance changed
That maxEdits value change prevents 3 docs from being scored. That changes
total hits from 5 to 2 and you can see that in the assert failure in the unit
test.
I suspect TestTopDocsMerge failures is the same issue. I am still trying to
pin point which floating comparison is changing the results there but got
myself into a situation where adding verbose output now makes it not fail in TC
anymore. So I will continue to dig there.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/laimis/lucenenet fuzzytermsenum_fix
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/lucenenet/pull/148.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #148
----
commit 61afda40a7d5b720331c92a9b4defdb4125bff0d
Author: Laimonas Simutis <[email protected]>
Date: 2015-05-24T02:32:48Z
calculate max boost once
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---