Skip to content

Commit 340f18b

Browse files
comments (generated)
Co-authored-by: Ben Kalmus <ben.kalmus@algolia.com>
1 parent 09465c3 commit 340f18b

File tree

52 files changed

+2177
-640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2177
-640
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Models/Composition/Composition.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ public Composition(string objectID, string name, CompositionBehavior behavior)
6262
[JsonPropertyName("behavior")]
6363
public CompositionBehavior Behavior { get; set; }
6464

65+
/// <summary>
66+
/// A mapping of sorting labels to the indices (or replicas) that implement those sorting rules. The sorting indices MUST be related to the associated main targeted index in the composition. Each key is the label your frontend sends at runtime (for example, \"Price (asc)\"), and each value is the name of the index that should be queried when that label is selected. When a request includes a \"sortBy\" parameter, the platform looks up the corresponding index in this mapping and uses it to execute the query. The main targeted index is replaced with the sorting strategy index it is mapped to. Up to 20 sorting strategies can be defined.
67+
/// </summary>
68+
/// <value>A mapping of sorting labels to the indices (or replicas) that implement those sorting rules. The sorting indices MUST be related to the associated main targeted index in the composition. Each key is the label your frontend sends at runtime (for example, \"Price (asc)\"), and each value is the name of the index that should be queried when that label is selected. When a request includes a \"sortBy\" parameter, the platform looks up the corresponding index in this mapping and uses it to execute the query. The main targeted index is replaced with the sorting strategy index it is mapped to. Up to 20 sorting strategies can be defined. </value>
69+
[JsonPropertyName("sortingStrategy")]
70+
public Dictionary<string, string> SortingStrategy { get; set; }
71+
6572
/// <summary>
6673
/// Returns the string presentation of the object
6774
/// </summary>
@@ -74,6 +81,7 @@ public override string ToString()
7481
sb.Append(" Name: ").Append(Name).Append("\n");
7582
sb.Append(" Description: ").Append(Description).Append("\n");
7683
sb.Append(" Behavior: ").Append(Behavior).Append("\n");
84+
sb.Append(" SortingStrategy: ").Append(SortingStrategy).Append("\n");
7785
sb.Append("}\n");
7886
return sb.ToString();
7987
}
@@ -105,7 +113,13 @@ public override bool Equals(object obj)
105113
Description == input.Description
106114
|| (Description != null && Description.Equals(input.Description))
107115
)
108-
&& (Behavior == input.Behavior || (Behavior != null && Behavior.Equals(input.Behavior)));
116+
&& (Behavior == input.Behavior || (Behavior != null && Behavior.Equals(input.Behavior)))
117+
&& (
118+
SortingStrategy == input.SortingStrategy
119+
|| SortingStrategy != null
120+
&& input.SortingStrategy != null
121+
&& SortingStrategy.SequenceEqual(input.SortingStrategy)
122+
);
109123
}
110124

111125
/// <summary>
@@ -133,6 +147,10 @@ public override int GetHashCode()
133147
{
134148
hashCode = (hashCode * 59) + Behavior.GetHashCode();
135149
}
150+
if (SortingStrategy != null)
151+
{
152+
hashCode = (hashCode * 59) + SortingStrategy.GetHashCode();
153+
}
136154
return hashCode;
137155
}
138156
}

clients/algoliasearch-client-csharp/algoliasearch/Models/Composition/Params.cs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,27 +190,34 @@ public Params() { }
190190
[JsonPropertyName("query")]
191191
public string Query { get; set; }
192192

193-
/// <summary>
194-
/// Relevancy threshold below which less relevant results aren't included in the results You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
195-
/// </summary>
196-
/// <value>Relevancy threshold below which less relevant results aren't included in the results You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results. </value>
197-
[JsonPropertyName("relevancyStrictness")]
198-
public int? RelevancyStrictness { get; set; }
199-
200193
/// <summary>
201194
/// Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first** **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations).
202195
/// </summary>
203196
/// <value>Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first** **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations). </value>
204197
[JsonPropertyName("queryLanguages")]
205198
public List<SupportedLanguage> QueryLanguages { get; set; }
206199

200+
/// <summary>
201+
/// Relevancy threshold below which less relevant results aren't included in the results You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
202+
/// </summary>
203+
/// <value>Relevancy threshold below which less relevant results aren't included in the results You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results. </value>
204+
[JsonPropertyName("relevancyStrictness")]
205+
public int? RelevancyStrictness { get; set; }
206+
207207
/// <summary>
208208
/// Assigns a rule context to the run query [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules.
209209
/// </summary>
210210
/// <value>Assigns a rule context to the run query [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules. </value>
211211
[JsonPropertyName("ruleContexts")]
212212
public List<string> RuleContexts { get; set; }
213213

214+
/// <summary>
215+
/// Indicates which sorting strategy to apply for the request. The value must match one of the labels defined in the \"sortingStrategy\" mapping. For example, \"Price (asc)\", see Upsert Composition. At runtime, this label is used to look up the corresponding index or replica configured in \"sortingStrategy\", and the query is executed using that index instead of main's. In addition to \"sortingStrategy\", this parameter is also used to apply a matching Composition Rule that contains a condition defined to trigger on \"sortBy\", see Composition Rules. If no value is provided or an invalid value, no sorting strategy is applied.
216+
/// </summary>
217+
/// <value>Indicates which sorting strategy to apply for the request. The value must match one of the labels defined in the \"sortingStrategy\" mapping. For example, \"Price (asc)\", see Upsert Composition. At runtime, this label is used to look up the corresponding index or replica configured in \"sortingStrategy\", and the query is executed using that index instead of main's. In addition to \"sortingStrategy\", this parameter is also used to apply a matching Composition Rule that contains a condition defined to trigger on \"sortBy\", see Composition Rules. If no value is provided or an invalid value, no sorting strategy is applied. </value>
218+
[JsonPropertyName("sortBy")]
219+
public string SortBy { get; set; }
220+
214221
/// <summary>
215222
/// Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken).
216223
/// </summary>
@@ -251,9 +258,10 @@ public override string ToString()
251258
sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n");
252259
sb.Append(" Page: ").Append(Page).Append("\n");
253260
sb.Append(" Query: ").Append(Query).Append("\n");
254-
sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n");
255261
sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n");
262+
sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n");
256263
sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n");
264+
sb.Append(" SortBy: ").Append(SortBy).Append("\n");
257265
sb.Append(" UserToken: ").Append(UserToken).Append("\n");
258266
sb.Append("}\n");
259267
return sb.ToString();
@@ -358,22 +366,23 @@ public override bool Equals(object obj)
358366
)
359367
&& (Page == input.Page || Page.Equals(input.Page))
360368
&& (Query == input.Query || (Query != null && Query.Equals(input.Query)))
361-
&& (
362-
RelevancyStrictness == input.RelevancyStrictness
363-
|| RelevancyStrictness.Equals(input.RelevancyStrictness)
364-
)
365369
&& (
366370
QueryLanguages == input.QueryLanguages
367371
|| QueryLanguages != null
368372
&& input.QueryLanguages != null
369373
&& QueryLanguages.SequenceEqual(input.QueryLanguages)
370374
)
375+
&& (
376+
RelevancyStrictness == input.RelevancyStrictness
377+
|| RelevancyStrictness.Equals(input.RelevancyStrictness)
378+
)
371379
&& (
372380
RuleContexts == input.RuleContexts
373381
|| RuleContexts != null
374382
&& input.RuleContexts != null
375383
&& RuleContexts.SequenceEqual(input.RuleContexts)
376384
)
385+
&& (SortBy == input.SortBy || (SortBy != null && SortBy.Equals(input.SortBy)))
377386
&& (UserToken == input.UserToken || (UserToken != null && UserToken.Equals(input.UserToken)));
378387
}
379388

@@ -453,15 +462,19 @@ public override int GetHashCode()
453462
{
454463
hashCode = (hashCode * 59) + Query.GetHashCode();
455464
}
456-
hashCode = (hashCode * 59) + RelevancyStrictness.GetHashCode();
457465
if (QueryLanguages != null)
458466
{
459467
hashCode = (hashCode * 59) + QueryLanguages.GetHashCode();
460468
}
469+
hashCode = (hashCode * 59) + RelevancyStrictness.GetHashCode();
461470
if (RuleContexts != null)
462471
{
463472
hashCode = (hashCode * 59) + RuleContexts.GetHashCode();
464473
}
474+
if (SortBy != null)
475+
{
476+
hashCode = (hashCode * 59) + SortBy.GetHashCode();
477+
}
465478
if (UserToken != null)
466479
{
467480
hashCode = (hashCode * 59) + UserToken.GetHashCode();

clients/algoliasearch-client-dart/packages/client_composition/lib/src/model/composition.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ final class Composition {
1414
required this.name,
1515
this.description,
1616
required this.behavior,
17+
this.sortingStrategy,
1718
});
1819

1920
/// Composition unique identifier.
@@ -31,21 +32,27 @@ final class Composition {
3132
@JsonKey(name: r'behavior')
3233
final CompositionBehavior behavior;
3334

35+
/// A mapping of sorting labels to the indices (or replicas) that implement those sorting rules. The sorting indices MUST be related to the associated main targeted index in the composition. Each key is the label your frontend sends at runtime (for example, \"Price (asc)\"), and each value is the name of the index that should be queried when that label is selected. When a request includes a \"sortBy\" parameter, the platform looks up the corresponding index in this mapping and uses it to execute the query. The main targeted index is replaced with the sorting strategy index it is mapped to. Up to 20 sorting strategies can be defined.
36+
@JsonKey(name: r'sortingStrategy')
37+
final Map<String, String>? sortingStrategy;
38+
3439
@override
3540
bool operator ==(Object other) =>
3641
identical(this, other) ||
3742
other is Composition &&
3843
other.objectID == objectID &&
3944
other.name == name &&
4045
other.description == description &&
41-
other.behavior == behavior;
46+
other.behavior == behavior &&
47+
other.sortingStrategy == sortingStrategy;
4248

4349
@override
4450
int get hashCode =>
4551
objectID.hashCode +
4652
name.hashCode +
4753
description.hashCode +
48-
behavior.hashCode;
54+
behavior.hashCode +
55+
sortingStrategy.hashCode;
4956

5057
factory Composition.fromJson(Map<String, dynamic> json) =>
5158
_$CompositionFromJson(json);

clients/algoliasearch-client-dart/packages/client_composition/lib/src/model/composition.g.dart

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-dart/packages/client_composition/lib/src/model/params.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ final class Params {
3636
this.optionalFilters,
3737
this.page,
3838
this.query,
39-
this.relevancyStrictness,
4039
this.queryLanguages,
40+
this.relevancyStrictness,
4141
this.ruleContexts,
42+
this.sortBy,
4243
this.userToken,
4344
});
4445

@@ -161,18 +162,22 @@ final class Params {
161162
@JsonKey(name: r'query')
162163
final String? query;
163164

164-
/// Relevancy threshold below which less relevant results aren't included in the results You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
165-
@JsonKey(name: r'relevancyStrictness')
166-
final int? relevancyStrictness;
167-
168165
/// Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages. To support this, you must place the CJK language **first** **You should always specify a query language.** If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages), or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This can lead to unexpected search results. For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations).
169166
@JsonKey(name: r'queryLanguages')
170167
final List<SupportedLanguage>? queryLanguages;
171168

169+
/// Relevancy threshold below which less relevant results aren't included in the results You can only set `relevancyStrictness` on [virtual replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas). Use this setting to strike a balance between the relevance and number of returned results.
170+
@JsonKey(name: r'relevancyStrictness')
171+
final int? relevancyStrictness;
172+
172173
/// Assigns a rule context to the run query [Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules.
173174
@JsonKey(name: r'ruleContexts')
174175
final List<String>? ruleContexts;
175176

177+
/// Indicates which sorting strategy to apply for the request. The value must match one of the labels defined in the \"sortingStrategy\" mapping. For example, \"Price (asc)\", see Upsert Composition. At runtime, this label is used to look up the corresponding index or replica configured in \"sortingStrategy\", and the query is executed using that index instead of main's. In addition to \"sortingStrategy\", this parameter is also used to apply a matching Composition Rule that contains a condition defined to trigger on \"sortBy\", see Composition Rules. If no value is provided or an invalid value, no sorting strategy is applied.
178+
@JsonKey(name: r'sortBy')
179+
final String? sortBy;
180+
176181
/// Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken).
177182
@JsonKey(name: r'userToken')
178183
final String? userToken;
@@ -206,9 +211,10 @@ final class Params {
206211
other.optionalFilters == optionalFilters &&
207212
other.page == page &&
208213
other.query == query &&
209-
other.relevancyStrictness == relevancyStrictness &&
210214
other.queryLanguages == queryLanguages &&
215+
other.relevancyStrictness == relevancyStrictness &&
211216
other.ruleContexts == ruleContexts &&
217+
other.sortBy == sortBy &&
212218
other.userToken == userToken;
213219

214220
@override
@@ -238,9 +244,10 @@ final class Params {
238244
optionalFilters.hashCode +
239245
page.hashCode +
240246
query.hashCode +
241-
relevancyStrictness.hashCode +
242247
queryLanguages.hashCode +
248+
relevancyStrictness.hashCode +
243249
ruleContexts.hashCode +
250+
sortBy.hashCode +
244251
userToken.hashCode;
245252

246253
factory Params.fromJson(Map<String, dynamic> json) => _$ParamsFromJson(json);

0 commit comments

Comments
 (0)