Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Classes/Report/SolrStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ protected function getConnectionStatus(Site $site, array $solrConnection): Statu
->getAdminService();

$solrVersion = $this->checkSolrVersion($solrAdmin);
$solrMode = $this->checkSolrMode($solrAdmin);
$accessFilter = $this->checkAccessFilter($solrAdmin);
$pingTime = $this->checkPingTime($solrAdmin);
$configName = $this->checkSolrConfigName($solrAdmin);
Expand All @@ -135,6 +136,7 @@ protected function getConnectionStatus(Site $site, array $solrConnection): Statu
'connection' => $solrConnection,
'solr' => $solrAdmin,
'solrVersion' => $solrVersion,
'solrMode' => $solrMode,
'pingTime' => $pingTime,
'configName' => $configName,
'schemaName' => $schemaName,
Expand Down Expand Up @@ -168,6 +170,23 @@ protected function checkSolrVersion(SolrAdminService $solr): string
return $solrVersion;
}

/**
* Checks the solr mode and adds it to the report.
*
* @return string solr mode
*/
protected function checkSolrMode(SolrAdminService $solr): string
{
try {
$solrMode = $solr->getSolrServerMode();
} catch (Throwable $e) {
$this->responseStatus = ContextualFeedbackSeverity::ERROR;
$solrMode = 'Error getting solr version: ' . $e->getMessage();
}

return $solrMode;
}

/**
* Checks the access filter setup and adds it to the report.
*/
Expand Down
24 changes: 23 additions & 1 deletion Classes/System/Solr/Service/SolrAdminService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SolrAdminService extends AbstractSolrService
public const LUKE_SERVLET = 'admin/luke';
public const SYSTEM_SERVLET = 'admin/system';
public const CORES_SERVLET = '../admin/cores';
public const COLLECTIONS_SERVLET = '../admin/collections';
public const FILE_SERVLET = 'admin/file';
public const SCHEMA_SERVLET = 'schema';
public const SYNONYMS_SERVLET = 'schema/analysis/synonyms/';
Expand Down Expand Up @@ -202,6 +203,23 @@ public function getSolrServerVersion(): string
return $luceneInformation['solr-spec-version'] ?? '';
}

/**
* Gets the Solr server's mode.
*/
public function getSolrServerMode(): string
{
$systemInformation = $this->getSystemInformation();
return $systemInformation->mode ?? '';
}

/**
* Check if solr server is running in cloud mode.
*/
public function isSolrCloudMode(): bool
{
return $this->getSolrServerMode() === 'solrcloud';
}

/**
* Reloads the current core
*/
Expand All @@ -215,7 +233,11 @@ public function reloadCore(): ResponseAdapter
*/
public function reloadCoreByName(string $coreName): ResponseAdapter
{
$coreAdminReloadUrl = $this->_constructUrl(self::CORES_SERVLET) . '?action=reload&core=' . $coreName;
if ($this->isSolrCloudMode()) {
$coreAdminReloadUrl = $this->_constructUrl(self::COLLECTIONS_SERVLET) . '?action=reload&name=' . $coreName;
} else {
$coreAdminReloadUrl = $this->_constructUrl(self::CORES_SERVLET) . '?action=reload&core=' . $coreName;
}
return $this->_sendRawGet($coreAdminReloadUrl);
}

Expand Down
14 changes: 9 additions & 5 deletions Resources/Private/Templates/Backend/Reports/SolrStatus.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@
<th>Port</th>
<td>{solr.primaryEndpoint.port}</td>
</tr>
<tr>
<th>Username</th>
<td>{connection.solrUsername}</td>
</tr>
<tr>
<th>Username</th>
<td>{connection.solrUsername}</td>
</tr>
<tr>
<th>Apache Solr</th>
<td>{solrVersion}</td>
</tr>
<tr>
<th>Solr Mode</th>
<td>{solrMode}</td>
</tr>
<tr>
<th>solrconfig.xml</th>
<td>{configName}</td>
Expand All @@ -50,4 +54,4 @@
</tr>
</table>

</html>
</html>