Skip to content

Commit b0f755c

Browse files
committed
added legacy option to GeoJSONAnalyzerProperties
1 parent 8bb2a91 commit b0f755c

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

Diff for: core/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzerProperties.java

+22-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public final class GeoJSONAnalyzerProperties {
3030

3131
private GeoJSONAnalyzerType type;
3232
private GeoAnalyzerOptions options;
33+
private Boolean legacy;
3334

3435
public GeoJSONAnalyzerType getType() {
3536
return type;
@@ -51,17 +52,36 @@ public void setOptions(GeoAnalyzerOptions options) {
5152
this.options = options;
5253
}
5354

55+
/**
56+
* @return This option controls how GeoJSON Polygons are interpreted (introduced in v3.10.5).
57+
* - If `legacy` is `true`, the smaller of the two regions defined by a
58+
* linear ring is interpreted as the interior of the ring and a ring can at most
59+
* enclose half the Earth's surface.
60+
* - If `legacy` is `false`, the area to the left of the boundary ring's
61+
* path is considered to be the interior and a ring can enclose the entire
62+
* surface of the Earth.
63+
* <p>
64+
* The default is `false`.
65+
*/
66+
public Boolean getLegacy() {
67+
return legacy;
68+
}
69+
70+
public void setLegacy(Boolean legacy) {
71+
this.legacy = legacy;
72+
}
73+
5474
@Override
5575
public boolean equals(Object o) {
5676
if (this == o) return true;
5777
if (o == null || getClass() != o.getClass()) return false;
5878
GeoJSONAnalyzerProperties that = (GeoJSONAnalyzerProperties) o;
59-
return type == that.type && Objects.equals(options, that.options);
79+
return type == that.type && Objects.equals(options, that.options) && Objects.equals(legacy, that.legacy);
6080
}
6181

6282
@Override
6383
public int hashCode() {
64-
return Objects.hash(type, options);
84+
return Objects.hash(type, options, legacy);
6585
}
6686

6787
public enum GeoJSONAnalyzerType {

Diff for: test-functional/src/test/java/com/arangodb/ArangoSearchAsyncTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,7 @@ void geoJsonAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interrup
861861
GeoJSONAnalyzerProperties properties = new GeoJSONAnalyzerProperties();
862862
properties.setOptions(options);
863863
properties.setType(GeoJSONAnalyzerProperties.GeoJSONAnalyzerType.point);
864+
properties.setLegacy(true);
864865

865866
Set<AnalyzerFeature> features = new HashSet<>();
866867
features.add(AnalyzerFeature.frequency);

Diff for: test-functional/src/test/java/com/arangodb/ArangoSearchTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ void geoJsonAnalyzer(ArangoDatabase db) {
860860
GeoJSONAnalyzerProperties properties = new GeoJSONAnalyzerProperties();
861861
properties.setOptions(options);
862862
properties.setType(GeoJSONAnalyzerProperties.GeoJSONAnalyzerType.point);
863+
properties.setLegacy(true);
863864

864865
Set<AnalyzerFeature> features = new HashSet<>();
865866
features.add(AnalyzerFeature.frequency);

0 commit comments

Comments
 (0)