Skip to content

Commit 6a6ead5

Browse files
authored
DATAES-991 - Wrong value for TermVector(with_positions_offets_payloads).
Original PR: #564
1 parent 8e59b18 commit 6a6ead5

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/main/java/org/springframework/data/elasticsearch/annotations/TermVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
* @since 4.0
2121
*/
2222
public enum TermVector {
23-
none, no, yes, with_positions, with_offsets, with_positions_offsets, with_positions_payloads, with_positions_offets_payloads
23+
none, no, yes, with_positions, with_offsets, with_positions_offsets, with_positions_payloads, with_positions_offsets_payloads
2424
}

src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderIntegrationTests.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.elasticsearch.search.suggest.completion.context.ContextMapping;
4646
import org.junit.jupiter.api.AfterEach;
4747
import org.junit.jupiter.api.BeforeEach;
48+
import org.junit.jupiter.api.DisplayName;
4849
import org.junit.jupiter.api.Test;
4950
import org.springframework.beans.factory.annotation.Autowired;
5051
import org.springframework.data.annotation.Id;
@@ -249,6 +250,16 @@ public void shouldUseCopyTo() {
249250
assertThat(fieldLastName.get("copy_to")).isEqualTo(copyToValue);
250251
}
251252

253+
@Test // DATAES-991
254+
@DisplayName("should write correct TermVector values")
255+
void shouldWriteCorrectTermVectorValues() {
256+
257+
IndexOperations indexOps = operations.indexOps(TermVectorFieldEntity.class);
258+
indexOps.create();
259+
indexOps.putMapping();
260+
261+
}
262+
252263
/**
253264
* @author Xiao Yu
254265
*/
@@ -621,4 +632,19 @@ static class RankFeatureEntity {
621632

622633
@Field(type = FieldType.Rank_Features) private Map<String, Integer> topics;
623634
}
635+
636+
@Data
637+
@Document(indexName = "termvectors-test")
638+
static class TermVectorFieldEntity {
639+
@Id private String id;
640+
@Field(type = FieldType.Text, termVector = TermVector.no) private String no;
641+
@Field(type = FieldType.Text, termVector = TermVector.yes) private String yes;
642+
@Field(type = FieldType.Text, termVector = TermVector.with_positions) private String with_positions;
643+
@Field(type = FieldType.Text, termVector = TermVector.with_offsets) private String with_offsets;
644+
@Field(type = FieldType.Text, termVector = TermVector.with_positions_offsets) private String with_positions_offsets;
645+
@Field(type = FieldType.Text,
646+
termVector = TermVector.with_positions_payloads) private String with_positions_payloads;
647+
@Field(type = FieldType.Text,
648+
termVector = TermVector.with_positions_offsets_payloads) private String with_positions_offsets_payloads;
649+
}
624650
}

0 commit comments

Comments
 (0)