You're viewing an archived version of our docs. Check out our current documentation →
API Reference / API Parameters / query
Type: string
Engine default: "" (returns all records)
Parameter syntax
$index->search('YourQuery');

Can be used in these methods:

About this parameter

Search query string

The query parameter represents the query string Algolia matches against your index.

For an overview of how Algolia interprets and ranks queries, see Relevance overview.

Formatting rules

  • An empty string ("") returns all records, sorted by 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.

Examples

Search for “shirt”

1
$results = $index->search('shirt');

Return all records

1
$results = $index->search('');