CIOBrowseQuery
public struct CIOBrowseQuery : CIORequestData
Struct encapsulating the necessary and additional parameters required to execute a browse query.
-
The primary filter name that the user browsed for
Declaration
Swift
public let filterName: String -
The primary filter value that the user browsed for
Declaration
Swift
public let filterValue: String -
The filters used to refine results
Declaration
Swift
public let filters: CIOQueryFilters? -
The page number of the results
Declaration
Swift
public let page: Int -
The number of results per page to return
Declaration
Swift
public let perPage: Int -
The sort method/order for results
Declaration
Swift
public let sortOption: CIOSortOption? -
The section to return results from
Declaration
Swift
public let section: String -
The list of hidden metadata fields to return
Declaration
Swift
public let hiddenFields: [String]? -
The list of hidden facet fields to return
Declaration
Swift
public let hiddenFacets: [String]? -
The sort method/order for groups
Declaration
Swift
public let groupsSortOption: CIOGroupsSortOption? -
The pre filter expression used to refine results Please refer to our docs for the syntax on adding pre filter expressions: https://docs.constructor.com/reference/shared-filter-expressions
Declaration
Swift
public let preFilterExpression: String? -
The fmt_options to use with the result set Please refer to our docs for more information on available options: https://docs.constructor.com/reference/v1-browse-get-browse-results
Declaration
Swift
public let fmtOptions: [FmtOption]? -
init(filterName:filterValue: filters: sortOption: page: perPage: section: hiddenFields: hiddenFacets: groupsSortOption: variationsMap: preFilterExpression: fmtOptions: ) Create a Browse request query object
Usage Example:
let facetFilters = [(key: "Nutrition", value: "Organic"), (key: "Nutrition", value: "Natural"), (key: "Brand", value: "Kraft Foods")] let preFilterExpression = "{\"or\":[{\"and\":[{\"name\":\"group_id\",\"value\":\"electronics-group-id\"},{\"name\":\"Price\",\"range\":[\"-inf\",200.0]}]},{\"and\":[{\"name\":\"Type\",\"value\":\"Laptop\"},{\"not\":{\"name\":\"Price\",\"range\":[800.0,\"inf\"]}}]}]}" let variationsMap = CIOQueryVariationsMap( GroupBy: [GroupByOption(name: "Country", field: "data.Country")], Values: ["price": ValueOption(aggregation: "min", field: "data.price")], Dtype: "array" ) let fmtOptions = [("groups_max_depth": "10")] let browseQuery = CIOBrowseQuery(filterName: "group_id", filterValue: "Pantry", filters: CIOQueryFilters(groupFilter: nil, facetFilters: facetFilters), page: 1, perPage: 30, section: "Products", hiddenFields: ["price_CA", "currency_CA"], hiddenFacets: ["brand", "price_CA"], variationsMap: variationsMap, preFilterExpression: preFilterExpression, fmtOptions: fmtOptions)Declaration
Swift
public init(filterName: String, filterValue: String, filters: CIOQueryFilters? = nil, sortOption: CIOSortOption? = nil, page: Int? = nil, perPage: Int? = nil, section: String? = nil, hiddenFields: [String]? = nil, hiddenFacets: [String]? = nil, groupsSortOption: CIOGroupsSortOption? = nil, variationsMap: CIOQueryVariationsMap? = nil, preFilterExpression: String? = nil, fmtOptions: [FmtOption]? = nil)Parameters
filterNameThe primary filter name that the user browsed for
filterValueThe primary filter value that the user browsed for
filtersThe filters used to refine results
pageThe page number of the results
perPageThe number of results per page to return
sortOptionThe sort method/order for results
sectionThe section to return results from
hiddenFieldsThe list of hidden metadata fields to return
hiddenFacetsThe list of hidden facest to return
variationsMapThe variation map to use with the result set
groupsSortOptionThe sort method/order for groups
preFilterExpressionThe pre filter expression used to refine results
fmtOptionsThe fmt options to use with the result set