Skip to content

Commit

Permalink
Merge pull request #127 from pantheon-systems/fix-commit-within
Browse files Browse the repository at this point in the history
Fix commit within and a couple of related fixes.
  • Loading branch information
stovak authored Nov 17, 2021
2 parents 2a58bc8 + 4fd49c7 commit 8755a5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/Plugin/SolrConnector/PantheonSolrConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function __construct(
$this->dateFormatter = $date_formatter;
$this->messenger = $messenger;
$this->setLogger($logger_factory->get('PantheonSearch'));
$this->configuration['core'] = getenv('PANTHEON_INDEX_CORE');
$this->configuration['schema'] = getenv('PANTHEON_INDEX_SCHEMA');
$this->connect();
}

Expand Down Expand Up @@ -129,6 +131,7 @@ public function defaultConfiguration() {
'core' => getenv('PANTHEON_INDEX_CORE'),
'schema' => getenv('PANTHEON_INDEX_SCHEMA'),
'solr_version' => '8',
'commit_within' => 1000,
]);
}

Expand Down Expand Up @@ -180,7 +183,9 @@ public function submitConfigurationForm(
array &$form,
FormStateInterface $form_state
) {
$this->setConfiguration($form_state->getValues());
$configuration = $form_state->getValues();
$configuration = array_merge($this->defaultConfiguration(), $configuration);
$this->setConfiguration($configuration);
}

/**
Expand Down
23 changes: 11 additions & 12 deletions src/Services/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ class Endpoint extends SolariumEndpoint {
* they are used by other functions of the endpoint.
*/
public function __construct(array $options = []) {
if (!$options) {
$options = [
'scheme' => getenv('PANTHEON_INDEX_SCHEME'),
'host' => getenv('PANTHEON_INDEX_HOST'),
'port' => getenv('PANTHEON_INDEX_PORT'),
'path' => getenv('PANTHEON_INDEX_PATH'),
'core' => getenv('PANTHEON_INDEX_CORE'),
'schema' => getenv('PANTHEON_INDEX_SCHEMA'),
'collection' => NULL,
'leader' => FALSE,
];
}
// We intentionally want to override this options in case they are set in the parameter.
$options = array_merge($options, [
'scheme' => getenv('PANTHEON_INDEX_SCHEME'),
'host' => getenv('PANTHEON_INDEX_HOST'),
'port' => getenv('PANTHEON_INDEX_PORT'),
'path' => getenv('PANTHEON_INDEX_PATH'),
'core' => getenv('PANTHEON_INDEX_CORE'),
'schema' => getenv('PANTHEON_INDEX_SCHEMA'),
'collection' => NULL,
'leader' => FALSE,
]);
parent::__construct($options);
}

Expand Down

0 comments on commit 8755a5d

Please sign in to comment.