Skip to content

Switch s2-geometry to google's 'official' version #14599

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ randomizedtesting = "2.8.3"
# license checks
rat = "0.14"
# spatial-extras/ support
s2-geometry = "1.0.0"
s2-geometry = "2.0.0"
# spatial-extras/ support
spatial4j = "0.8"
# benchmark/ XML parsing
Expand Down Expand Up @@ -94,7 +94,7 @@ opennlp-tools = { module = "org.apache.opennlp:opennlp-tools", version.ref = "op
procfork = { module = "com.carrotsearch:procfork", version.ref = "procfork" }
randomizedtesting-runner = { module = "com.carrotsearch.randomizedtesting:randomizedtesting-runner", version.ref = "randomizedtesting" }
rat = { module = "org.apache.rat:apache-rat", version.ref = "rat" }
s2-geometry = { module = "io.sgr:s2-geometry-library-java", version.ref = "s2-geometry" }
s2-geometry = { module = "com.google.geometry:s2-geometry", version.ref = "s2-geometry" }
spatial4j = { module = "org.locationtech.spatial4j:spatial4j", version.ref = "spatial4j" }
xerces = { module = "xerces:xercesImpl", version.ref = "xerces" }
zstd = { module = "com.github.luben:zstd-jni", version.ref = "zstd" }
Expand Down
1 change: 0 additions & 1 deletion gradle/validation/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ allprojects {

def testConfigurations = project.configurations.matching {
it.name in [
"annotationProcessor",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed annotation processor configuration from version lock computation. I don't think it's relevant to us what's used in annotation processors.

"testCompileClasspath",
"testRuntimeClasspath"
]
Expand Down
2 changes: 1 addition & 1 deletion lucene/spatial-extras/src/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@SuppressWarnings({"requires-automatic"})
module org.apache.lucene.spatial_extras {
requires spatial4j;
requires s2.geometry.library.java;
requires s2.geometry;
requires org.apache.lucene.core;
requires org.apache.lucene.spatial3d;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,17 @@ public static int getMaxLevels(int arity) {
return S2CellId.MAX_LEVEL / arity + 1;
}

/**
* The default projection.
*/
final static S2Projections PROJECTION = S2Projections.S2_QUADRATIC_PROJECTION;

@Override
public int getLevelForDistance(double dist) {
if (dist == 0) {
return maxLevels;
}
int level = S2Projections.MAX_WIDTH.getMinLevel(dist * DistanceUtils.DEGREES_TO_RADIANS);
int level = PROJECTION.maxWidth.getMinLevel(dist * DistanceUtils.DEGREES_TO_RADIANS);
int roundLevel = level % arity != 0 ? 1 : 0;
level = level / arity + roundLevel;
return Math.min(maxLevels, level + 1);
Expand All @@ -119,7 +124,7 @@ public double getDistanceForLevel(int level) {
if (level == 0) {
return 180;
}
return S2Projections.MAX_WIDTH.getValue(arity * (level - 1)) * DistanceUtils.RADIANS_TO_DEGREES;
return PROJECTION.maxWidth.getValue(arity * (level - 1)) * DistanceUtils.RADIANS_TO_DEGREES;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testPrecision() {
cell = (S2PrefixTreeCell) iterator.next();
}
assertTrue(cell.getLevel() == level);
double precisionCell = S2Projections.MAX_WIDTH.getValue(cell.cellId.level());
double precisionCell = S2PrefixTree.PROJECTION.maxWidth.getValue(cell.cellId.level());
assertTrue(precision > precisionCell);
}
}
228 changes: 27 additions & 201 deletions versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"configurationGroups" : {
"main_dependencies" : {
"com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.3" : "fa9ef26b,refs=4",
"com.google.code.findbugs:jsr305:3.0.2" : "cbc357ab,refs=4",
"com.google.errorprone:error_prone_annotations:2.1.3" : "cbc357ab,refs=4",
"com.google.geometry:s2-geometry:2.0.0" : "cbc357ab,refs=4",
"com.google.guava:guava:25.1-jre" : "cbc357ab,refs=4",
"com.google.j2objc:j2objc-annotations:1.1" : "cbc357ab,refs=4",
"com.ibm.icu:icu4j:77.1" : "47ea4550,refs=6",
"commons-codec:commons-codec:1.18.0" : "e6288df0,refs=6",
"commons-io:commons-io:2.16.1" : "5ce8cdc6,refs=2",
"io.sgr:s2-geometry-library-java:1.0.0" : "cbc357ab,refs=4",
"junit:junit:4.13.2" : "fa9ef26b,refs=4",
"net.sf.jopt-simple:jopt-simple:5.0.4" : "85a1e4c6,refs=2",
"net.sourceforge.nekohtml:nekohtml:1.9.22" : "5ce8cdc6,refs=2",
Expand All @@ -18,6 +22,8 @@
"org.carrot2:morfologik-fsa:2.1.9" : "79af844b,refs=4",
"org.carrot2:morfologik-polish:2.1.9" : "fe494320,refs=3",
"org.carrot2:morfologik-stemming:2.1.9" : "79af844b,refs=4",
"org.checkerframework:checker-qual:2.0.0" : "cbc357ab,refs=4",
"org.codehaus.mojo:animal-sniffer-annotations:1.14" : "cbc357ab,refs=4",
"org.hamcrest:hamcrest:3.0" : "fa9ef26b,refs=4",
"org.locationtech.spatial4j:spatial4j:0.8" : "cbc357ab,refs=4",
"org.openjdk.jmh:jmh-core:1.37" : "85a1e4c6,refs=2",
Expand All @@ -28,69 +34,39 @@
"test_dependencies" : {
"com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.3" : "b35e5d7a,refs=74",
"com.carrotsearch:procfork:1.0.6" : "b7ba1646,refs=2",
"com.github.ben-manes.caffeine:caffeine:3.0.5" : "6897bc09,refs=38",
"com.github.kevinstern:software-and-algorithms:1.0" : "6897bc09,refs=38",
"com.google.auto.service:auto-service-annotations:1.0.1" : "6897bc09,refs=38",
"com.google.auto.value:auto-value-annotations:1.9" : "6897bc09,refs=38",
"com.google.auto:auto-common:1.2.2" : "6897bc09,refs=38",
"com.google.errorprone:error_prone_annotation:2.38.0" : "6897bc09,refs=38",
"com.google.errorprone:error_prone_annotations:2.38.0" : "6897bc09,refs=38",
"com.google.errorprone:error_prone_check_api:2.38.0" : "6897bc09,refs=38",
"com.google.errorprone:error_prone_core:2.38.0" : "6897bc09,refs=38",
"com.google.googlejavaformat:google-java-format:1.24.0" : "6897bc09,refs=38",
"com.google.guava:failureaccess:1.0.3" : "6897bc09,refs=38",
"com.google.guava:guava:33.4.6-jre" : "6897bc09,refs=38",
"com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" : "6897bc09,refs=38",
"com.google.j2objc:j2objc-annotations:3.0.0" : "6897bc09,refs=38",
"com.google.protobuf:protobuf-java:3.25.5" : "6897bc09,refs=38",
"com.google.code.findbugs:jsr305:3.0.2" : "1d5a4b2b,refs=4",
"com.google.errorprone:error_prone_annotations:2.1.3" : "1d5a4b2b,refs=4",
"com.google.geometry:s2-geometry:2.0.0" : "1d5a4b2b,refs=4",
"com.google.guava:guava:25.1-jre" : "1d5a4b2b,refs=4",
"com.google.j2objc:j2objc-annotations:1.1" : "1d5a4b2b,refs=4",
"com.ibm.icu:icu4j:77.1" : "ffa00415,refs=8",
"commons-codec:commons-codec:1.18.0" : "9dde4cb5,refs=8",
"commons-io:commons-io:2.16.1" : "6f16ff86,refs=2",
"io.github.eisop:dataflow-errorprone:3.41.0-eisop1" : "6897bc09,refs=38",
"io.github.java-diff-utils:java-diff-utils:4.12" : "6897bc09,refs=38",
"io.sgr:s2-geometry-library-java:1.0.0" : "1d5a4b2b,refs=4",
"javax.inject:javax.inject:1" : "6897bc09,refs=38",
"junit:junit:4.13.2" : "b35e5d7a,refs=74",
"net.bytebuddy:byte-buddy:1.15.11" : "b7ba1646,refs=2",
"net.sf.jopt-simple:jopt-simple:5.0.4" : "152d9f78,refs=3",
"net.sf.jopt-simple:jopt-simple:5.0.4" : "97d01686,refs=2",
"net.sourceforge.nekohtml:nekohtml:1.9.22" : "6f16ff86,refs=2",
"org.antlr:antlr4-runtime:4.13.2" : "6fbc4021,refs=5",
"org.apache.commons:commons-compress:1.27.1" : "6f16ff86,refs=2",
"org.apache.commons:commons-lang3:3.16.0" : "6f16ff86,refs=2",
"org.apache.commons:commons-math3:3.6.1" : "152d9f78,refs=3",
"org.apache.commons:commons-math3:3.6.1" : "97d01686,refs=2",
"org.apache.opennlp:opennlp-tools:2.5.4" : "b91715f0,refs=6",
"org.assertj:assertj-core:3.27.3" : "b7ba1646,refs=2",
"org.carrot2:morfologik-fsa:2.1.9" : "e077a675,refs=8",
"org.carrot2:morfologik-polish:2.1.9" : "cb00cecf,refs=5",
"org.carrot2:morfologik-stemming:2.1.9" : "e077a675,refs=8",
"org.checkerframework:checker-qual:3.19.0" : "6897bc09,refs=38",
"org.checkerframework:checker-qual:2.0.0" : "1d5a4b2b,refs=4",
"org.codehaus.mojo:animal-sniffer-annotations:1.14" : "1d5a4b2b,refs=4",
"org.hamcrest:hamcrest:3.0" : "b35e5d7a,refs=74",
"org.jspecify:jspecify:1.0.0" : "6897bc09,refs=38",
"org.locationtech.jts:jts-core:1.20.0" : "180518e6,refs=2",
"org.locationtech.spatial4j:spatial4j:0.8" : "1d5a4b2b,refs=4",
"org.openjdk.jmh:jmh-core:1.37" : "152d9f78,refs=3",
"org.openjdk.jmh:jmh-generator-annprocess:1.37" : "ecaf1d73,refs=1",
"org.pcollections:pcollections:4.0.1" : "6897bc09,refs=38",
"org.openjdk.jmh:jmh-core:1.37" : "97d01686,refs=2",
"org.slf4j:slf4j-api:2.0.17" : "b91715f0,refs=6",
"ua.net.nlp:morfologik-ukrainian-search:4.9.1" : "cb00cecf,refs=5",
"xerces:xercesImpl:2.12.2" : "6f16ff86,refs=2"
}
},
"because" : {
"152d9f78" : [
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:benchmark-jmh"
},
{
"configuration" : "testCompileClasspath",
"projectPath" : ":lucene:benchmark-jmh"
},
{
"configuration" : "testRuntimeClasspath",
"projectPath" : ":lucene:benchmark-jmh"
}
],
"180518e6" : [
{
"configuration" : "testCompileClasspath",
Expand Down Expand Up @@ -173,160 +149,6 @@
"projectPath" : ":lucene:benchmark"
}
],
"6897bc09" : [
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis.tests"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:backward-codecs"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:benchmark"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:benchmark-jmh"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:classification"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:codecs"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:core"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:core.tests"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:demo"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:distribution.tests"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:expressions"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:facet"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:grouping"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:highlighter"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:join"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:luke"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:memory"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:misc"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:monitor"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:queries"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:queryparser"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:replicator"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:sandbox"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:spatial-extras"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:spatial-test-fixtures"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:spatial3d"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:suggest"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:test-framework"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:common"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:icu"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:kuromoji"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:morfologik"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:morfologik.tests"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:nori"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:opennlp"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:phonetic"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:smartcn"
},
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:analysis:stempel"
}
],
"6f16ff86" : [
{
"configuration" : "testCompileClasspath",
Expand Down Expand Up @@ -387,6 +209,16 @@
"projectPath" : ":lucene:benchmark-jmh"
}
],
"97d01686" : [
{
"configuration" : "testCompileClasspath",
"projectPath" : ":lucene:benchmark-jmh"
},
{
"configuration" : "testRuntimeClasspath",
"projectPath" : ":lucene:benchmark-jmh"
}
],
"9dde4cb5" : [
{
"configuration" : "testCompileClasspath",
Expand Down Expand Up @@ -873,12 +705,6 @@
"projectPath" : ":lucene:analysis:phonetic"
}
],
"ecaf1d73" : [
{
"configuration" : "annotationProcessor",
"projectPath" : ":lucene:benchmark-jmh"
}
],
"fa9ef26b" : [
{
"configuration" : "compileClasspath",
Expand Down
Loading