Skip to content

Commit c02185b

Browse files
algolia-botClaraMullermillotp
committed
feat(specs): add facets query parameter available at run time (generated)
algolia/api-clients-automation#5486 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clara Muller <5667350+ClaraMuller@users.noreply.github.com> Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
1 parent d7691b2 commit c02185b

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

lib/algolia/models/composition/facet_ordering.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def self.attribute_map
2525
# Attribute type mapping.
2626
def self.types_mapping
2727
{
28-
:facets => :"Facets",
28+
:facets => :"IndexSettingsFacets",
2929
:values => :"Hash<String, Value>"
3030
}
3131
end

lib/algolia/models/composition/facets.rb renamed to lib/algolia/models/composition/index_settings_facets.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module Algolia
99
module Composition
1010
# Order of facet names.
11-
class Facets
11+
class IndexSettingsFacets
1212
# Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list.
1313
attr_accessor :order
1414

@@ -37,15 +37,18 @@ def self.openapi_nullable
3737
# @param [Hash] attributes Model attributes in the form of hash
3838
def initialize(attributes = {})
3939
if (!attributes.is_a?(Hash))
40-
raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::Facets` initialize method"
40+
raise(
41+
ArgumentError,
42+
"The input argument (attributes) must be a hash in `Algolia::IndexSettingsFacets` initialize method"
43+
)
4144
end
4245

4346
# check to see if the attribute exists and convert string to symbol for hash key
4447
attributes = attributes.each_with_object({}) { |(k, v), h|
4548
if (!self.class.attribute_map.key?(k.to_sym))
4649
raise(
4750
ArgumentError,
48-
"`#{k}` is not a valid attribute in `Algolia::Facets`. Please check the name to make sure it's valid. List of attributes: " +
51+
"`#{k}` is not a valid attribute in `Algolia::IndexSettingsFacets`. Please check the name to make sure it's valid. List of attributes: " +
4952
self.class.attribute_map.keys.inspect
5053
)
5154
end

lib/algolia/models/composition/params.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class Params
2323
# 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.
2424
attr_accessor :relevancy_strictness
2525

26+
# 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 `*`. For more information, see [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts).
27+
attr_accessor :facets
28+
2629
attr_accessor :facet_filters
2730

2831
attr_accessor :optional_filters
@@ -91,6 +94,7 @@ def self.attribute_map
9194
:page => :page,
9295
:get_ranking_info => :getRankingInfo,
9396
:relevancy_strictness => :relevancyStrictness,
97+
:facets => :facets,
9498
:facet_filters => :facetFilters,
9599
:optional_filters => :optionalFilters,
96100
:numeric_filters => :numericFilters,
@@ -124,6 +128,7 @@ def self.types_mapping
124128
:page => :"Integer",
125129
:get_ranking_info => :"Boolean",
126130
:relevancy_strictness => :"Integer",
131+
:facets => :"Array<String>",
127132
:facet_filters => :"FacetFilters",
128133
:optional_filters => :"OptionalFilters",
129134
:numeric_filters => :"NumericFilters",
@@ -198,6 +203,12 @@ def initialize(attributes = {})
198203
self.relevancy_strictness = attributes[:relevancy_strictness]
199204
end
200205

206+
if attributes.key?(:facets)
207+
if (value = attributes[:facets]).is_a?(Array)
208+
self.facets = value
209+
end
210+
end
211+
201212
if attributes.key?(:facet_filters)
202213
self.facet_filters = attributes[:facet_filters]
203214
end
@@ -309,6 +320,7 @@ def ==(other)
309320
page == other.page &&
310321
get_ranking_info == other.get_ranking_info &&
311322
relevancy_strictness == other.relevancy_strictness &&
323+
facets == other.facets &&
312324
facet_filters == other.facet_filters &&
313325
optional_filters == other.optional_filters &&
314326
numeric_filters == other.numeric_filters &&
@@ -348,6 +360,7 @@ def hash
348360
page,
349361
get_ranking_info,
350362
relevancy_strictness,
363+
facets,
351364
facet_filters,
352365
optional_filters,
353366
numeric_filters,

0 commit comments

Comments
 (0)