Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-9870

Circle2D intersectsLine bug mostly causes no matches along indexed lines and outside polygon edges

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.8
    • Fix Version/s: 8.8.2
    • Component/s: modules/spatial
    • Labels:
    • Lucene Fields:
      New

      Description

      Circle2D intersectsLine does a dot product to determine closest point on line but then filters it like this:
       

      
          final double distance = dotProduct / magnitudeAB;
      
          if (distance < 0 || distance > dotProduct) {
            return false;
          }
      
      

      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:

      
          final double distance = dotProduct / magnitudeAB;
      
          if (distance < 0 || distance > 1) {
            return false;
          }
      
      

      This is tested and verified by building version 8.8.0 and replacing jar-files in an elasticsearch instance of version 7.12.

        Attachments

          Activity

            People

            • Assignee:
              ivera Ignacio Vera
              Reporter:
              jnystad Jørgen Nystad

              Dates

              • Created:
                Updated:
                Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 1h 40m
              1h 40m

                Issue deployment