advancedSyntax

scope settings search
type boolean
default false
description

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.

    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 (-, a.k.a dash). For example, search -engine will only match records containing search but not engine.

Examples

Enable advanced syntax by default

<?php
$index->setSettings([
  'advancedSyntax' => true
]);
index.set_settings({
  advancedSyntax: true
})
index.setSettings({
  advancedSyntax: true
});
index.set_settings({
    'advancedSyntax': True
})
index.setSettings([
    "advancedSyntax": true
])
index.setSettings(new JSONObject().put("advancedSyntax", true));
index.SetSettings(
  JObject.Parse(@"{""advancedSyntax"":""true""}")
);
index.setSettings(
  new IndexSettings().setAdvancedSyntax(true)
);
res, err := index.SetSettings(algoliasearch.Map{
    "advancedSyntax": true,
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    advancedSyntax = Some(true)
  )
}
<?php
$results = $index->search('query', [
  'advancedSyntax' => true
]);
results = index.search('query', {
  advancedSyntax: true
})
index.search({
  query: 'query',
  advancedSyntax: true
}).then(res => {
  // console.log(res);
});
results = index.search('query', {
    'advancedSyntax': True
})
let query = Query(query: "query")
query.advancedSyntax = true

index.search(query, completionHandler: { (res, error) in
    print(res)
})
index.search(new Query("query").setAdvancedSyntax(false));
index.search(
  new Query("query").EnableAdvancedSyntax(true)
);
index.search(
  new Query("query").setAdvancedSyntax(true)
);
res, err := index.Search("query", algoliasearch.Map{
    "advancedSyntax": true,
})
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    advancedSyntax = Some(true)
  )
}
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala