[
https://issues.apache.org/jira/browse/LUCENE-7185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Muir updated LUCENE-7185:
--------------------------------
Attachment: LUCENE-7185_sorting.patch
Here is a patch for the sort bug. The bug is actually in
SloppyMath.haversinSortKey. It sometimes returns values that are different, yet
when followed through with the rest of the haversin equation will collapse to
the same value due to subsequent rounding.
This means Double.compare(sortKey(...), sortKey(...)) becomes inconsistent with
Double.compare(fullHaversin(...), fullHaversin(...)) which is the whole point,
and causes the tie-breaker test failure.
The fix is to clobber some bits: in the worst case for huge distances around
the earth it increases error from 0.1cm to 20cm, but "typical" distances (e.g.
< 1000km) are not impacted and still within e.g. 0.01mm error. Our docs for
error were really off here too: i improved the testing for that. The fix does
not hurt performance.
Now all tests pass in sandbox/, but I have not yet looked at geopoint failures.
One of them is kinda scary:
{noformat}
[junit4] Suite: org.apache.lucene.spatial.geopoint.search.TestGeoPointQuery
[junit4] IGNOR/A 0.01s J1 | TestGeoPointQuery.testRandomBig
[junit4] > Assumption #1: 'nightly' test group is disabled (@Nightly())
[junit4] IGNOR/A 0.00s J1 | TestGeoPointQuery.testRandomDistanceHuge
[junit4] > Assumption #1: 'nightly' test group is disabled (@Nightly())
[junit4] 2> NOTE: reproduce with: ant test -Dtestcase=TestGeoPointQuery
-Dtests.method=testAllLonEqual -Dtests.seed=4ABB96AB44F4796E
-Dtests.locale=id-ID -Dtests.timezone=Pacific/Fakaofo -Dtests.asserts=true
-Dtests.file.encoding=US-ASCII
[junit4] ERROR 0.35s J1 | TestGeoPointQuery.testAllLonEqual <<<
[junit4] > Throwable #1: java.lang.IllegalArgumentException: Illegal
shift value, must be 32..63; got shift=0
[junit4] > at
__randomizedtesting.SeedInfo.seed([4ABB96AB44F4796E:DBB16756B45E397A]:0)
[junit4] > at
org.apache.lucene.spatial.util.GeoEncodingUtils.geoCodedToPrefixCodedBytes(GeoEncodingUtils.java:109)
[junit4] > at
org.apache.lucene.spatial.util.GeoEncodingUtils.geoCodedToPrefixCoded(GeoEncodingUtils.java:89)
[junit4] > at
org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum$Range.fillBytesRef(GeoPointPrefixTermsEnum.java:236)
[junit4] > at
org.apache.lucene.spatial.geopoint.search.GeoPointTermsEnum.nextRange(GeoPointTermsEnum.java:71)
[junit4] > at
org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum.nextRange(GeoPointPrefixTermsEnum.java:171)
[junit4] > at
org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum.nextSeekTerm(GeoPointPrefixTermsEnum.java:190)
[junit4] > at
org.apache.lucene.index.FilteredTermsEnum.next(FilteredTermsEnum.java:212)
[junit4] > at
org.apache.lucene.spatial.geopoint.search.GeoPointTermQueryConstantScoreWrapper$1.scorer(GeoPointTermQueryConstantScoreWrapper.java:110)
[junit4] > at
org.apache.lucene.search.Weight.bulkScorer(Weight.java:135)
[junit4] > at
org.apache.lucene.search.LRUQueryCache$CachingWrapperWeight.bulkScorer(LRUQueryCache.java:644)
[junit4] > at
org.apache.lucene.search.AssertingWeight.bulkScorer(AssertingWeight.java:68)
[junit4] > at
org.apache.lucene.search.BooleanWeight.optionalBulkScorer(BooleanWeight.java:231)
[junit4] > at
org.apache.lucene.search.BooleanWeight.booleanScorer(BooleanWeight.java:297)
[junit4] > at
org.apache.lucene.search.BooleanWeight.bulkScorer(BooleanWeight.java:364)
[junit4] > at
org.apache.lucene.search.LRUQueryCache$CachingWrapperWeight.bulkScorer(LRUQueryCache.java:644)
[junit4] > at
org.apache.lucene.search.AssertingWeight.bulkScorer(AssertingWeight.java:68)
[junit4] > at
org.apache.lucene.search.AssertingWeight.bulkScorer(AssertingWeight.java:68)
[junit4] > at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:666)
[junit4] > at
org.apache.lucene.search.AssertingIndexSearcher.search(AssertingIndexSearcher.java:91)
[junit4] > at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473)
[junit4] > at
org.apache.lucene.spatial.util.BaseGeoPointTestCase.verifyRandomRectangles(BaseGeoPointTestCase.java:835)
[junit4] > at
org.apache.lucene.spatial.util.BaseGeoPointTestCase.verify(BaseGeoPointTestCase.java:763)
[junit4] > at
org.apache.lucene.spatial.util.BaseGeoPointTestCase.testAllLonEqual(BaseGeoPointTestCase.java:495)
{noformat}
> fix random number generation used for spatial tests
> ---------------------------------------------------
>
> Key: LUCENE-7185
> URL: https://issues.apache.org/jira/browse/LUCENE-7185
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-7185.patch, LUCENE-7185_sorting.patch
>
>
> The current method is not very good for testing.
> * It will only rarely or never return edge cases like -180/180/-90/90
> * It will only rarely return 0
> * There are many possible doubles within the ranges (-180..180/-90..90) it
> will never return
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]