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.io/rest_api/collections/#add-items-dynamically

    Declaration

    Swift

    public let preFilterExpression: String?
  • 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 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"], preFilterExpression: preFilterExpression)
    

    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)

    Parameters

    filterName

    The primary filter name that the user browsed for

    filterValue

    The primary filter value that the user browsed for

    filters

    The filters used to refine results

    page

    The page number of the results

    perPage

    The number of results per page to return

    sortOption

    The sort method/order for results

    section

    The section to return results from

    hiddenFields

    The list of hidden metadata fields to return

    hiddenFacets

    The list of hidden facest to return

    groupsSortOption

    The sort method/order for groups

    preFilterExpression

    The pre filter expression used to refine results