DATAES-946 - Support 'wildcard' field type.

Original PR: #571
This commit is contained in:
Peter-Josef Meisch 2020-12-09 22:36:43 +01:00 committed by GitHub
parent 80a50a83d0
commit fd975993d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 5 deletions

View File

@ -55,5 +55,7 @@ public enum FieldType {
/** @since 4.1 */
Rank_Feature, //
/** @since 4.1 */
Rank_Features //
Rank_Features, //
/** since 4.2 */
Wildcard //
}

View File

@ -257,7 +257,15 @@ public class MappingBuilderIntegrationTests extends MappingContextBaseTests {
IndexOperations indexOps = operations.indexOps(TermVectorFieldEntity.class);
indexOps.create();
indexOps.putMapping();
}
@Test // DATAES-946
@DisplayName("should write wildcard field mapping")
void shouldWriteWildcardFieldMapping() {
IndexOperations indexOps = operations.indexOps(WildcardEntity.class);
indexOps.create();
indexOps.putMapping();
}
/**
@ -647,4 +655,11 @@ public class MappingBuilderIntegrationTests extends MappingContextBaseTests {
@Field(type = FieldType.Text,
termVector = TermVector.with_positions_offsets_payloads) private String with_positions_offsets_payloads;
}
@Data
@Document(indexName = "wildcard-test")
static class WildcardEntity {
@Nullable @Field(type = Wildcard) private String wildcardWithoutParams;
@Nullable @Field(type = Wildcard, nullValue = "WILD", ignoreAbove = 42) private String wildcardWithParams;
}
}

View File

@ -305,7 +305,7 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
assertEquals(expected, mapping, false);
}
@Test // DATAES-621, DATAES-943
@Test // DATAES-621, DATAES-943, DATAES-946
public void shouldSetFieldMappingProperties() throws JSONException {
String expected = "{\n" + //
" \"properties\": {\n" + //
@ -399,6 +399,14 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
" },\n" + //
" \"eagerGlobalOrdinalsFalse\": {\n" + //
" \"type\": \"text\"\n" + //
" },\n" + //
" \"wildcardWithoutParams\": {\n" + //
" \"type\": \"wildcard\"\n" + //
" },\n" + //
" \"wildcardWithParams\": {\n" + //
" \"type\": \"wildcard\",\n" + //
" \"null_value\": \"WILD\",\n" + //
" \"ignore_above\": 42\n" + //
" }\n" + //
" }\n" + //
"}\n"; //
@ -891,6 +899,8 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
@Nullable @Field(type = Object, enabled = false) private String disabledObject;
@Nullable @Field(type = Text, eagerGlobalOrdinals = true) private String eagerGlobalOrdinalsTrue;
@Nullable @Field(type = Text, eagerGlobalOrdinals = false) private String eagerGlobalOrdinalsFalse;
@Nullable @Field(type = Wildcard) private String wildcardWithoutParams;
@Nullable @Field(type = Wildcard, nullValue = "WILD", ignoreAbove = 42) private String wildcardWithParams;
}
@Document(indexName = "test-index-configure-dynamic-mapping")
@ -945,12 +955,10 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
@Data
static class RankFeatureEntity {
@Id private String id;
@Field(type = FieldType.Rank_Feature) private Integer pageRank;
@Field(type = FieldType.Rank_Feature, positiveScoreImpact = false) private Integer urlLength;
@Field(type = FieldType.Rank_Features) private Map<String, Integer> topics;
}
}