Skip to content

Commit

Permalink
adds the field parameter 'stem' (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen authored Jul 2, 2024
1 parent 515804f commit 1276493
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 19 deletions.
3 changes: 3 additions & 0 deletions src/Typesense/Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public record Field
[JsonPropertyName("reference")]
public string? Reference { get; init; }

[JsonPropertyName("stem")]
public bool? Stem { get; init; }

// This constructor is made to handle inherited classes.
protected Field(string name)
{
Expand Down
88 changes: 69 additions & 19 deletions test/Typesense.Tests/TypesenseClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ public async Task Create_schema()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
"num_employees",
type: FieldType.Int32,
Expand All @@ -87,7 +90,10 @@ public async Task Create_schema()
index: true,
sort: true,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "location",
type: FieldType.Object,
Expand All @@ -96,7 +102,10 @@ public async Task Create_schema()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
},
"num_employees",
new List<string>(),
Expand Down Expand Up @@ -137,7 +146,10 @@ public async Task Create_schema_symbols_to_index_and_token_seperator()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "num_employees",
type: FieldType.Int32,
Expand All @@ -146,7 +158,10 @@ public async Task Create_schema_symbols_to_index_and_token_seperator()
index: true,
sort: true,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "location",
type: FieldType.Object,
Expand All @@ -155,7 +170,10 @@ public async Task Create_schema_symbols_to_index_and_token_seperator()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
},
"num_employees",
new List<string> { "-" },
Expand Down Expand Up @@ -203,7 +221,10 @@ public async Task Create_schema_with_wildcard_field()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
},
"",
new List<string>(),
Expand Down Expand Up @@ -245,8 +266,10 @@ public async Task Create_schema_with_locale_on_field()
index: true,
sort: false,
infix: false,
locale: "zh"
),
locale: "zh")
{
Stem = false
},
},
"",
new List<string>(),
Expand Down Expand Up @@ -288,7 +311,10 @@ public async Task Retrieve_collection()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "num_employees",
type: FieldType.Int32,
Expand All @@ -297,7 +323,10 @@ public async Task Retrieve_collection()
index: true,
sort: true,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
"location",
type: FieldType.Object,
Expand All @@ -306,7 +335,10 @@ public async Task Retrieve_collection()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
},
"num_employees",
new List<string>(),
Expand Down Expand Up @@ -336,7 +368,10 @@ public async Task Retrieve_collections()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "num_employees",
type: FieldType.Int32,
Expand All @@ -345,7 +380,10 @@ public async Task Retrieve_collections()
index: true,
sort: true,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "location",
type: FieldType.Object,
Expand All @@ -354,7 +392,10 @@ public async Task Retrieve_collections()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
}
},
"num_employees",
new List<string>(),
Expand Down Expand Up @@ -401,7 +442,10 @@ public async Task Delete_collection()
index: true,
sort: true,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "location",
type: FieldType.Object,
Expand All @@ -410,7 +454,10 @@ public async Task Delete_collection()
index: true,
sort: false,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
new Field(
name: "non_profit",
type: FieldType.Bool,
Expand All @@ -419,7 +466,10 @@ public async Task Delete_collection()
index: true,
sort: true,
infix: false,
locale: ""),
locale: "")
{
Stem = false
},
},
"num_employees",
new List<string>(),
Expand Down Expand Up @@ -1951,4 +2001,4 @@ private async Task CreateCompanyCollection()

_ = await _client.CreateCollection(schema);
}
}
}

0 comments on commit 1276493

Please sign in to comment.