Skip to content

Commit f38c1ba

Browse files
feat(specs): allow enablePersonalization query parameter at run time for Composition API (generated)
algolia/api-clients-automation#5651 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clara Muller <[email protected]>
1 parent d9146de commit f38c1ba

File tree

1 file changed

+77
-74
lines changed

1 file changed

+77
-74
lines changed

algoliasearch/composition/models/params.py

Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,35 @@
2828
from algoliasearch.composition.models.supported_language import SupportedLanguage
2929

3030
_ALIASES = {
31-
"query": "query",
32-
"filters": "filters",
33-
"page": "page",
34-
"get_ranking_info": "getRankingInfo",
35-
"relevancy_strictness": "relevancyStrictness",
36-
"facet_filters": "facetFilters",
37-
"facets": "facets",
38-
"optional_filters": "optionalFilters",
39-
"numeric_filters": "numericFilters",
40-
"hits_per_page": "hitsPerPage",
31+
"analytics": "analytics",
32+
"analytics_tags": "analyticsTags",
4133
"around_lat_lng": "aroundLatLng",
4234
"around_lat_lng_via_ip": "aroundLatLngViaIP",
4335
"around_radius": "aroundRadius",
4436
"around_precision": "aroundPrecision",
45-
"minimum_around_radius": "minimumAroundRadius",
37+
"click_analytics": "clickAnalytics",
38+
"enable_ab_test": "enableABTest",
39+
"enable_personalization": "enablePersonalization",
40+
"enable_re_ranking": "enableReRanking",
41+
"enable_rules": "enableRules",
42+
"facet_filters": "facetFilters",
43+
"facets": "facets",
44+
"filters": "filters",
45+
"get_ranking_info": "getRankingInfo",
46+
"hits_per_page": "hitsPerPage",
47+
"injected_items": "injectedItems",
4648
"inside_bounding_box": "insideBoundingBox",
4749
"inside_polygon": "insidePolygon",
48-
"query_languages": "queryLanguages",
50+
"minimum_around_radius": "minimumAroundRadius",
4951
"natural_languages": "naturalLanguages",
50-
"enable_rules": "enableRules",
52+
"numeric_filters": "numericFilters",
53+
"optional_filters": "optionalFilters",
54+
"page": "page",
55+
"query": "query",
56+
"relevancy_strictness": "relevancyStrictness",
57+
"query_languages": "queryLanguages",
5158
"rule_contexts": "ruleContexts",
5259
"user_token": "userToken",
53-
"click_analytics": "clickAnalytics",
54-
"analytics": "analytics",
55-
"analytics_tags": "analyticsTags",
56-
"enable_ab_test": "enableABTest",
57-
"enable_re_ranking": "enableReRanking",
58-
"injected_items": "injectedItems",
5960
}
6061

6162

@@ -68,56 +69,58 @@ class Params(BaseModel):
6869
Params
6970
"""
7071

71-
query: Optional[str] = None
72-
""" Search query. """
73-
filters: Optional[str] = None
74-
""" Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering). """
75-
page: Optional[int] = None
76-
""" Page of search results to retrieve. """
77-
get_ranking_info: Optional[bool] = None
78-
""" Whether the run response should include detailed ranking information. """
79-
relevancy_strictness: Optional[int] = None
80-
""" 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. """
81-
facet_filters: Optional[FacetFilters] = None
82-
facets: Optional[List[str]] = None
83-
""" Facets for which to retrieve facet values that match the search criteria and the number of matching facet values To retrieve all facets, use the wildcard character `*`. To retrieve disjunctive facets lists, annotate any facets with the `disjunctive` modifier. For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts) and [disjunctive faceting for Smart Groups](https://www.algolia.com/doc/guides/managing-results/compositions/search-based-groups#facets-including-disjunctive-faceting). """
84-
optional_filters: Optional[OptionalFilters] = None
85-
numeric_filters: Optional[NumericFilters] = None
86-
hits_per_page: Optional[int] = None
87-
""" Number of hits per page. """
72+
analytics: Optional[bool] = None
73+
""" Whether this search will be included in Analytics. """
74+
analytics_tags: Optional[List[str]] = None
75+
""" Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments). """
8876
around_lat_lng: Optional[str] = None
8977
""" Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude. Only records included within a circle around this central location are included in the results. The radius of the circle is determined by the `aroundRadius` and `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` or `insideBoundingBox`. """
9078
around_lat_lng_via_ip: Optional[bool] = None
9179
""" Whether to obtain the coordinates from the request's IP address. """
9280
around_radius: Optional[AroundRadius] = None
9381
around_precision: Optional[AroundPrecision] = None
94-
minimum_around_radius: Optional[int] = None
95-
""" Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. """
82+
click_analytics: Optional[bool] = None
83+
""" Whether to include a `queryID` attribute in the response The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/doc/guides/sending-events/getting-started). """
84+
enable_ab_test: Optional[bool] = None
85+
""" Whether to enable index level A/B testing for this run request. If the composition mixes multiple indices, the A/B test is ignored. """
86+
enable_personalization: Optional[bool] = None
87+
""" Whether to enable Personalization. """
88+
enable_re_ranking: Optional[bool] = None
89+
""" Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. """
90+
enable_rules: Optional[bool] = None
91+
""" Whether to enable composition rules. """
92+
facet_filters: Optional[FacetFilters] = None
93+
facets: Optional[List[str]] = None
94+
""" Facets for which to retrieve facet values that match the search criteria and the number of matching facet values To retrieve all facets, use the wildcard character `*`. To retrieve disjunctive facets lists, annotate any facets with the `disjunctive` modifier. For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts) and [disjunctive faceting for Smart Groups](https://www.algolia.com/doc/guides/managing-results/compositions/search-based-groups#facets-including-disjunctive-faceting). """
95+
filters: Optional[str] = None
96+
""" Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering). """
97+
get_ranking_info: Optional[bool] = None
98+
""" Whether the run response should include detailed ranking information. """
99+
hits_per_page: Optional[int] = None
100+
""" Number of hits per page. """
101+
injected_items: Optional[Dict[str, ExternalInjectedItem]] = None
102+
""" A list of extenrally injected objectID groups into from an external source. """
96103
inside_bounding_box: Optional[InsideBoundingBox] = None
97104
inside_polygon: Optional[List[List[float]]] = None
98105
""" 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`. """
99-
query_languages: Optional[List[SupportedLanguage]] = None
100-
""" 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). """
106+
minimum_around_radius: Optional[int] = None
107+
""" Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. """
101108
natural_languages: Optional[List[SupportedLanguage]] = None
102109
""" 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`. """
103-
enable_rules: Optional[bool] = None
104-
""" Whether to enable composition rules. """
110+
numeric_filters: Optional[NumericFilters] = None
111+
optional_filters: Optional[OptionalFilters] = None
112+
page: Optional[int] = None
113+
""" Page of search results to retrieve. """
114+
query: Optional[str] = None
115+
""" Search query. """
116+
relevancy_strictness: Optional[int] = None
117+
""" 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. """
118+
query_languages: Optional[List[SupportedLanguage]] = None
119+
""" 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). """
105120
rule_contexts: Optional[List[str]] = None
106121
""" 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. """
107122
user_token: Optional[str] = None
108123
""" 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). """
109-
click_analytics: Optional[bool] = None
110-
""" Whether to include a `queryID` attribute in the response The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/doc/guides/sending-events/getting-started). """
111-
analytics: Optional[bool] = None
112-
""" Whether this search will be included in Analytics. """
113-
analytics_tags: Optional[List[str]] = None
114-
""" Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments). """
115-
enable_ab_test: Optional[bool] = None
116-
""" Whether to enable index level A/B testing for this run request. If the composition mixes multiple indices, the A/B test is ignored. """
117-
enable_re_ranking: Optional[bool] = None
118-
""" Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. """
119-
injected_items: Optional[Dict[str, ExternalInjectedItem]] = None
120-
""" A list of extenrally injected objectID groups into from an external source. """
121124

122125
model_config = ConfigDict(
123126
strict=False,
@@ -154,21 +157,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
154157
if not isinstance(obj, dict):
155158
return cls.model_validate(obj)
156159

157-
obj["facetFilters"] = (
158-
FacetFilters.from_dict(obj["facetFilters"])
159-
if obj.get("facetFilters") is not None
160-
else None
161-
)
162-
obj["optionalFilters"] = (
163-
OptionalFilters.from_dict(obj["optionalFilters"])
164-
if obj.get("optionalFilters") is not None
165-
else None
166-
)
167-
obj["numericFilters"] = (
168-
NumericFilters.from_dict(obj["numericFilters"])
169-
if obj.get("numericFilters") is not None
170-
else None
171-
)
172160
obj["aroundRadius"] = (
173161
AroundRadius.from_dict(obj["aroundRadius"])
174162
if obj.get("aroundRadius") is not None
@@ -179,13 +167,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
179167
if obj.get("aroundPrecision") is not None
180168
else None
181169
)
182-
obj["insideBoundingBox"] = (
183-
InsideBoundingBox.from_dict(obj["insideBoundingBox"])
184-
if obj.get("insideBoundingBox") is not None
170+
obj["facetFilters"] = (
171+
FacetFilters.from_dict(obj["facetFilters"])
172+
if obj.get("facetFilters") is not None
185173
else None
186174
)
187-
obj["queryLanguages"] = obj.get("queryLanguages")
188-
obj["naturalLanguages"] = obj.get("naturalLanguages")
189175
obj["injectedItems"] = (
190176
dict(
191177
(_k, ExternalInjectedItem.from_dict(_v))
@@ -194,5 +180,22 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
194180
if obj.get("injectedItems") is not None
195181
else None
196182
)
183+
obj["insideBoundingBox"] = (
184+
InsideBoundingBox.from_dict(obj["insideBoundingBox"])
185+
if obj.get("insideBoundingBox") is not None
186+
else None
187+
)
188+
obj["naturalLanguages"] = obj.get("naturalLanguages")
189+
obj["numericFilters"] = (
190+
NumericFilters.from_dict(obj["numericFilters"])
191+
if obj.get("numericFilters") is not None
192+
else None
193+
)
194+
obj["optionalFilters"] = (
195+
OptionalFilters.from_dict(obj["optionalFilters"])
196+
if obj.get("optionalFilters") is not None
197+
else None
198+
)
199+
obj["queryLanguages"] = obj.get("queryLanguages")
197200

198201
return cls.model_validate(obj)

0 commit comments

Comments
 (0)