Skip to content
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

merge GeoPoint specific mapping properties #5506

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/reference/mapping/types/geo-point-type.asciidoc
Expand Up @@ -154,6 +154,10 @@ is `true`).
|`normalize_lat` |Set to `true` to normalize latitude.

|`normalize_lon` |Set to `true` to normalize longitude.

|`precision_step` |The precision step (number of terms generated for
each number value) for `.lat` and `.lon` fields if `lat_lon` is set to `true`.
Defaults to `4`.
|=======================================================================

[float]
Expand Down
Expand Up @@ -394,8 +394,8 @@ public GeoPoint decode(long latBits, long lonBits, GeoPoint out) {

private final StringFieldMapper geohashMapper;

private final boolean validateLon;
private final boolean validateLat;
private boolean validateLon;
private boolean validateLat;

private final boolean normalizeLon;
private final boolean normalizeLat;
Expand Down Expand Up @@ -613,7 +613,38 @@ public void close() {
@Override
public void merge(Mapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
// TODO: geo-specific properties
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
GeoPointFieldMapper fieldMergeWith = (GeoPointFieldMapper) mergeWith;

if (this.enableLatLon != fieldMergeWith.enableLatLon) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different lat_lon");
}
if (this.enableGeoHash != fieldMergeWith.enableGeoHash) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different geohash");
}
if (this.geoHashPrecision != fieldMergeWith.geoHashPrecision) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different geohash_precision");
}
if (this.enableGeohashPrefix != fieldMergeWith.enableGeohashPrefix) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different geohash_prefix");
}
if (this.normalizeLat != fieldMergeWith.normalizeLat) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different normalize_lat");
}
if (this.normalizeLon != fieldMergeWith.normalizeLon) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different normalize_lon");
}
if (this.precisionStep != fieldMergeWith.precisionStep) {
mergeContext.addConflict("mapper [" + names.fullName() + "] has different precision_step");
}


if (!mergeContext.mergeFlags().simulate()) {
this.validateLat = fieldMergeWith.validateLat;
this.validateLon = fieldMergeWith.validateLon;
}
}

@Override
Expand Down