> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional requests

> Learn how to make conditional requests with InstantSearch iOS.

export const SearchRequest = () => <Tooltip tip="A search request is a single HTTP call to the Algolia Search API that can run one or more search operations. It can include multiple queries, for example, when querying several indices at once.">
    search request
  </Tooltip>;

export const SearchQuery = () => <Tooltip tip="The text users enter into a search box. In the Search API, this corresponds to the query parameter. A search query is often used with filters, facets, and other parameters, but these aren't part of the query text itself.">
    search query
  </Tooltip>;

<Info>
  Starting May 1, 2024,
  Apple requires all iOS apps to include a privacy manifest.
  For more information, see [Privacy manifest](/doc/guides/building-search-ui/resources/privacy-manifest/ios/).
</Info>

By default, InstantSearch sends an initial <SearchRequest /> to Algolia's servers with an empty <SearchQuery />.
This connection helps speed up later requests.

However, sometimes you don't want to perform more network calls than are necessary.
For example, you may want to limit the number of search requests and reduce your overall Algolia usage.
This guide helps you build a UI that prevents this initial request.

## Set Searcher `shouldTriggerSearchForQuery` property

All the `Searcher` implementations such as `HitsSearcher` and `FacetSearcher` provide the `shouldTriggerSearchForQuery` closure which defines the boolean condition for triggering a search operation.
By default has a `nil` value so the search will be triggered on each `search()` function call.

The closure blocking searches for empty queries should look as follows:

```swift Swift icon=code theme={"system"}
let searcher = SingleIndexSearcher(appID: "ALGOLIA_APPLICATION_ID", 
                                   apiKey: "ALGOLIA_SEARCH_API_KEY", 
                                   indexName: "search_index_name")
searcher.shouldTriggerSearchForQuery = {
  return $0.query.query != ""
}
```
