API Reference / API Parameters / advancedSyntax
Feb. 26, 2019

advancedSyntax

Type: boolean
Engine default: false
Parameter syntax
'advancedSyntax' => true|false

Can be used in these methods:

About this parameter

Enables the advanced query syntax.

This advanced syntax brings two additional features:

  • Phrase query: a specific sequence of terms that must be matched next to one another. A phrase query needs to be surrounded by double quotes ("). For example, "search engine" will only match records having search next to engine.

    Note: Typo tolerance is disabled inside the phrase (i.e. within the quotes).

  • Prohibit operator: excludes records that contain a specific term. This term has to be prefixed by a minus (-). For example, search -engine will only match records containing search but not engine.

Examples

Enable advanced syntax by default

1
2
3
$index->setSettings([
  'advancedSyntax' => true
]);
1
2
3
$results = $index->search('query', [
  'advancedSyntax' => true
]);

Did you find this page helpful?