Algolia DevCon
Oct. 2–3 2024, virtual.
API Reference / API Parameters / queryType
Type: string
Engine default: "prefixLast"
Parameter syntax

Can be used in these methods:

About this parameter

Determine how query words are interpreted as prefixes.

Query words are interpreted as prefixes in one of three ways.

Options

prefixLast

(Default.) Only the last word in the query is interpreted as a prefix. Other words in the query must be complete matches.

prefixAll

Every word in the query is a prefix

prefixNone

Turns off prefix search: only returns results if the full query matches words in the attribute

Examples

Set default query type

1
2
3
4
5
$index->setSettings([
  'queryType' => 'prefixLast'
  // 'queryType' => 'prefixAll'
  // 'queryType' => 'prefixNone'
]);
1
2
3
4
5
$results = $index->search('query', [
  'queryType' => 'prefixAll'
  // 'queryType' => 'prefixLast'
  // 'queryType' => 'prefixNone'
]);
Did you find this page helpful?