Skip to content

Commit f14580e

Browse files
author
Mustafa Şükrü Kapusuz
committed
chore: wip - improve index settings sync
1 parent 131d30b commit f14580e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

includes/indices/class-algolia-index.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -823,10 +823,7 @@ private function sync_replicas() {
823823
)
824824
);
825825

826-
$client = $this->get_client();
827-
828-
// Ensure we re-push the master index settings each time.
829-
$settings = $this->get_settings();
826+
$settings = new Algolia_Primary_Index_Settings( $this ); // TODO: maybe move a common place.
830827

831828
/**
832829
* Loop over the replicas.
@@ -837,10 +834,7 @@ private function sync_replicas() {
837834
* @var Algolia_Index_Replica $replica
838835
*/
839836
foreach ( $replicas as $replica ) {
840-
$settings['ranking'] = $replica->get_ranking();
841-
$replica_index_name = $replica->get_replica_index_name( $this );
842-
$index = $client->initIndex( $replica_index_name );
843-
$index->setSettings( $settings );
837+
( new Algolia_Replica_Index_Settings( $settings, $replica ) );
844838
}
845839
}
846840

0 commit comments

Comments
 (0)