Skip to content

DATAES-946 - Support 'wildcard' field type. #571

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ public enum FieldType {
/** @since 4.1 */
Rank_Feature, //
/** @since 4.1 */
Rank_Features //
Rank_Features, //
/** since 4.2 */
Wildcard //
}
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,15 @@ void shouldWriteCorrectTermVectorValues() {
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();
}

/**
Expand Down Expand Up @@ -647,4 +655,11 @@ static class TermVectorFieldEntity {
@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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void shouldUseIgnoreAbove() throws JSONException {
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" + //
Expand Down Expand Up @@ -399,6 +399,14 @@ public void shouldSetFieldMappingProperties() throws JSONException {
" },\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"; //
Expand Down Expand Up @@ -891,6 +899,8 @@ static class FieldMappingParameters {
@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")
Expand Down Expand Up @@ -945,12 +955,10 @@ static class EntityWithSeqNoPrimaryTerm {

@Data
static class RankFeatureEntity {
@Id private String id;

@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;
}
}