alternativesAsExact

scope setting search
type array of strings
default ["ignorePlurals", "singleWordSynonym"]
description

List of alternatives that should be considered an exact match by the exact ranking criterion.

The following values are allowed:

  • ignorePlurals: alternative words added by the ignorePlurals feature;
  • singleWordSynonym: single-word synonyms (example: “NY” = “NYC”);
  • multiWordsSynonym: multiple-words synonyms (example: “NY” = “New York”).

Examples

Set default alternativesAsExact

<?php
$index->setSettings([
  'alternativesAsExact' => [
    'ignorePlurals',
    'singleWordSynonym'
  ]
]);
index.set_settings({
  alternativesAsExact: [
    'ignorePlurals',
    'singleWordSynonym'
  ]
})
index.setSettings({
  alternativesAsExact: [
    'ignorePlurals',
    'singleWordSynonym'
  ]
});
index.set_settings({
    'alternativesAsExact': [
        'ignorePlurals',
        'singleWordSynonym'
    ]
})
index.setSettings([
    "alternativesAsExact": [
        "ignorePlurals",
        "singleWordSynonym"
    ]
])
index.setSettings(new JSONObject().put("alternativesAsExact",
    new JSONArray().put("ignorePlurals").put("singleWordSynonym")
));
index.SetSettings(
  JObject.Parse(@"{""alternativesAsExact"": [""ignorePlurals"",""singleWordSynonym""]}")
);
index.setSettings(
  new IndexSettings().setAlternativesAsExact(Arrays.asList(
    "ignorePlurals",
    "singleWordSynonym"
  ))
);
res, err := index.SetSettings(algoliasearch.Map{
    "alternativesAsExact": []string{
        "ignorePlurals",
        "singleWordSynonym",
    },
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    alternativesAsExact = Some(Seq(
      "ignorePlurals",
      "singleWordSynonym"
    ))
  )
}
<?php
$results = $index->search('query', [
  'alternativesAsExact' => [
    'ignorePlurals',
    'singleWordSynonym'
  ]
]);
results = index.search('query', {
  alternativesAsExact: [
    'ignorePlurals',
    'singleWordSynonym'
  ]
})
index.search({
  query: 'query',
  alternativesAsExact: [
    'ignorePlurals',
    'singleWordSynonym'
  ]
}).then(res => {
  // console.log(res);
});
results = index.search('query', {
    'alternativesAsExact': [
        'ignorePlurals',
        'singleWordSynonym'
    ]
})
let query = Query(query: "query")
query.alternativesAsExact = [.ignorePlurals, .singleWordSynonym]

index.search(query, completionHandler: { (res, error) in
    print(res)
})
index.search(new Query("query").setAlternativesAsExact(
    new AlternativesAsExact[]{AlternativesAsExact.IGNORE_PLURALS, AlternativesAsExact.SINGLE_WORD_SYNONYM}
  ));
index.search(
  new Query("query").AlternativesAsExact("ignorePlurals,singleWordSynonym")
);
index.search(
  new Query("query").setAlternativesAsExact(Arrays.asList(
    "ignorePlurals",
    "singleWordSynonym"
  ))
);
res, err := index.Search("query", algoliasearch.Map{
    "alternativesAsExact": []string{
        "ignorePlurals",
        "singleWordSynonym",
    },
})
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    alternativesAsExact = Some(Seq(
      "ignorePlurals",
      "singleWordSynonym"
    ))
  )
}
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