CIORecommendationsQuery
public struct CIORecommendationsQuery : CIORequestData
Struct encapsulating the necessary and additional parameters required to execute a recommendations query.
-
The pod ID
Declaration
Swift
public let podID: String
-
The item id to retrieve recommendations for (strategy specific)
Declaration
Swift
public let itemID: String?
-
The term to use to refine results (strategy specific)
Declaration
Swift
public let term: String?
-
The filters used to refine results
Declaration
Swift
public let filters: CIOQueryFilters?
-
The number of results to return
Declaration
Swift
public let numResults: Int?
-
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 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 Recommendations request query object
Usage Example:
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 recommendationsQuery = CIORecommendationsQuery(podID: "pod_name", itemID: "item_id", numResults: 5, section: "Products", hiddenFields: ["price_CA", "currency_CA"], preFilterExpression: preFilterExpression)
Declaration
Swift
public init(podID: String, itemID: String? = nil, term: String? = nil, filters: CIOQueryFilters? = nil, numResults: Int? = nil, section: String? = nil, hiddenFields: [String]? = nil, preFilterExpression: String? = nil)
Parameters
podID
The pod ID
itemID
The item id to retrieve recommendations for (strategy specific)
term
The term to use to refine results (strategy specific)
filters
The filters used to refine results
numResults
The number of results to return
section
The section to return results from
hiddenFields
The list of hidden metadata fields to return
preFilterExpression
The pre filter expression used to refine results