[
https://issues.apache.org/jira/browse/LUCENE-9870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311157#comment-17311157
]
ASF subversion and git services commented on LUCENE-9870:
---------------------------------------------------------
Commit be8fb34d3d34b2fa3ac4a320b4b2af796d112d34 in lucene-solr's branch
refs/heads/branch_8_8 from Jørgen Nystad
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=be8fb34 ]
LUCENE-9870: Fix Circle2D intersectsLine t-value (distance) range clamp (#41)
> Circle2D intersectsLine bug mostly causes no matches along indexed lines and
> outside polygon edges
> --------------------------------------------------------------------------------------------------
>
> Key: LUCENE-9870
> URL: https://issues.apache.org/jira/browse/LUCENE-9870
> Project: Lucene - Core
> Issue Type: Bug
> Components: modules/spatial
> Affects Versions: 8.8
> Reporter: Jørgen Nystad
> Priority: Major
> Labels: easyfix
> Attachments:
> 0001-Circle2D-Fix-intersectsLine-t-value-distance-range-c.patch
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> Circle2D intersectsLine does a dot product to determine closest point on line
> but then filters it like this:
>
> {code:java}
> final double distance = dotProduct / magnitudeAB;
> if (distance < 0 || distance > dotProduct) {
> return false;
> }
> {code}
> If magnitudeAB (squared length of line) is less than 1 (degree), this will
> always return false.
> distance is actually the "t-value", meaning the correct behaviour here would
> be to clamp it between 0 and 1 to ensure point is on actual line.
> A straightforward fix that works since edge and end points are checked anyway:
> {code:java}
> final double distance = dotProduct / magnitudeAB;
> if (distance < 0 || distance > 1) {
> return false;
> }
> {code}
> This is tested and verified by building version 8.8.0 and replacing jar-files
> in an elasticsearch instance of version 7.12.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]