Skip to content

Commit db1b3c7

Browse files
algolia-botmillotp
andcommitted
fix(specs): make the searchParams compatible with v4 [skip-bc] (generated)
algolia/api-clients-automation#4108 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent fe4a888 commit db1b3c7

15 files changed

+250
-88
lines changed

client/src/commonMain/kotlin/com/algolia/client/extensions/SearchForHits.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public fun SearchForHits.Companion.from(
8484
replaceSynonymsInHighlight = searchParamsObject.replaceSynonymsInHighlight,
8585
minProximity = searchParamsObject.minProximity,
8686
responseFields = searchParamsObject.responseFields,
87-
maxFacetHits = searchParamsObject.maxFacetHits,
8887
maxValuesPerFacet = searchParamsObject.maxValuesPerFacet,
8988
sortFacetValuesBy = searchParamsObject.sortFacetValuesBy,
9089
attributeCriteriaComputedByMinProximity = searchParamsObject.attributeCriteriaComputedByMinProximity,

client/src/commonMain/kotlin/com/algolia/client/model/recommend/FallbackParams.kt

Lines changed: 8 additions & 10 deletions
Large diffs are not rendered by default.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.recommend
3+
4+
import com.algolia.client.exception.AlgoliaClientException
5+
import com.algolia.client.extensions.internal.*
6+
import kotlinx.serialization.*
7+
import kotlinx.serialization.builtins.*
8+
import kotlinx.serialization.descriptors.*
9+
import kotlinx.serialization.encoding.*
10+
import kotlinx.serialization.json.*
11+
import kotlin.jvm.JvmInline
12+
13+
/**
14+
* InsideBoundingBox
15+
*
16+
* Implementations:
17+
* - [List<List<Double>>] - *[InsideBoundingBox.of]*
18+
* - [String] - *[InsideBoundingBox.of]*
19+
*/
20+
@Serializable(InsideBoundingBoxSerializer::class)
21+
public sealed interface InsideBoundingBox {
22+
@Serializable
23+
@JvmInline
24+
public value class StringValue(public val value: String) : InsideBoundingBox
25+
26+
@Serializable
27+
@JvmInline
28+
public value class ListOfListOfDoubleValue(public val value: List<List<Double>>) : InsideBoundingBox
29+
30+
public companion object {
31+
32+
public fun of(value: String): InsideBoundingBox {
33+
return StringValue(value)
34+
}
35+
public fun of(value: List<List<Double>>): InsideBoundingBox {
36+
return ListOfListOfDoubleValue(value)
37+
}
38+
}
39+
}
40+
41+
internal class InsideBoundingBoxSerializer : JsonContentPolymorphicSerializer<InsideBoundingBox>(InsideBoundingBox::class) {
42+
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<InsideBoundingBox> {
43+
return when {
44+
element.isString -> InsideBoundingBox.StringValue.serializer()
45+
element is JsonArray -> InsideBoundingBox.ListOfListOfDoubleValue.serializer()
46+
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
47+
}
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/** Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. */
2+
package com.algolia.client.model.recommend
3+
4+
import com.algolia.client.exception.AlgoliaClientException
5+
import com.algolia.client.extensions.internal.*
6+
import kotlinx.serialization.*
7+
import kotlinx.serialization.builtins.*
8+
import kotlinx.serialization.descriptors.*
9+
import kotlinx.serialization.encoding.*
10+
import kotlinx.serialization.json.*
11+
import kotlin.jvm.JvmInline
12+
13+
/**
14+
* OptionalWords
15+
*
16+
* Implementations:
17+
* - [List<String>] - *[OptionalWords.of]*
18+
* - [String] - *[OptionalWords.of]*
19+
*/
20+
@Serializable(OptionalWordsSerializer::class)
21+
public sealed interface OptionalWords {
22+
@Serializable
23+
@JvmInline
24+
public value class StringValue(public val value: String) : OptionalWords
25+
26+
@Serializable
27+
@JvmInline
28+
public value class ListOfStringValue(public val value: List<String>) : OptionalWords
29+
30+
public companion object {
31+
32+
public fun of(value: String): OptionalWords {
33+
return StringValue(value)
34+
}
35+
public fun of(value: List<String>): OptionalWords {
36+
return ListOfStringValue(value)
37+
}
38+
}
39+
}
40+
41+
internal class OptionalWordsSerializer : JsonContentPolymorphicSerializer<OptionalWords>(OptionalWords::class) {
42+
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<OptionalWords> {
43+
return when {
44+
element.isString -> OptionalWords.StringValue.serializer()
45+
element is JsonArray -> OptionalWords.ListOfStringValue.serializer()
46+
else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
47+
}
48+
}
49+
}

client/src/commonMain/kotlin/com/algolia/client/model/recommend/RecommendSearchParams.kt

Lines changed: 8 additions & 10 deletions
Large diffs are not rendered by default.

client/src/commonMain/kotlin/com/algolia/client/model/search/BrowseParamsObject.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import kotlinx.serialization.json.*
2626
* @param aroundRadius
2727
* @param aroundPrecision
2828
* @param minimumAroundRadius Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
29-
* @param insideBoundingBox Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
29+
* @param insideBoundingBox
3030
* @param insidePolygon Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`.
3131
* @param naturalLanguages ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches): - Sets `removeStopWords` and `ignorePlurals` to the list of provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.
3232
* @param ruleContexts Assigns a rule context to the search 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.
@@ -67,7 +67,7 @@ import kotlinx.serialization.json.*
6767
* @param mode
6868
* @param semanticSearch
6969
* @param advancedSyntax Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported.
70-
* @param optionalWords Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
70+
* @param optionalWords
7171
* @param disableExactOnAttributes Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.
7272
* @param exactOnSingleWordQuery
7373
* @param alternativesAsExact Determine which plurals and synonyms should be considered an exact matches. By default, Algolia treats singular and plural forms of a word, and single-word synonyms, as [exact](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#exact) matches when searching. For example: - \"swimsuit\" and \"swimsuits\" are treated the same - \"swimsuit\" and \"swimwear\" are treated the same (if they are [synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#regular-synonyms)). - `ignorePlurals`. Plurals and similar declensions added by the `ignorePlurals` setting are considered exact matches. - `singleWordSynonym`. Single-word synonyms, such as \"NY\" = \"NYC\", are considered exact matches. - `multiWordsSynonym`. Multi-word synonyms, such as \"NY\" = \"New York\", are considered exact matches.
@@ -76,7 +76,6 @@ import kotlinx.serialization.json.*
7676
* @param replaceSynonymsInHighlight Whether to replace a highlighted word with the matched synonym. By default, the original words are highlighted even if a synonym matches. For example, with `home` as a synonym for `house` and a search for `home`, records matching either \"home\" or \"house\" are included in the search results, and either \"home\" or \"house\" are highlighted. With `replaceSynonymsInHighlight` set to `true`, a search for `home` still matches the same records, but all occurrences of \"house\" are replaced by \"home\" in the highlighted response.
7777
* @param minProximity Minimum proximity score for two matching words. This adjusts the [Proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity) by equally scoring matches that are farther apart. For example, if `minProximity` is 2, neighboring matches and matches with one word between them would have the same score.
7878
* @param responseFields Properties to include in the API response of `search` and `browse` requests. By default, all response properties are included. To reduce the response size, you can select, which attributes should be included. You can't exclude these properties: `message`, `warning`, `cursor`, `serverUsed`, `indexUsed`, `abTestVariantID`, `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you might need in your search UI.
79-
* @param maxFacetHits Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
8079
* @param maxValuesPerFacet Maximum number of facet values to return for each facet.
8180
* @param sortFacetValuesBy Order in which to retrieve facet values. - `count`. Facet values are retrieved by decreasing count. The count is the number of matching records containing this facet value. - `alpha`. Retrieve facet values alphabetically. This setting doesn't influence how facet values are displayed in your UI (see `renderingContent`). For more information, see [facet value display](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/facet-display/js/).
8281
* @param attributeCriteriaComputedByMinProximity Whether the best matching attribute should be determined by minimum proximity. This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the `ranking` setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the `searchableAttributes` setting.
@@ -139,8 +138,7 @@ public data class BrowseParamsObject(
139138
/** Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. */
140139
@SerialName(value = "minimumAroundRadius") val minimumAroundRadius: Int? = null,
141140

142-
/** Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). */
143-
@SerialName(value = "insideBoundingBox") val insideBoundingBox: List<List<Double>>? = null,
141+
@SerialName(value = "insideBoundingBox") val insideBoundingBox: InsideBoundingBox? = null,
144142

145143
/** Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`. */
146144
@SerialName(value = "insidePolygon") val insidePolygon: List<List<Double>>? = null,
@@ -255,8 +253,7 @@ public data class BrowseParamsObject(
255253
/** Whether to support phrase matching and excluding words from search queries. Use the `advancedSyntaxFeatures` parameter to control which feature is supported. */
256254
@SerialName(value = "advancedSyntax") val advancedSyntax: Boolean? = null,
257255

258-
/** Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). */
259-
@SerialName(value = "optionalWords") val optionalWords: List<String>? = null,
256+
@SerialName(value = "optionalWords") val optionalWords: OptionalWords? = null,
260257

261258
/** Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking. */
262259
@SerialName(value = "disableExactOnAttributes") val disableExactOnAttributes: List<String>? = null,
@@ -280,9 +277,6 @@ public data class BrowseParamsObject(
280277
/** Properties to include in the API response of `search` and `browse` requests. By default, all response properties are included. To reduce the response size, you can select, which attributes should be included. You can't exclude these properties: `message`, `warning`, `cursor`, `serverUsed`, `indexUsed`, `abTestVariantID`, `parsedQuery`, or any property triggered by the `getRankingInfo` parameter. Don't exclude properties that you might need in your search UI. */
281278
@SerialName(value = "responseFields") val responseFields: List<String>? = null,
282279

283-
/** Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). */
284-
@SerialName(value = "maxFacetHits") val maxFacetHits: Int? = null,
285-
286280
/** Maximum number of facet values to return for each facet. */
287281
@SerialName(value = "maxValuesPerFacet") val maxValuesPerFacet: Int? = null,
288282

0 commit comments

Comments
 (0)