AlgoliaSynonyms class

The body of the request must be a JSON object representing the synonyms. It must contain the following attributes:

  • objectID (string): Unique identifier of the synonym object to be created or updated.
  • type (string): Type of the synonym object (see below).

The rest of the body depends on the type of synonyms to add:

synonym Multi-way synonyms (a.k.a. “regular synonyms”).

A set of words or phrases that are all substitutable to one another. Any query containing one of them can match records containing any of them. The body must contain the following fields:

  • synonyms (array of strings): Words or phrases to be considered equivalent.

onewaysynonym One-way synonym.

Alternative matches for a given input. If the input appears inside a query, it will match records containing any of the defined synonyms. The opposite is not true: if a synonym appears in a query, it will not match records containing the input, nor the other synonyms. The body must contain the following fields:

  • input (string): Word or phrase to appear in query strings.
  • synonyms (array of strings): Words or phrases to be matched in records.

altcorrection1, altcorrection2 Alternative corrections.

Same as a one-way synonym, except that when matched, they will count as 1 (respectively 2) typos in the ranking formula. The body must contain the following fields:

  • word (string): Word or phrase to appear in query strings.
  • corrections (array of strings): Words to be matched in records. Phrases (multiple-word synonyms) are not supported.

placeholder Placeholder:

A placeholder is a special text token that is placed inside records and can match many inputs. The body must contain the following fields:

  • placeholder (string): Token to be put inside records.
  • replacements (array of strings): List of query words that will match the token.

forwardToReplicas: (URL parameter) Replicate the new/updated synonym set to all replica indices. default: false

Constructors

AlgoliaSynonyms({required String objectID, required SynonymsType type, List<String>? synonyms, List<String>? corrections, List<String>? replacements, String? input, String? word, String? placeholder, bool forwardToReplicas = false})
const
AlgoliaSynonyms.fromJson(String source)
factory
AlgoliaSynonyms.fromMap(Map<String, dynamic> map)
factory

Properties

corrections List<String>?
final
forwardToReplicas bool
final
hashCode int
The hash code for this object.
no setteroverride
input String?
final
objectID String
final
placeholder String?
final
replacements List<String>?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
synonyms List<String>?
final
type SynonymsType
final
word String?
final

Methods

copyWith({String? objectID, SynonymsType? type, List<String>? synonyms, List<String>? corrections, List<String>? replacements, String? input, String? word, String? placeholder, bool? forwardToReplicas}) AlgoliaSynonyms
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
toMap() Map<String, dynamic>
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override