API Reference / API Parameters / query
Type: string
Engine default: "" (returns all records)
Parameter syntax
$index->search('my query');

Can be used in these methods:

About this parameter

The text to search in the index.

Usage notes:

  • If the text is empty or absent, the search will match every object in your index.

  • In our documentation, we use the terms “query”, “query terms”, or “search text” to mean the same thing, namely: the text used to search the index.

  • There’s a hard limit of 512 characters per query. If a search query is longer, the API will return an error.

Examples

Search a query

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

Return every record

When searching with an empty query, it will return every record in your index ordered by custom ranking.

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

Did you find this page helpful?