Skip to content

Commit

Permalink
Replaced the FieldType copy ctor with ctor for the prefix field and r…
Browse files Browse the repository at this point in the history
…eplaced

setting the field type parameters with setIndexOptions(). (opensearch-project#1901)

Signed-off-by: Vesa Pehkonen <[email protected]>
  • Loading branch information
sdp authored and vpehkone committed May 3, 2022
1 parent f079ef3 commit fddd2e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,8 @@ public SearchAsYouTypeFieldMapper build(Mapper.BuilderContext context) {
ft.setIndexAnalyzer(analyzers.getIndexAnalyzer());

// set up the prefix field
FieldType prefixft = new FieldType(fieldType);
prefixft.setStoreTermVectors(false);
prefixft.setStoreTermVectorPositions(false);
prefixft.setStoreTermVectorOffsets(false);
prefixft.setStoreTermVectorPayloads(false);
FieldType prefixft = new FieldType();
prefixft.setIndexOptions(fieldType.indexOptions());
prefixft.setOmitNorms(true);
prefixft.setStored(false);
final String fullName = buildFullName(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ public void testTermVectors() throws IOException {

PrefixFieldMapper prefixFieldMapper = getPrefixFieldMapper(mapper, "field._index_prefix");
assertFalse(prefixFieldMapper.fieldType.storeTermVectors());
assertFalse(prefixFieldMapper.fieldType.storeTermVectorOffsets());
assertFalse(prefixFieldMapper.fieldType.storeTermVectorPositions());
assertFalse(prefixFieldMapper.fieldType.storeTermVectorPayloads());
}

public void testNorms() throws IOException {
Expand Down

0 comments on commit fddd2e0

Please sign in to comment.