Skip to content

Commit 3afe41e

Browse files
author
xiaozhiqing.xzq
committed
fix #20
1 parent b756a0a commit 3afe41e

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- 阿里云表格存储是构建在阿里云飞天分布式系统之上的NoSQL数据存储服务,提供海量结构化数据的存储和实时访问。
1010

1111
## 版本
12-
- 当前版本:6.0.0
12+
- 当前版本:6.0.2
1313

1414
## 运行环境
1515
### Windows

sample/Samples/SearchIndexSample.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class SearchIndexSample
2828
private static readonly string Date_type_col = "Data_type_col";
2929
private static readonly string Geo_type_col = "Geo_type_col";
3030
private static readonly string Virtual_col_Text = "Virtual_col_Text";
31+
private static readonly string Nested_type_col = "Nested_type_col";
3132

3233
static void Main(string[] args)
3334
{
@@ -93,7 +94,7 @@ static void Main(string[] args)
9394
DeleteTable(otsClient);
9495

9596
Console.WriteLine("SearchIndexSample Finish!");
96-
Console.ReadLine();
97+
Console.ReadKey();
9798
}
9899

99100
public static void CreateTable(OTSClient otsClient)
@@ -190,6 +191,19 @@ public static void CreateSearchIndex(OTSClient otsClient)
190191
Delimiter=" "
191192
}
192193
},
194+
// 构建嵌套列
195+
new FieldSchema(Nested_type_col, FieldType.NESTED) {
196+
SubFieldSchemas=new List<FieldSchema>{
197+
new FieldSchema("LastName", FieldType.TEXT) {
198+
index=true,
199+
Store=true
200+
},
201+
new FieldSchema("FirtName", FieldType.TEXT) {
202+
index=true,
203+
Store=true
204+
}
205+
}
206+
},
193207
// 构建日期列
194208
new FieldSchema(Date_type_col, FieldType.DATE) {
195209
index = true,

sdk/Aliyun/OTS/DataModel/Search/FieldSchema.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class FieldSchema
3030
/// <summary>
3131
/// 倒排索引的配置选项
3232
/// </summary>
33-
public IndexOptions IndexOptions { get; set; }
33+
public IndexOptions? IndexOptions { get; set; }
3434
/// <summary>
3535
/// 分词器设置
3636
/// </summary>

sdk/Aliyun/OTS/ProtoBuffer/ProtocolBufferDecoder.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -615,11 +615,16 @@ private DataModel.Search.FieldSchema ParseFieldSchema(PB.FieldSchema fieldSchema
615615
{
616616
ret.Analyzer = ParseAnalyzer(fieldSchema.Analyzer);
617617
}
618+
618619
ret.EnableSortAndAgg = fieldSchema.DocValues;
619620
ret.index = fieldSchema.Index;
620621
ret.Store = fieldSchema.Store;
621622
ret.IsArray = fieldSchema.IsArray;
622-
ret.IndexOptions = ParseIndexOption(fieldSchema.IndexOptions);
623+
624+
if (fieldSchema.FieldType != PB.FieldType.NESTED)
625+
{
626+
ret.IndexOptions = ParseIndexOption(fieldSchema.IndexOptions);
627+
}
623628

624629
if (fieldSchema.HasAnalyzerParameter && fieldSchema.HasAnalyzer)
625630
{

sdk/Aliyun/OTS/ProtoBuffer/ProtocolBufferEncoder.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,10 @@ private PB.FieldSchema EncodingFieldSchema(DataModel.Search.FieldSchema fieldSch
579579
builder.IsArray = fieldSchema.IsArray;
580580
}
581581

582-
builder.IndexOptions = EncodingIndexOptions(fieldSchema.IndexOptions);
582+
if (fieldSchema.IndexOptions.HasValue)
583+
{
584+
builder.IndexOptions = EncodingIndexOptions(fieldSchema.IndexOptions.Value);
585+
}
583586

584587
if (fieldSchema.Analyzer.HasValue)
585588
{

sdk/aliyun-tablestore-sdk.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<PackageId>Aliyun.TableStore.SDK</PackageId>
66
<AssemblyName>Aliyun.TableStore.SDK</AssemblyName>
77
<authors>aliyun</authors>
8-
<Version>6.0.1</Version>
8+
<Version>6.0.2</Version>
99
<Description>Aliyun Table Store SDK for .NetCore and .NETFrameWork</Description>
1010
<Copyright>Copyright (c) 2009-2022 aliyun.com</Copyright>
11-
<ReleaseNotes>Support NetStandard2.0; Compatible NetFrameWork4.0.</ReleaseNotes>
11+
<ReleaseNotes>fix bug cause by nested fieldtype when create search index</ReleaseNotes>
1212
<PackageProjectUrl>https://github.com/aliyun/aliyun-tablestore-csharp-sdk</PackageProjectUrl>
1313
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1414
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
@@ -34,4 +34,4 @@
3434
<Version>2.0.20710</Version>
3535
</PackageReference>
3636
</ItemGroup>
37-
</Project>
37+
</Project>

0 commit comments

Comments
 (0)