first commit
This commit is contained in:
@@ -24,10 +24,11 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use TYPO3\CMS\Core\Utility\DebugUtility;
|
||||
use WapplerSystems\Meilisearch\Api;
|
||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||
use WapplerSystems\Meilisearch\Domain\Search\Statistics\StatisticsRepository;
|
||||
use WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument\Repository;
|
||||
use WapplerSystems\Meilisearch\Domain\Search\MeilisearchDocument\Repository;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Validator\Path;
|
||||
use TYPO3\CMS\Backend\Template\ModuleTemplate;
|
||||
@@ -93,8 +94,8 @@ class InfoModuleController extends AbstractModuleController
|
||||
|
||||
$this->collectConnectionInfos();
|
||||
$this->collectStatistics();
|
||||
$this->collectIndexFieldsInfo();
|
||||
$this->collectIndexInspectorInfo();
|
||||
//$this->collectIndexFieldsInfo();
|
||||
//$this->collectIndexInspectorInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,30 +123,22 @@ class InfoModuleController extends AbstractModuleController
|
||||
$missingHosts = [];
|
||||
$invalidPaths = [];
|
||||
|
||||
/* @var Path $path */
|
||||
$path = GeneralUtility::makeInstance(Path::class);
|
||||
$connections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||
$connection = $this->meilisearchConnectionManager->getConnectionBySite($this->selectedSite);
|
||||
|
||||
if (empty($connections)) {
|
||||
if (empty($connection)) {
|
||||
$this->view->assign('can_not_proceed', true);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($connections as $connection) {
|
||||
$coreAdmin = $connection->getAdminService();
|
||||
$coreUrl = (string)$coreAdmin;
|
||||
$coreAdmin = $connection->getAdminService();
|
||||
|
||||
if ($coreAdmin->ping()) {
|
||||
$connectedHosts[] = $coreUrl;
|
||||
} else {
|
||||
$missingHosts[] = $coreUrl;
|
||||
}
|
||||
|
||||
if (!$path->isValidMeilisearchPath($coreAdmin->getCorePath())) {
|
||||
$invalidPaths[] = $coreAdmin->getCorePath();
|
||||
}
|
||||
if ($coreAdmin->ping()) {
|
||||
$connectedHosts[] = $coreAdmin;
|
||||
} else {
|
||||
$missingHosts[] = $coreAdmin;
|
||||
}
|
||||
|
||||
|
||||
$this->view->assignMultiple([
|
||||
'site' => $this->selectedSite,
|
||||
'apiKey' => Api::getApiKey(),
|
||||
@@ -204,36 +197,15 @@ class InfoModuleController extends AbstractModuleController
|
||||
{
|
||||
$indexFieldsInfoByCorePaths = [];
|
||||
|
||||
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||
foreach ($meilisearchCoreConnections as $meilisearchCoreConnection) {
|
||||
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionBySite($this->selectedSite);
|
||||
foreach ($meilisearchCoreConnections as $i => $meilisearchCoreConnection) {
|
||||
$coreAdmin = $meilisearchCoreConnection->getAdminService();
|
||||
|
||||
$indexFieldsInfo = [
|
||||
'corePath' => $coreAdmin->getCorePath()
|
||||
];
|
||||
if ($coreAdmin->ping()) {
|
||||
$lukeData = $coreAdmin->getLukeMetaData();
|
||||
|
||||
/* @var Registry $registry */
|
||||
$registry = GeneralUtility::makeInstance(Registry::class);
|
||||
$limit = $registry->get('tx_meilisearch', 'luke.limit', 20000);
|
||||
$limitNote = '';
|
||||
|
||||
if (isset($lukeData->index->numDocs) && $lukeData->index->numDocs > $limit) {
|
||||
$limitNote = '<em>Too many terms</em>';
|
||||
} elseif (isset($lukeData->index->numDocs)) {
|
||||
$limitNote = 'Nothing indexed';
|
||||
// below limit, so we can get more data
|
||||
// Note: we use 2 since 1 fails on Ubuntu Hardy.
|
||||
$lukeData = $coreAdmin->getLukeMetaData(2);
|
||||
}
|
||||
|
||||
$fields = $this->getFields($lukeData, $limitNote);
|
||||
$coreMetrics = $this->getCoreMetrics($lukeData, $fields);
|
||||
|
||||
$indexFieldsInfo['noError'] = 'OK';
|
||||
$indexFieldsInfo['fields'] = $fields;
|
||||
$indexFieldsInfo['coreMetrics'] = $coreMetrics;
|
||||
$indexFieldsInfo['coreMetrics'] = 'dedede';
|
||||
} else {
|
||||
$indexFieldsInfo['noError'] = null;
|
||||
|
||||
@@ -243,7 +215,7 @@ class InfoModuleController extends AbstractModuleController
|
||||
FlashMessage::ERROR
|
||||
);
|
||||
}
|
||||
$indexFieldsInfoByCorePaths[$coreAdmin->getCorePath()] = $indexFieldsInfo;
|
||||
$indexFieldsInfoByCorePaths[$i] = $indexFieldsInfo;
|
||||
}
|
||||
$this->view->assign('indexFieldsInfoByCorePaths', $indexFieldsInfoByCorePaths);
|
||||
}
|
||||
@@ -255,7 +227,7 @@ class InfoModuleController extends AbstractModuleController
|
||||
*/
|
||||
protected function collectIndexInspectorInfo()
|
||||
{
|
||||
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionBySite($this->selectedSite);
|
||||
$documentsByCoreAndType = [];
|
||||
foreach ($meilisearchCoreConnections as $languageId => $meilisearchCoreConnection) {
|
||||
$coreAdmin = $meilisearchCoreConnection->getAdminService();
|
||||
|
Reference in New Issue
Block a user