private IndexField(String key, @Nullable Direction direction, @Nullable Type type, @Nullable Float weight) { Assert.hasText(key, "Key must not be null or empty"); if (Type.GEO.equals(type) || Type.TEXT.equals(type)) { Assert.isNull(direction, "Geo/Text indexes must not have a direction!"); } else { Assert.notNull(direction, "Default indexes require a direction"); } this.key = key; this.direction = direction; this.type = type == null ? Type.DEFAULT : type; this.weight = weight == null ? Float.NaN : weight; }
private IndexField(String key, @Nullable Direction direction, @Nullable Type type, @Nullable Float weight) { Assert.hasText(key, "Key must not be null or empty"); if (Type.GEO.equals(type) || Type.TEXT.equals(type)) { Assert.isNull(direction, "Geo/Text indexes must not have a direction!"); } else { Assert.notNull(direction, "Default indexes require a direction"); } this.key = key; this.direction = direction; this.type = type == null ? Type.DEFAULT : type; this.weight = weight == null ? Float.NaN : weight; }
/** * Returns whether the {@link IndexField} is a geo index field. * * @return true if type is {@link Type#GEO}. */ public boolean isGeo() { return Type.GEO.equals(type); }
/** * Returns whether the {@link IndexField} is a text index field. * * @return true if type is {@link Type#TEXT} * @since 1.6 */ public boolean isText() { return Type.TEXT.equals(type); }
/** * Returns whether the {@link IndexField} is a text index field. * * @return true if type is {@link Type#TEXT} * @since 1.6 */ public boolean isText() { return Type.TEXT.equals(type); }
/** * Returns whether the {@link IndexField} is a geo index field. * * @return true if type is {@link Type#GEO}. */ public boolean isGeo() { return Type.GEO.equals(type); }