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

# query

> Search query string

\<ul><li>**Type:** `string`</li>
      \<li>**Default:** `""`</li>
      
      
      \<li>**Scope:** [`search`](https://www.algolia.com/doc/api-reference/api-parameters)</li></ul>## UsageThe `query` parameter represents the **query string** Algolia matches against your index.For an overview of how Algolia interprets and ranks queries,
see [Relevance overview](https://www.algolia.com/doc/guides/managing-results/relevance-overview).### Formatting rules- An empty string (`""`) returns all records, sorted by [`customRanking`](https://www.algolia.com/doc/api-reference/api-parameters/customRanking).
- Query strings can be up to 512 bytes long.
- Boolean operators (`AND`, `OR`, `NOT`) aren't supported in the query string.
- Multi-word queries require all words to match.
  For example, `hot dog`  only returns records containing both `hot` and `dog`.### Related features and parameters- **Boolean logic:** use [filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering) or [`optionalWords`](https://www.algolia.com/doc/api-reference/api-parameters/optionalWords).
- **Broader matching when [no results](https://www.algolia.com/doc/guides/building-search-ui/resources/ui-kit/js.md#empty-query-state) are found:** use [`removeWordsIfNoResults`](https://www.algolia.com/doc/api-reference/api-parameters/removeWordsIfNoResults).
- **Phrase exclusion or exact matching:** use [`advancedSyntax`](https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntax).## Example> [accordion] Current API clients
>
> ```cs C# theme={"system"}
> var response = await client.SearchSingleIndexAsync<Hit>(
>   "INDEX_NAME",
>   new SearchParams(new SearchParamsObject { Query = "phone" })
> );
> ```
>
> ```dart Dart theme={"system"}
> final response = await client.searchSingleIndex(
>   indexName: "INDEX_NAME",
>   searchParams: SearchParamsObject(
>     query: "phone",
>   ),
> );
> ```
>
> ```go Go theme={"system"}
> response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(
>   "INDEX_NAME").WithSearchParams(search.SearchParamsObjectAsSearchParams(
>   search.NewEmptySearchParamsObject().SetQuery("phone"))))
> if err != nil {
>   // handle the eventual error
>   panic(err)
> }
> ```
>
> ```java Java theme={"system"}
> SearchResponse response = client.searchSingleIndex("INDEX_NAME", new SearchParamsObject().setQuery("phone"), Hit.class);
> ```
>
> ```js JavaScript theme={"system"}
> const response = await client.searchSingleIndex({ indexName: 'indexName', searchParams: { query: 'phone' } });
> ```
>
> ```kotlin Kotlin theme={"system"}
> var response =
>   client.searchSingleIndex(
>     indexName = "INDEX_NAME",
>     searchParams = SearchParamsObject(query = "phone"),
>   )
> ```
>
> ```php PHP theme={"system"}
> $response = $client->searchSingleIndex(
>     'INDEX_NAME',
>     ['query' => 'phone',
>     ],
> );
> ```
>
> ```python Python theme={"system"}
> response = client.search_single_index(
>     index_name="INDEX_NAME",
>     search_params={
>         "query": "phone",
>     },
> )
> ```
>
> ```ruby Ruby theme={"system"}
> response = client.search_single_index("INDEX_NAME", Algolia::Search::SearchParamsObject.new(query: "phone"))
> ```
>
> ```scala Scala theme={"system"}
> val response = Await.result(
>   client.searchSingleIndex(
>     indexName = "INDEX_NAME",
>     searchParams = Some(
>       SearchParamsObject(
>         query = Some("phone")
>       )
>     )
>   ),
>   Duration(100, "sec")
> )
> ```
>
> ```swift Swift theme={"system"}
> let response: SearchResponse<Hit> = try await client.searchSingleIndex(
>     indexName: "INDEX_NAME",
>     searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(query: "phone"))
> )
> ```> [accordion] Legacy API clients
>
> ```cs C# theme={"system"}
> index.search(
>   new Query("shirt")
> );
> ```
>
> ```go Go theme={"system"}
> res, err := index.Search("shirt")
> ```
>
> ```java Java theme={"system"}
> index.search(
>   new Query("shirt")
> );
> ```
>
> ```js JavaScript theme={"system"}
> index.search("shirt").then(({ hits }) => {
>   console.log(hits);
> });
> ```
>
> ```kotlin Kotlin theme={"system"}
> index.search(Query("shirt"))
> ```
>
> ```php PHP theme={"system"}
> $results = $index->search('shirt');
> ```
>
> ```python Python theme={"system"}
> results = index.search("shirt")
> ```
>
> ```ruby Ruby theme={"system"}
> results = index.search("shirt")
> ```
>
> ```scala Scala theme={"system"}
> client.execute {
>   search into "YourIndex" query Query(
>     query = Some("shirt")
>   )
> }
> ```
>
> ```swift Swift theme={"system"}
> index.search(query: "shirt") { result in
>   if case .success(let response) = result {
>     print("Response: \(response)")
>   }
> }
> ```
