Skip to content

Commit 242cf77

Browse files
committed
DATAES-991 - Wrong value for TermVector(with_positions_offets_payloads).
Original PR: #564 (cherry picked from commit 6a6ead5)
1 parent 1e6271e commit 242cf77

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
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/MappingBuilderTests.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,16 @@ void shouldNotIncludeSeqNoPrimaryTermPropertyInMappingEvenWhenAnnotatedWithField
604604
assertThat(propertyMapping).doesNotContain("seqNoPrimaryTerm");
605605
}
606606

607-
/**
607+
@Test // DATAES-991
608+
void shouldWriteCorrectTermVectorValues() {
609+
610+
IndexOperations indexOps = operations.indexOps(TermVectorFieldEntity.class);
611+
indexOps.create();
612+
indexOps.putMapping(indexOps.createMapping());
613+
}
614+
615+
616+
/**
608617
* @author Xiao Yu
609618
*/
610619
@Setter
@@ -1093,4 +1102,20 @@ static class EntityWithSeqNoPrimaryTerm {
10931102

10941103
@Field(type = Object) private SeqNoPrimaryTerm seqNoPrimaryTerm;
10951104
}
1105+
1106+
@Data
1107+
@Document(indexName = "termvectors-test")
1108+
static class TermVectorFieldEntity {
1109+
@Id private String id;
1110+
@Field(type = FieldType.Text, termVector = TermVector.no) private String no;
1111+
@Field(type = FieldType.Text, termVector = TermVector.yes) private String yes;
1112+
@Field(type = FieldType.Text, termVector = TermVector.with_positions) private String with_positions;
1113+
@Field(type = FieldType.Text, termVector = TermVector.with_offsets) private String with_offsets;
1114+
@Field(type = FieldType.Text, termVector = TermVector.with_positions_offsets) private String with_positions_offsets;
1115+
@Field(type = FieldType.Text,
1116+
termVector = TermVector.with_positions_payloads) private String with_positions_payloads;
1117+
@Field(type = FieldType.Text,
1118+
termVector = TermVector.with_positions_offsets_payloads) private String with_positions_offsets_payloads;
1119+
}
1120+
10961121
}

0 commit comments

Comments
 (0)