setReplicas method

AlgoliaSettings setReplicas(
  1. List<String> value
)

Replicas (Ranking)

Creates replicas, exact copies of an index.

The purpose of replicas is to create variants of your main index, where the data is the same and the variance is in the configuration (settings, synonyms, query rules).

The data in a replica is automatically synchronized with its primary index, which means that all indexing operations on an index (adding, updating, and deleting objects) are forwarded to its replica(s).

This is used mainly for:

  • alternative sorting strategies
  • A/B testing.

Usage notes:

Adding Replicas:

    - Each use of this setting defines the full set of replicas for an index. Any index omitted from the list is no longer a replica.
    - Adding replicas to the list will either create a new replica index or overwrite an existing one.
         -  If the index does not already exist on your account, a new index is created containing the same exact data and settings. For this reason, you’ll need to make sure you have enough space on your account before creating a new replica.
         -  If the index already exists on your server, then only its data is overwritten; its settings remain as they were before the method call. If you want the replica to have the same exact settings, you can either remove the replica before running this method, or resend the primary index’s full settings to the existing replica.

Removing Replicas:

    - If you omit an existing replica from your list, it will no longer be a replica and will revert to being a normal, independent index (continuing, for example, to take up space on your Account). All synchronization between it and its primary will be lost. You can always put it back on the list later.
    - If you wish to delete a replica from your Account, you must first rerun this setting without listing the index you want to delete. That will detach the index. At that point, you can delete the index.

Source: Learn more

Implementation

AlgoliaSettings setReplicas(List<String> value) {
  assert(value.isNotEmpty, 'value can not be empty');
  assert(!_parameters.containsKey('replicas'));
  return _copyWithParameters(<String, dynamic>{'replicas': value});
}