Address PR comments
This commit is contained in:
parent
0ef5a27556
commit
a08f51e13b
|
@ -203,12 +203,10 @@ public class MappedFieldType extends FieldType {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MappedFieldType)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
MappedFieldType fieldType = (MappedFieldType) o;
|
||||
return Objects.equals(boost, fieldType.boost) &&
|
||||
Objects.equals(docValues, fieldType.docValues) &&
|
||||
return boost == fieldType.boost &&
|
||||
docValues == fieldType.docValues &&
|
||||
Objects.equals(names, fieldType.names) &&
|
||||
Objects.equals(indexAnalyzer, fieldType.indexAnalyzer) &&
|
||||
Objects.equals(searchAnalyzer, fieldType.searchAnalyzer) &&
|
||||
|
|
|
@ -125,8 +125,6 @@ public class BinaryFieldMapper extends AbstractFieldMapper {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof BinaryFieldType)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
BinaryFieldType that = (BinaryFieldType) o;
|
||||
return Objects.equals(tryUncompressing, that.tryUncompressing);
|
||||
|
|
|
@ -237,17 +237,15 @@ public class DateFieldMapper extends NumberFieldMapper {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof DateFieldType)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
DateFieldType that = (DateFieldType) o;
|
||||
return Objects.equals(dateTimeFormatter.format(), that.dateTimeFormatter.format()) &&
|
||||
Objects.equals(timeUnit, that.timeUnit);
|
||||
Objects.equals(timeUnit, that.timeUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), dateTimeFormatter, timeUnit);
|
||||
return Objects.hash(super.hashCode(), dateTimeFormatter.format(), timeUnit);
|
||||
}
|
||||
|
||||
public FormatDateTimeFormatter dateTimeFormatter() {
|
||||
|
|
|
@ -314,16 +314,14 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof GeoPointFieldType)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
GeoPointFieldType that = (GeoPointFieldType) o;
|
||||
return java.util.Objects.equals(geohashPrecision, that.geohashPrecision) &&
|
||||
java.util.Objects.equals(geohashPrefixEnabled, that.geohashPrefixEnabled) &&
|
||||
java.util.Objects.equals(validateLon, that.validateLon) &&
|
||||
java.util.Objects.equals(validateLat, that.validateLat) &&
|
||||
java.util.Objects.equals(normalizeLon, that.normalizeLon) &&
|
||||
java.util.Objects.equals(normalizeLat, that.normalizeLat) &&
|
||||
return geohashPrecision == that.geohashPrecision &&
|
||||
geohashPrefixEnabled == that.geohashPrefixEnabled &&
|
||||
validateLon == that.validateLon &&
|
||||
validateLat == that.validateLat &&
|
||||
normalizeLon == that.normalizeLon &&
|
||||
normalizeLat == that.normalizeLat &&
|
||||
java.util.Objects.equals(geohashFieldType, that.geohashFieldType) &&
|
||||
java.util.Objects.equals(latFieldType, that.latFieldType) &&
|
||||
java.util.Objects.equals(lonFieldType, that.lonFieldType);
|
||||
|
|
|
@ -208,17 +208,15 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof GeoShapeFieldType)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
GeoShapeFieldType that = (GeoShapeFieldType) o;
|
||||
return Objects.equals(treeLevels, that.treeLevels) &&
|
||||
Objects.equals(precisionInMeters, that.precisionInMeters) &&
|
||||
Objects.equals(defaultDistanceErrorPct, that.defaultDistanceErrorPct) &&
|
||||
return treeLevels == that.treeLevels &&
|
||||
precisionInMeters == that.precisionInMeters &&
|
||||
defaultDistanceErrorPct == that.defaultDistanceErrorPct &&
|
||||
Objects.equals(tree, that.tree) &&
|
||||
Objects.equals(strategyName, that.strategyName) &&
|
||||
Objects.equals(distanceErrorPct, that.distanceErrorPct) &&
|
||||
Objects.equals(orientation, that.orientation);
|
||||
orientation == that.orientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -229,6 +227,8 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
|||
@Override
|
||||
public void freeze() {
|
||||
super.freeze();
|
||||
// This is a bit hackish: we need to setup the spatial tree and strategies once the field name is set, which
|
||||
// must be by the time freeze is called.
|
||||
SpatialPrefixTree prefixTree;
|
||||
if ("geohash".equals(tree)) {
|
||||
prefixTree = new GeohashPrefixTree(ShapeBuilder.SPATIAL_CONTEXT, getLevels(treeLevels, precisionInMeters, Defaults.GEOHASH_LEVELS, true));
|
||||
|
|
|
@ -151,11 +151,9 @@ public class FieldNamesFieldMapper extends AbstractFieldMapper implements RootMa
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof FieldNamesFieldType)) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
FieldNamesFieldType that = (FieldNamesFieldType) o;
|
||||
return Objects.equals(enabled, that.enabled);
|
||||
return enabled == that.enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BinaryFieldTypeTests extends FieldTypeTestCase {
|
|||
BinaryFieldMapper.BinaryFieldType bft = (BinaryFieldMapper.BinaryFieldType)ft;
|
||||
switch (propNum) {
|
||||
case 0: bft.setTryUncompressing(!bft.tryUncompressing()); break;
|
||||
default: super.modifyProperty(ft, numProperties() - propNum - 1);
|
||||
default: super.modifyProperty(ft, 1 + propNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class DateFieldTypeTests extends FieldTypeTestCase {
|
|||
switch (propNum) {
|
||||
case 0: dft.setDateTimeFormatter(Joda.forPattern("basic_week_date", Locale.ROOT)); break;
|
||||
case 1: dft.setTimeUnit(TimeUnit.HOURS); break;
|
||||
default: super.modifyProperty(ft, numProperties() - propNum - 1);
|
||||
default: super.modifyProperty(ft, 2 + propNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class GeoPointFieldTypeTests extends FieldTypeTestCase {
|
|||
case 3: gft.setValidateLat(!gft.validateLat()); break;
|
||||
case 4: gft.setNormalizeLon(!gft.normalizeLon()); break;
|
||||
case 5: gft.setNormalizeLat(!gft.normalizeLat()); break;
|
||||
default: super.modifyProperty(ft, numProperties() - propNum - 1);
|
||||
default: super.modifyProperty(ft, 6 + propNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class GeoShapeFieldTypeTests extends FieldTypeTestCase {
|
|||
case 3: gft.setPrecisionInMeters(20); break;
|
||||
case 4: gft.setDefaultDistanceErrorPct(0.5); break;
|
||||
case 5: gft.setOrientation(ShapeBuilder.Orientation.LEFT); break;
|
||||
default: super.modifyProperty(ft, numProperties() - propNum - 1);
|
||||
default: super.modifyProperty(ft, 6 + propNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class FieldNamesFieldTypeTests extends FieldTypeTestCase {
|
|||
FieldNamesFieldMapper.FieldNamesFieldType fnft = (FieldNamesFieldMapper.FieldNamesFieldType)ft;
|
||||
switch (propNum) {
|
||||
case 0: fnft.setEnabled(!fnft.isEnabled()); break;
|
||||
default: super.modifyProperty(ft, numProperties() - propNum - 1);
|
||||
default: super.modifyProperty(ft, 1 + propNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue