mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-01 09:42:11 +00:00
Polishing
This commit is contained in:
parent
3f2ab4b06a
commit
dd3d01eab6
@ -159,14 +159,14 @@ public @interface Field {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* if true, the field will be stored in Elasticsearch even if it has a null value
|
* if true, the field will be stored in Elasticsearch even if it has a null value
|
||||||
*
|
*
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
boolean storeNullValue() default false;
|
boolean storeNullValue() default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to be used in combination with {@link FieldType#Rank_Feature}
|
* to be used in combination with {@link FieldType#Rank_Feature}
|
||||||
*
|
*
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
boolean positiveScoreImpact() default true;
|
boolean positiveScoreImpact() default true;
|
||||||
@ -189,7 +189,7 @@ public @interface Field {
|
|||||||
NullValueType nullValueType() default NullValueType.String;
|
NullValueType nullValueType() default NullValueType.String;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to be used in combination with {@link FieldType#Dense_Vector}
|
* to be used in combination with {@link FieldType#Dense_Vector}
|
||||||
*
|
*
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +60,6 @@ public enum FieldType {
|
|||||||
Rank_Features, //
|
Rank_Features, //
|
||||||
/** since 4.2 */
|
/** since 4.2 */
|
||||||
Wildcard, //
|
Wildcard, //
|
||||||
/** @since 4.2 */
|
/** @since 4.2 */
|
||||||
Dense_Vector //
|
Dense_Vector //
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import lombok.Setter;
|
|||||||
import java.lang.Boolean;
|
import java.lang.Boolean;
|
||||||
import java.lang.Double;
|
import java.lang.Double;
|
||||||
import java.lang.Integer;
|
import java.lang.Integer;
|
||||||
|
import java.lang.Object;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -508,7 +509,7 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
|
|||||||
assertEquals(expected, mapping, false);
|
assertEquals(expected, mapping, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #1700
|
@Test // #1700
|
||||||
@DisplayName("should write dense_vector properties")
|
@DisplayName("should write dense_vector properties")
|
||||||
void shouldWriteDenseVectorProperties() throws JSONException {
|
void shouldWriteDenseVectorProperties() throws JSONException {
|
||||||
String expected = "{\n" + //
|
String expected = "{\n" + //
|
||||||
@ -563,9 +564,8 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
|
|||||||
@DisplayName("should only allow disabled properties on type object")
|
@DisplayName("should only allow disabled properties on type object")
|
||||||
void shouldOnlyAllowDisabledPropertiesOnTypeObject() {
|
void shouldOnlyAllowDisabledPropertiesOnTypeObject() {
|
||||||
|
|
||||||
assertThatThrownBy(() ->
|
assertThatThrownBy(() -> getMappingBuilder().buildPropertyMapping(InvalidDisabledMappingProperty.class))
|
||||||
getMappingBuilder().buildPropertyMapping(InvalidDisabledMappingProperty.class)
|
.isInstanceOf(MappingException.class);
|
||||||
).isInstanceOf(MappingException.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@ -982,7 +982,7 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
|
|||||||
@Field(type = FieldType.Rank_Features) private Map<String, Integer> topics;
|
@Field(type = FieldType.Rank_Features) private Map<String, Integer> topics;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
static class DenseVectorEntity {
|
static class DenseVectorEntity {
|
||||||
|
|
||||||
@Id private String id;
|
@Id private String id;
|
||||||
@ -999,15 +999,13 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
|
|||||||
@Data
|
@Data
|
||||||
static class InvalidDisabledMappingProperty {
|
static class InvalidDisabledMappingProperty {
|
||||||
@Id private String id;
|
@Id private String id;
|
||||||
@Mapping(enabled = false)
|
@Mapping(enabled = false) @Field(type = Text) private String text;
|
||||||
@Field(type = Text) private String text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
static class DisabledMappingProperty {
|
static class DisabledMappingProperty {
|
||||||
@Id private String id;
|
@Id private String id;
|
||||||
@Field(type = Text) private String text;
|
@Field(type = Text) private String text;
|
||||||
@Mapping(enabled = false)
|
@Mapping(enabled = false) @Field(type = Object) private Object object;
|
||||||
@Field(type = Object) private Object object;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package org.springframework.data.elasticsearch.core.index;
|
package org.springframework.data.elasticsearch.core.index;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.FieldType.Dense_Vector;
|
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.FieldType.Object;
|
import static org.springframework.data.elasticsearch.annotations.FieldType.Object;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user