Skip to content

Commit 1d462dd

Browse files
gmarzMpdreamz
authored andcommitted
Fix #2513 add TermVector option to Text attribute (#2514)
1 parent 962b7ac commit 1d462dd

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/Nest/Mapping/Types/Core/Text/TextAttribute.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class TextAttribute : ElasticsearchCorePropertyAttributeBase, ITextProper
3535
public string SearchAnalyzer { get { return Self.SearchAnalyzer; } set { Self.SearchAnalyzer = value; } }
3636
public string SearchQuoteAnalyzer { get { return Self.SearchQuoteAnalyzer; } set { Self.SearchQuoteAnalyzer = value; } }
3737
public bool Norms { get { return Self.Norms.GetValueOrDefault(true); } set { Self.Norms = value; } }
38+
public TermVectorOption TermVector { get { return Self.TermVector.GetValueOrDefault(); } set { Self.TermVector = value; } }
3839

3940
public TextAttribute() : base("text") { }
4041
}

src/Tests/Mapping/Types/Core/Text/TextAttributeTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public class TextTest
1818
SearchQuoteAnalyzer = "mysearchquoteanalyzer",
1919
Similarity = "classic",
2020
Store = true,
21-
Norms = false)]
21+
Norms = false,
22+
TermVector = TermVectorOption.WithPositionsOffsets)]
2223
public string Full { get; set; }
2324

2425
[Text]
@@ -48,7 +49,8 @@ public class TextAttributeTests : AttributeTestsBase<TextTest>
4849
search_quote_analyzer = "mysearchquoteanalyzer",
4950
similarity = "classic",
5051
store = true,
51-
norms = false
52+
norms = false,
53+
term_vector = "with_positions_offsets"
5254
},
5355
minimal = new
5456
{

src/Tests/Mapping/Types/Core/Text/TextPropertyTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public TextPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(cl
4545
search_quote_analyzer = "standard",
4646
similarity = "classic",
4747
store = true,
48-
norms = false
48+
norms = false,
49+
term_vector = "with_positions_offsets"
4950
}
5051
}
5152
};
@@ -81,6 +82,7 @@ public TextPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(cl
8182
.Similarity(SimilarityOption.Classic)
8283
.Store()
8384
.Norms(false)
85+
.TermVector(TermVectorOption.WithPositionsOffsets)
8486
);
8587

8688

@@ -115,7 +117,8 @@ public TextPropertyTests(WritableCluster cluster, EndpointUsage usage) : base(cl
115117
SearchQuoteAnalyzer = "standard",
116118
Similarity = SimilarityOption.Classic,
117119
Store = true,
118-
Norms = false
120+
Norms = false,
121+
TermVector = TermVectorOption.WithPositionsOffsets
119122
}
120123
}
121124
};

0 commit comments

Comments
 (0)