-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Normalise polygons only when necessary #84229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e91cc3a
d32e0ac
e1b339b
e740b1a
6266138
9e02e85
858a7d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pr: 84229 | ||
| summary: Normalise polygons only when necessary | ||
| area: Geo | ||
| type: enhancement | ||
| issues: | ||
| - 35349 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,9 @@ public List<IndexableField> indexShape(Geometry geometry) { | |
| if (geometry == null) { | ||
| return Collections.emptyList(); | ||
| } | ||
| geometry = GeometryNormalizer.apply(orientation, geometry); | ||
| if (GeometryNormalizer.needsNormalize(orientation, geometry)) { | ||
| geometry = GeometryNormalizer.apply(orientation, geometry); | ||
| } | ||
| LuceneGeometryIndexer visitor = new LuceneGeometryIndexer(name); | ||
| geometry.visit(visitor); | ||
| return visitor.fields(); | ||
|
|
@@ -125,7 +127,7 @@ public Void visit(Point point) { | |
|
|
||
| @Override | ||
| public Void visit(Polygon polygon) { | ||
| addFields(LatLonShape.createIndexableFields(name, GeoShapeUtils.toLucenePolygon(polygon))); | ||
| addFields(LatLonShape.createIndexableFields(name, GeoShapeUtils.toLucenePolygon(polygon), true)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The additional checks in the tesselator also add some performance cost.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the hope is that the overhead of checking for intersection in the tessellator is compensated with skipping the normalisation step. |
||
| return null; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code, needsNormalize does quite an extensive check, so I presume this adds some performance cost?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needsNormalizeshould run several times faster than the normalisation.