craigtaverner commented on code in PR #14974: URL: https://github.com/apache/lucene/pull/14974#discussion_r2219555542
########## lucene/CHANGES.txt: ########## @@ -243,6 +243,9 @@ Bug Fixes * GITHUB#14922: Fix for IndexedDISI.Dense#intoBitSetWithinBlock to take into account the provided bitset size and avoid throwing IndexOutOfBoundsException (Panagiotis Bailis) + * GITHUB#14974: Lucene tessellator always fails if it cannot process a hole instrad of just ignore it. Review Comment: ```suggestion * GITHUB#14974: Lucene tessellator now always fails if it cannot process a hole instead of just ignoring it. ``` ########## lucene/core/src/java/org/apache/lucene/geo/XYPolygon.java: ########## @@ -184,6 +184,19 @@ public boolean equals(Object obj) { return true; } + public static String verticesToGeoJSON(final float[] xs, final float[] ys) { + StringBuilder sb = new StringBuilder(); + sb.append('['); + for (int i = 0; i < xs.length; i++) { + sb.append("[").append(xs[i]).append(", ").append(ys[i]).append("]"); + if (i != xs.length - 1) { Review Comment: I normally use `if(i>0)` and do this at the top of the block. I think it reads slightly better. ########## lucene/core/src/java/org/apache/lucene/geo/Tessellator.java: ########## @@ -339,16 +340,30 @@ private static Node eliminateHoles( holeMinY = holePoly.minY; holeMaxY = holePoly.maxY; } - eliminateHole(holeNode, outerNode, holeMinX, holeMaxX, holeMinY, holeMaxY); - // Filter the new polygon. - outerNode = filterPoints(outerNode, outerNode.next); + if (eliminateHole(holeNode, outerNode, holeMinX, holeMaxX, holeMinY, holeMaxY)) { + // Filter the new polygon. + outerNode = filterPoints(outerNode, outerNode.next); + } else { + // cannot process the hole, it is not inside the polygond. Review Comment: ```suggestion // cannot process the hole, it is not inside the polygon. ``` ########## lucene/core/src/java/org/apache/lucene/geo/Tessellator.java: ########## @@ -374,6 +389,9 @@ private static void eliminateHole( Node node = splitPolygon(outerNode, holeNode, fromPolygon); // Filter the split nodes. filterPoints(node, node.next); + return true; + } else { + return false; Review Comment: Are we sure that the inability to find a bridge is always due to an invalid hole? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org