AlgoliaSearch\Index::getSettings PHP Method

getSettings() public method

Get settings of this index.
public getSettings ( ) : mixed
return mixed
    public function getSettings()
    {
        return $this->client->request($this->context, 'GET', '/1/indexes/' . $this->urlIndexName . '/settings?getVersion=2', null, null, $this->context->readHostsArray, $this->context->connectTimeout, $this->context->readTimeout);
    }

Usage Example

 /**
  * Reindex atomically the given index with the given records.
  *
  * @param Index $index
  * @param array $algoliaRecords
  *
  * @return mixed
  */
 private function reindexAtomically(Index $index, array $algoliaRecords)
 {
     $temporaryIndexName = 'tmp_' . $index->indexName;
     $temporaryIndex = $this->initIndex($temporaryIndexName);
     $temporaryIndex->addObjects($algoliaRecords);
     $settings = $index->getSettings();
     // Temporary index overrides all the settings on the main one.
     // So we need to set the original settings on the temporary one before atomically moving the index.
     $temporaryIndex->setSettings($settings);
     return $this->moveIndex($temporaryIndexName, $index->indexName);
 }