About this widget #
The component handling search requests. Objects conforming to the Searcher protocol manage the search sessions.
Out of the box we provide 3 searchers to build your InstantSearch experience:
SingleIndexSearcher: Searches a single index.MultiIndexSearcher: Searches in multiple indices. This is useful for a federated search, or query suggestions search experience.FacetSearcher: Searches for facet values.
Examples #
To create a SingleIndexSearcher:
1
2
3
let searcher = SingleIndexSearcher(appID: "AJ0P3S7DWQ",
apiKey: "YourSearchOnlyApiKey",
indexName: "index_name")
For the MultiIndexSearcher:
1
2
3
let searcher = MultiIndexSearcher(appID: "AJ0P3S7DWQ",
apiKey: "YourSearchOnlyApiKey",
indexNames: ["index_name1", "index_name2"])
For the FacetSearcher:
1
2
3
4
let searcher = FacetSearcher(appID: "AJ0P3S7DWQ",
apiKey: "YourSearchOnlyApiKey",
indexName: "index_name",
facetName: "facet_name")
SingleIndexSearcher #
indexName
# |
type: String
Required
The index to search into. |
||
|
Edit
Copy
|
|||
query
# |
type: Query
default: Query()
Optional
The Query used when doing a search. |
||
|
Edit
Copy
|
|||
MultiIndexSearcher #
indexNames
# |
type: list
Required
The indices to search into. |
||
|
Edit
Copy
|
|||
indexQueryStates
# |
type: [IndexQuery]
Optional
The indices to search into, with their respective queries. |
||
|
Edit
Copy
|
|||
requestOptions
# |
type: RequestOptions
default: RequestOptions()
Optional
|
||
|
Edit
Copy
|
|||
FacetSearcher #
indexName
# |
type: String
Required
The index to search into. |
||
|
Edit
Copy
|
|||
facetName
# |
type: String
Required
The facet name to search into when doing search for facet values. |
||
|
Edit
Copy
|
|||
query
# |
type: Query
default: Query()
Optional
The Query used when doing a search. |
||
|
Edit
Copy
|
|||