Searchable

@objc
public protocol Searchable : AnyObject

A searchable source of data.

  • Perform a search.

    Declaration

    Swift

    @discardableResult
    @objc
    func search(_ query: Query, requestOptions: RequestOptions?, completionHandler: @escaping CompletionHandler) -> Operation

    Parameters

    query

    Search parameters.

    completionHandler

    Completion handler to be notified of the request’s outcome.

    Return Value

    A cancellable operation.

  • Perform a search with disjunctive facets, generating as many queries as number of disjunctive facets (helper).

    Declaration

    Swift

    @discardableResult
    @objc
    func searchDisjunctiveFaceting(_ query: Query, disjunctiveFacets: [String], refinements: [String: [String]], requestOptions: RequestOptions?, completionHandler: @escaping CompletionHandler) -> Operation

    Parameters

    query

    The query.

    disjunctiveFacets

    List of disjunctive facets.

    refinements

    The current refinements, mapping facet names to a list of values.

    completionHandler

    Completion handler to be notified of the request’s outcome.

    Return Value

    A cancellable operation.

  • Search for facet values. This searches inside a facet’s values, optionally restricting the returned values to those contained in objects matching other (regular) search criteria.

    Declaration

    Swift

    @discardableResult
    @objc(searchForFacetValuesOf:matching:query:requestOptions:completionHandler:)
    func searchForFacetValues(of facetName: String, matching text: String, query: Query?, requestOptions: RequestOptions?, completionHandler: @escaping CompletionHandler) -> Operation

    Parameters

    facetName

    Name of the facet to search. It must have been declared in the index’s attributesForFaceting setting with the searchable() modifier.

    text

    Text to search for in the facet’s values.

    query

    An optional query to take extra search parameters into account. These parameters apply to index objects like in a regular search query. Only facet values contained in the matched objects will be returned.

    completionHandler

    Completion handler to be notified of the request’s outcome.

    Return Value

    A cancellable operation.