first commit

This commit is contained in:
Sven Wappler 2021-04-17 21:20:54 +02:00
parent c93ec9492a
commit cadcc8edb4
406 changed files with 4917 additions and 5157 deletions

View File

@ -30,11 +30,11 @@ use TYPO3\CMS\Core\Database\QueryGenerator;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Changes in TYPO3 have an impact on the solr content and are caught
* Changes in TYPO3 have an impact on the meilisearch content and are caught
* by the GarbageCollector and RecordMonitor. Both act as a TCE Main Hook.
*
* This base class is used to share functionality that are needed for both
* to perform the changes in the data handler on the solr index.
* to perform the changes in the data handler on the meilisearch index.
*
* @author Timo Schmidt <timo.schmidt@dkd.de>
*/
@ -121,12 +121,12 @@ abstract class AbstractDataHandlerListener
$isRecursiveUpdateRequired = $this->isRecursiveUpdateRequired($pageId, $changedFields);
// If RecursiveUpdateTriggerConfiguration is false => check if changeFields are part of recursiveUpdateFields
if ($isRecursiveUpdateRequired === false) {
$solrConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($pageId);
$indexQueueConfigurationName = $this->configurationAwareRecordService->getIndexingConfigurationName('pages', $pageId, $solrConfiguration);
$meilisearchConfiguration = $this->frontendEnvironment->getMeilisearchConfigurationFromPageId($pageId);
$indexQueueConfigurationName = $this->configurationAwareRecordService->getIndexingConfigurationName('pages', $pageId, $meilisearchConfiguration);
if ($indexQueueConfigurationName === null) {
return false;
}
$updateFields = $solrConfiguration->getIndexQueueConfigurationRecursiveUpdateFields($indexQueueConfigurationName);
$updateFields = $meilisearchConfiguration->getIndexQueueConfigurationRecursiveUpdateFields($indexQueueConfigurationName);
// Check if no additional fields have been defined and then skip recursive update
if (empty($updateFields)) {

View File

@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch;
***************************************************************/
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\ContentObject\ContentObjectService;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
@ -67,7 +67,7 @@ class AdditionalFieldsIndexer implements SubstitutePageIndexer
*/
public function __construct(TypoScriptConfiguration $configuration = null, ContentObjectService $contentObjectService = null)
{
$this->configuration = $configuration === null ? Util::getSolrConfiguration() : $configuration;
$this->configuration = $configuration === null ? Util::getMeilisearchConfiguration() : $configuration;
$this->additionalIndexingFields = $this->configuration->getIndexAdditionalFieldsConfiguration();
$this->additionalFieldNames = $this->configuration->getIndexMappedAdditionalFieldNames();
$this->contentObjectService = $contentObjectService === null ? GeneralUtility::makeInstance(ContentObjectService::class) : $contentObjectService;
@ -80,7 +80,7 @@ class AdditionalFieldsIndexer implements SubstitutePageIndexer
* plugin.tx_meilisearch.index.additionalFields.
*
* @param Document $pageDocument The original page document.
* @return Document A Apache Solr Document object that replace the default page document
* @return Document A Meilisearch Document object that replace the default page document
*/
public function getPageDocument(Document $pageDocument)
{

View File

@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
/**
* Interface that defines the method an indexer must implement to provide
@ -43,7 +43,7 @@ interface AdditionalPageIndexer
*
* @param Document $pageDocument The original page document.
* @param array $allDocuments An array containing all the documents collected until here, including the page document
* @return array An array of additional \WapplerSystems\Meilisearch\System\Solr\Document\Document objects
* @return array An array of additional \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document objects
*/
public function getAdditionalPageDocuments(Document $pageDocument, array $allDocuments);
}

View File

@ -141,10 +141,10 @@ class IndexingConfigurationSelectorField
{
$indexingTableMap = [];
$solrConfiguration = $this->site->getSolrConfiguration();
$configurationNames = $solrConfiguration->getEnabledIndexQueueConfigurationNames();
$meilisearchConfiguration = $this->site->getMeilisearchConfiguration();
$configurationNames = $meilisearchConfiguration->getEnabledIndexQueueConfigurationNames();
foreach ($configurationNames as $configurationName) {
$indexingTableMap[$configurationName] = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($configurationName);
$indexingTableMap[$configurationName] = $meilisearchConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($configurationName);
}
return $indexingTableMap;

View File

@ -39,7 +39,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class SiteSelectorField
{
/**
* Creates a dropdown selector of available TYPO3 sites with Solr configured.
* Creates a dropdown selector of available TYPO3 sites with Meilisearch configured.
*
* @param string $selectorName Name to be used in the select's name attribute
* @param Site $selectedSite Optional, currently selected site

View File

@ -24,20 +24,20 @@ namespace WapplerSystems\Meilisearch;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use MeiliSearch\Client;
use TYPO3\CMS\Core\Utility\DebugUtility;
use WapplerSystems\Meilisearch\Domain\Site\Site;
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository as PagesRepositoryAtExtSolr;
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository as PagesRepositoryAtExtMeilisearch;
use WapplerSystems\Meilisearch\System\Records\SystemLanguage\SystemLanguageRepository;
use WapplerSystems\Meilisearch\System\Solr\Node;
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
use InvalidArgumentException;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use function json_encode;
/**
* ConnectionManager is responsible to create SolrConnection objects.
* ConnectionManager is responsible to create MeilisearchConnection objects.
*
* @author Ingo Renner <ingo@typo3.org>
*/
@ -55,9 +55,9 @@ class ConnectionManager implements SingletonInterface
protected $systemLanguageRepository;
/**
* @var PagesRepositoryAtExtSolr
* @var PagesRepositoryAtExtMeilisearch
*/
protected $pagesRepositoryAtExtSolr;
protected $pagesRepositoryAtExtMeilisearch;
/**
* @var SiteRepository
@ -67,130 +67,130 @@ class ConnectionManager implements SingletonInterface
/**
* @param SystemLanguageRepository $systemLanguageRepository
* @param PagesRepositoryAtExtSolr|null $pagesRepositoryAtExtSolr
* @param PagesRepositoryAtExtMeilisearch|null $pagesRepositoryAtExtMeilisearch
* @param SiteRepository $siteRepository
*/
public function __construct(
SystemLanguageRepository $systemLanguageRepository = null,
PagesRepositoryAtExtSolr $pagesRepositoryAtExtSolr = null,
PagesRepositoryAtExtMeilisearch $pagesRepositoryAtExtMeilisearch = null,
SiteRepository $siteRepository = null
)
{
$this->systemLanguageRepository = $systemLanguageRepository ?? GeneralUtility::makeInstance(SystemLanguageRepository::class);
$this->siteRepository = $siteRepository ?? GeneralUtility::makeInstance(SiteRepository::class);
$this->pagesRepositoryAtExtSolr = $pagesRepositoryAtExtSolr ?? GeneralUtility::makeInstance(PagesRepositoryAtExtSolr::class);
$this->pagesRepositoryAtExtMeilisearch = $pagesRepositoryAtExtMeilisearch ?? GeneralUtility::makeInstance(PagesRepositoryAtExtMeilisearch::class);
}
/**
* Creates a solr connection for read and write endpoints
* Creates a meilisearch connection for read and write endpoints
*
* @param array $readNodeConfiguration
* @param array $writeNodeConfiguration
* @return SolrConnection|object
* @return MeilisearchConnection|object
*/
public function getSolrConnectionForNodes(array $readNodeConfiguration, array $writeNodeConfiguration)
public function getMeilisearchConnectionForNodes(array $readNodeConfiguration, array $writeNodeConfiguration)
{
$connectionHash = md5(json_encode($readNodeConfiguration) . json_encode($writeNodeConfiguration));
if (!isset(self::$connections[$connectionHash])) {
$readNode = Node::fromArray($readNodeConfiguration);
$writeNode = Node::fromArray($writeNodeConfiguration);
self::$connections[$connectionHash] = GeneralUtility::makeInstance(SolrConnection::class, $readNode, $writeNode);
$readNode = $this->createClientFromArray($readNodeConfiguration);
$writeNode = $this->createClientFromArray($writeNodeConfiguration);
self::$connections[$connectionHash] = GeneralUtility::makeInstance(MeilisearchConnection::class, $readNode, $writeNode);
}
return self::$connections[$connectionHash];
}
/**
* Creates a solr configuration from the configuration array and returns it.
* Creates a meilisearch configuration from the configuration array and returns it.
*
* @param array $config The solr configuration array
* @return SolrConnection
* @param array $config The meilisearch configuration array
* @return MeilisearchConnection
*/
public function getConnectionFromConfiguration(array $config)
{
if(empty($config['read']) && !empty($config['solrHost'])) {
throw new InvalidArgumentException('Invalid registry data please re-initialize your solr connections');
if(empty($config['read']) && !empty($config['meilisearchHost'])) {
throw new InvalidArgumentException('Invalid registry data please re-initialize your meilisearch connections');
}
return $this->getSolrConnectionForNodes($config['read'], $config['write']);
return $this->getMeilisearchConnectionForNodes($config['read'], $config['write']);
}
/**
* Gets a Solr connection for a page ID.
* Gets a Meilisearch connection for a page ID.
*
* @param int $pageId A page ID.
* @param int $language The language ID to get the connection for as the path may differ. Optional, defaults to 0.
* @param string $mount Comma list of MountPoint parameters
* @return SolrConnection A solr connection.
* @throws NoSolrConnectionFoundException
* @return MeilisearchConnection A meilisearch connection.
* @throws NoMeilisearchConnectionFoundException
*/
public function getConnectionByPageId($pageId, $language = 0, $mount = '')
{
try {
$site = $this->siteRepository->getSiteByPageId($pageId, $mount);
$this->throwExceptionOnInvalidSite($site, 'No site for pageId ' . $pageId);
$config = $site->getSolrConnectionConfiguration($language);
$solrConnection = $this->getConnectionFromConfiguration($config);
return $solrConnection;
$config = $site->getMeilisearchConnectionConfiguration($language);
$meilisearchConnection = $this->getConnectionFromConfiguration($config);
return $meilisearchConnection;
} catch(InvalidArgumentException $e) {
$noSolrConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
throw $noSolrConnectionException;
$noMeilisearchConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
throw $noMeilisearchConnectionException;
}
}
/**
* Gets a Solr connection for a root page ID.
* Gets a Meilisearch connection for a root page ID.
*
* @param int $pageId A root page ID.
* @param int $language The language ID to get the connection for as the path may differ. Optional, defaults to 0.
* @return SolrConnection A solr connection.
* @throws NoSolrConnectionFoundException
* @return MeilisearchConnection A meilisearch connection.
* @throws NoMeilisearchConnectionFoundException
*/
public function getConnectionByRootPageId($pageId, $language = 0)
{
try {
$site = $this->siteRepository->getSiteByRootPageId($pageId);
$this->throwExceptionOnInvalidSite($site, 'No site for pageId ' . $pageId);
$config = $site->getSolrConnectionConfiguration($language);
$solrConnection = $this->getConnectionFromConfiguration($config);
return $solrConnection;
$config = $site->getMeilisearchConnectionConfiguration($language);
$meilisearchConnection = $this->getConnectionFromConfiguration($config);
return $meilisearchConnection;
} catch (InvalidArgumentException $e) {
/* @var NoSolrConnectionFoundException $noSolrConnectionException */
$noSolrConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
throw $noSolrConnectionException;
/* @var NoMeilisearchConnectionFoundException $noMeilisearchConnectionException */
$noMeilisearchConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
throw $noMeilisearchConnectionException;
}
}
/**
* Gets all connections found.
*
* @return SolrConnection[] An array of initialized WapplerSystems\Meilisearch\System\Solr\SolrConnection connections
* @throws NoSolrConnectionFoundException
* @return MeilisearchConnection[] An array of initialized WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection connections
* @throws NoMeilisearchConnectionFoundException
*/
public function getAllConnections()
{
$solrConnections = [];
$meilisearchConnections = [];
foreach ($this->siteRepository->getAvailableSites() as $site) {
foreach ($site->getAllSolrConnectionConfigurations() as $solrConfiguration) {
$solrConnections[] = $this->getConnectionFromConfiguration($solrConfiguration);
foreach ($site->getAllMeilisearchConnectionConfigurations() as $meilisearchConfiguration) {
$meilisearchConnections[] = $this->getConnectionFromConfiguration($meilisearchConfiguration);
}
}
return $solrConnections;
return $meilisearchConnections;
}
/**
* Gets all connections configured for a given site.
*
* @param Site $site A TYPO3 site
* @return SolrConnection[] An array of Solr connection objects (WapplerSystems\Meilisearch\System\Solr\SolrConnection)
* @throws NoSolrConnectionFoundException
* @return MeilisearchConnection[] An array of Meilisearch connection objects (WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection)
* @throws NoMeilisearchConnectionFoundException
*/
public function getConnectionsBySite(Site $site)
{
$connections = [];
foreach ($site->getAllSolrConnectionConfigurations() as $languageId => $solrConnectionConfiguration) {
$connections[$languageId] = $this->getConnectionFromConfiguration($solrConnectionConfiguration);
foreach ($site->getAllMeilisearchConnectionConfigurations() as $languageId => $meilisearchConnectionConfiguration) {
$connections[$languageId] = $this->getConnectionFromConfiguration($meilisearchConnectionConfiguration);
}
return $connections;
@ -220,15 +220,15 @@ class ConnectionManager implements SingletonInterface
/**
* @param $pageId
* @param $language
* @return NoSolrConnectionFoundException
* @return NoMeilisearchConnectionFoundException
*/
protected function buildNoConnectionExceptionForPageAndLanguage($pageId, $language): NoSolrConnectionFoundException
protected function buildNoConnectionExceptionForPageAndLanguage($pageId, $language): NoMeilisearchConnectionFoundException
{
$message = 'Could not find a Solr connection for page [' . $pageId . '] and language [' . $language . '].';
$noSolrConnectionException = $this->buildNoConnectionException($message);
$message = 'Could not find a Meilisearch connection for page [' . $pageId . '] and language [' . $language . '].';
$noMeilisearchConnectionException = $this->buildNoConnectionException($message);
$noSolrConnectionException->setLanguageId($language);
return $noSolrConnectionException;
$noMeilisearchConnectionException->setLanguageId($language);
return $noMeilisearchConnectionException;
}
/**
@ -236,7 +236,7 @@ class ConnectionManager implements SingletonInterface
*
* @param Site|null $site
* @param $message
* @throws NoSolrConnectionFoundException
* @throws NoMeilisearchConnectionFoundException
*/
protected function throwExceptionOnInvalidSite(?Site $site, string $message)
{
@ -248,20 +248,27 @@ class ConnectionManager implements SingletonInterface
}
/**
* Build a NoSolrConnectionFoundException with the passed message.
* Build a NoMeilisearchConnectionFoundException with the passed message.
* @param string $message
* @return NoSolrConnectionFoundException
* @return NoMeilisearchConnectionFoundException
*/
protected function buildNoConnectionException(string $message): NoSolrConnectionFoundException
protected function buildNoConnectionException(string $message): NoMeilisearchConnectionFoundException
{
/* @var NoSolrConnectionFoundException $noSolrConnectionException */
$noSolrConnectionException = GeneralUtility::makeInstance(
NoSolrConnectionFoundException::class,
/* @var NoMeilisearchConnectionFoundException $noMeilisearchConnectionException */
$noMeilisearchConnectionException = GeneralUtility::makeInstance(
NoMeilisearchConnectionFoundException::class,
/** @scrutinizer ignore-type */
$message,
/** @scrutinizer ignore-type */
1575396474
);
return $noSolrConnectionException;
return $noMeilisearchConnectionException;
}
private function createClientFromArray(array $configuration) {
return new Client(($configuration['scheme'] ?? 'http') . '://'.$configuration['host'].':'.$configuration['port'], $configuration['apiKey'] ?? null, new \TYPO3\CMS\Core\Http\Client(\TYPO3\CMS\Core\Http\Client\GuzzleClientFactory::getClient()));
}
}

View File

@ -37,7 +37,7 @@ use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
*
* keywords = SOLR_CLASSIFICATION # supports stdWrap
* keywords {
* field = __solr_content # a comma separated field. instead of field you can also use "value"
* field = __meilisearch_content # a comma separated field. instead of field you can also use "value"
* classes {
* 1 {
* patterns = smartphone, mobile, mobilephone # list of patterns that need to match to assign that class

View File

@ -31,7 +31,7 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* A content object (cObj) to clean a database field in a way so that it can be
* used to fill a Solr document's content field.
* used to fill a Meilisearch document's content field.
*
* @author Ingo Renner <ingo@typo3.org>
*/

View File

@ -29,7 +29,7 @@ use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
/**
* A content object (cObj) to turn comma separated strings into an array to be
* used in a multi value field in a Solr document.
* used in a multi value field in a Meilisearch document.
*
* Example usage:
*
@ -51,7 +51,7 @@ class Multivalue extends AbstractContentObject
* Executes the SOLR_MULTIVALUE content object.
*
* Turns a list of values into an array that can then be used to fill
* multivalued fields in a Solr document. The array is returned in
* multivalued fields in a Meilisearch document. The array is returned in
* serialized form as content objects are expected to return strings.
*
* @inheritDoc

View File

@ -17,13 +17,13 @@ namespace WapplerSystems\Meilisearch\Controller;
use WapplerSystems\Meilisearch\ConnectionManager;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetService;
use WapplerSystems\Meilisearch\Domain\Search\SearchRequestBuilder;
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
use WapplerSystems\Meilisearch\Search;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\Mvc\Controller\SolrControllerContext;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\Mvc\Controller\MeilisearchControllerContext;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\System\Service\ConfigurationService;
use WapplerSystems\Meilisearch\System\Configuration\ConfigurationManager as SolrConfigurationManager;
use WapplerSystems\Meilisearch\System\Configuration\ConfigurationManager as MeilisearchConfigurationManager;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@ -56,9 +56,9 @@ abstract class AbstractBaseController extends ActionController
protected $configurationManager;
/**
* @var SolrConfigurationManager
* @var MeilisearchConfigurationManager
*/
private $solrConfigurationManager;
private $meilisearchConfigurationManager;
/**
* The configuration is private if you need it please get it from the controllerContext.
@ -68,7 +68,7 @@ abstract class AbstractBaseController extends ActionController
protected $typoScriptConfiguration;
/**
* @var \WapplerSystems\Meilisearch\Mvc\Controller\SolrControllerContext
* @var \WapplerSystems\Meilisearch\Mvc\Controller\MeilisearchControllerContext
*/
protected $controllerContext;
@ -115,11 +115,11 @@ abstract class AbstractBaseController extends ActionController
}
/**
* @param SolrConfigurationManager $configurationManager
* @param MeilisearchConfigurationManager $configurationManager
*/
public function injectSolrConfigurationManager(SolrConfigurationManager $configurationManager)
public function injectMeilisearchConfigurationManager(MeilisearchConfigurationManager $configurationManager)
{
$this->solrConfigurationManager = $configurationManager;
$this->meilisearchConfigurationManager = $configurationManager;
}
/**
@ -138,8 +138,8 @@ abstract class AbstractBaseController extends ActionController
*/
protected function buildControllerContext()
{
/** @var $controllerContext \WapplerSystems\Meilisearch\Mvc\Controller\SolrControllerContext */
$controllerContext = $this->objectManager->get(SolrControllerContext::class);
/** @var $controllerContext \WapplerSystems\Meilisearch\Mvc\Controller\MeilisearchControllerContext */
$controllerContext = $this->objectManager->get(MeilisearchControllerContext::class);
$controllerContext->setRequest($this->request);
$controllerContext->setResponse($this->response);
if ($this->arguments !== null) {
@ -159,23 +159,23 @@ abstract class AbstractBaseController extends ActionController
{
// Reset configuration (to reset flexform overrides) if resetting is enabled
if ($this->resetConfigurationBeforeInitialize) {
$this->solrConfigurationManager->reset();
$this->meilisearchConfigurationManager->reset();
}
/** @var TypoScriptService $typoScriptService */
$typoScriptService = $this->objectManager->get(TypoScriptService::class);
// Merge settings done by typoscript with solrConfiguration plugin.tx_meilisearch (obsolete when part of ext:solr)
// Merge settings done by typoscript with meilisearchConfiguration plugin.tx_meilisearch (obsolete when part of ext:meilisearch)
$frameWorkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$pluginSettings = [];
foreach (['search', 'settings', 'suggest', 'statistics', 'logging', 'general', 'solr', 'view'] as $key) {
foreach (['search', 'settings', 'suggest', 'statistics', 'logging', 'general', 'meilisearch', 'view'] as $key) {
if (isset($frameWorkConfiguration[$key])) {
$pluginSettings[$key] = $frameWorkConfiguration[$key];
}
}
$this->typoScriptConfiguration = $this->solrConfigurationManager->getTypoScriptConfiguration();
$this->typoScriptConfiguration = $this->meilisearchConfigurationManager->getTypoScriptConfiguration();
if ($pluginSettings !== []) {
$this->typoScriptConfiguration->mergeSolrConfiguration(
$this->typoScriptConfiguration->mergeMeilisearchConfiguration(
$typoScriptService->convertPlainArrayToTypoScriptArray($pluginSettings),
true,
false
@ -192,7 +192,7 @@ abstract class AbstractBaseController extends ActionController
$this->typoScriptFrontendController = $GLOBALS['TSFE'];
$this->initializeSettings();
if ($this->actionMethodName !== 'solrNotAvailableAction') {
if ($this->actionMethodName !== 'meilisearchNotAvailableAction') {
$this->initializeSearch();
}
}
@ -214,23 +214,23 @@ abstract class AbstractBaseController extends ActionController
}
/**
* Initialize the Solr connection and
* Initialize the Meilisearch connection and
* test the connection through a ping
*/
protected function initializeSearch()
{
/** @var \WapplerSystems\Meilisearch\ConnectionManager $solrConnection */
/** @var \WapplerSystems\Meilisearch\ConnectionManager $meilisearchConnection */
try {
$solrConnection = $this->objectManager->get(ConnectionManager::class)->getConnectionByPageId($this->typoScriptFrontendController->id, Util::getLanguageUid(), $this->typoScriptFrontendController->MP);
$search = $this->objectManager->get(Search::class, $solrConnection);
$meilisearchConnection = $this->objectManager->get(ConnectionManager::class)->getConnectionByPageId($this->typoScriptFrontendController->id, Util::getLanguageUid(), $this->typoScriptFrontendController->MP);
$search = $this->objectManager->get(Search::class, $meilisearchConnection);
$this->searchService = $this->objectManager->get(
SearchResultSetService::class,
/** @scrutinizer ignore-type */ $this->typoScriptConfiguration,
/** @scrutinizer ignore-type */ $search
);
} catch (NoSolrConnectionFoundException $e) {
$this->handleSolrUnavailable();
} catch (NoMeilisearchConnectionFoundException $e) {
$this->handleMeilisearchUnavailable();
}
}
@ -247,16 +247,16 @@ abstract class AbstractBaseController extends ActionController
}
/**
* Called when the solr server is unavailable.
* Called when the meilisearch server is unavailable.
*
* @return void
*/
protected function handleSolrUnavailable()
protected function handleMeilisearchUnavailable()
{
if ($this->typoScriptConfiguration->getLoggingExceptions()) {
/** @var SolrLogManager $logger */
$logger = GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$logger->log(SolrLogManager::ERROR, 'Solr server is not available');
/** @var MeilisearchLogManager $logger */
$logger = GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$logger->log(MeilisearchLogManager::ERROR, 'Meilisearch server is not available');
}
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
/***************************************************************
* Copyright notice
*
* (c) 2010-2017 dkd Internet Service GmbH <solr-support@dkd.de>
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-support@dkd.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
use WapplerSystems\Meilisearch\ConnectionManager;
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
use WapplerSystems\Meilisearch\Domain\Site\Site;
use WapplerSystems\Meilisearch\System\Solr\SolrConnection as SolrCoreConnection;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection as MeilisearchCoreConnection;
use WapplerSystems\Meilisearch\System\Mvc\Backend\Component\Exception\InvalidViewObjectNameException;
use WapplerSystems\Meilisearch\System\Mvc\Backend\Service\ModuleDataStorageService;
use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
@ -81,9 +81,9 @@ abstract class AbstractModuleController extends ActionController
protected $siteRepository;
/**
* @var SolrCoreConnection
* @var MeilisearchCoreConnection
*/
protected $selectedSolrCoreConnection;
protected $selectedMeilisearchCoreConnection;
/**
* @var Menu
@ -93,7 +93,7 @@ abstract class AbstractModuleController extends ActionController
/**
* @var ConnectionManager
*/
protected $solrConnectionManager = null;
protected $meilisearchConnectionManager = null;
/**
* @var ModuleDataStorageService
@ -122,7 +122,7 @@ abstract class AbstractModuleController extends ActionController
protected function initializeAction()
{
parent::initializeAction();
$this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
$this->meilisearchConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
$this->moduleDataStorageService = GeneralUtility::makeInstance(ModuleDataStorageService::class);
$this->selectedPageUID = (int)GeneralUtility::_GP('id');
@ -213,7 +213,7 @@ abstract class AbstractModuleController extends ActionController
}
if ($this->view instanceof NotFoundView) {
$this->initializeSelectedSolrCoreConnection();
$this->initializeSelectedMeilisearchCoreConnection();
return;
}
@ -244,8 +244,8 @@ abstract class AbstractModuleController extends ActionController
$uriToRedirectTo = $this->uriBuilder->reset()->uriFor();
}
$this->initializeSelectedSolrCoreConnection();
$cores = $this->solrConnectionManager->getConnectionsBySite($site);
$this->initializeSelectedMeilisearchCoreConnection();
$cores = $this->meilisearchConnectionManager->getConnectionsBySite($site);
foreach ($cores as $core) {
$coreAdmin = $core->getAdminService();
$menuItem = $this->coreSelectorMenu->makeMenuItem();
@ -258,7 +258,7 @@ abstract class AbstractModuleController extends ActionController
);
$menuItem->setHref($uri);
if ($coreAdmin->getCorePath() == $this->selectedSolrCoreConnection->getAdminService()->getCorePath()) {
if ($coreAdmin->getCorePath() == $this->selectedMeilisearchCoreConnection->getAdminService()->getCorePath()) {
$menuItem->setActive(true);
}
$this->coreSelectorMenu->addMenuItem($menuItem);
@ -281,48 +281,48 @@ abstract class AbstractModuleController extends ActionController
$moduleData->setCore($corePath);
$this->moduleDataStorageService->persistModuleData($moduleData);
$message = LocalizationUtility::translate('coreselector_switched_successfully', 'solr', [$corePath]);
$message = LocalizationUtility::translate('coreselector_switched_successfully', 'meilisearch', [$corePath]);
$this->addFlashMessage($message);
$this->redirectToUri($uriToRedirectTo);
}
/**
* Initializes the solr core connection considerately to the components state.
* Initializes the meilisearch core connection considerately to the components state.
* Uses and persists default core connection if persisted core in Site does not exist.
*
*/
private function initializeSelectedSolrCoreConnection()
private function initializeSelectedMeilisearchCoreConnection()
{
$moduleData = $this->moduleDataStorageService->loadModuleData();
$solrCoreConnections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
$currentSolrCorePath = $moduleData->getCore();
if (empty($currentSolrCorePath)) {
$this->initializeFirstAvailableSolrCoreConnection($solrCoreConnections, $moduleData);
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
$currentMeilisearchCorePath = $moduleData->getCore();
if (empty($currentMeilisearchCorePath)) {
$this->initializeFirstAvailableMeilisearchCoreConnection($meilisearchCoreConnections, $moduleData);
return;
}
foreach ($solrCoreConnections as $solrCoreConnection) {
if ($solrCoreConnection->getAdminService()->getCorePath() == $currentSolrCorePath) {
$this->selectedSolrCoreConnection = $solrCoreConnection;
foreach ($meilisearchCoreConnections as $meilisearchCoreConnection) {
if ($meilisearchCoreConnection->getAdminService()->getCorePath() == $currentMeilisearchCorePath) {
$this->selectedMeilisearchCoreConnection = $meilisearchCoreConnection;
}
}
if (!$this->selectedSolrCoreConnection instanceof SolrCoreConnection && count($solrCoreConnections) > 0) {
$this->initializeFirstAvailableSolrCoreConnection($solrCoreConnections, $moduleData);
$message = LocalizationUtility::translate('coreselector_switched_to_default_core', 'solr', [$currentSolrCorePath, $this->selectedSite->getLabel(), $this->selectedSolrCoreConnection->getAdminService()->getCorePath()]);
if (!$this->selectedMeilisearchCoreConnection instanceof MeilisearchCoreConnection && count($meilisearchCoreConnections) > 0) {
$this->initializeFirstAvailableMeilisearchCoreConnection($meilisearchCoreConnections, $moduleData);
$message = LocalizationUtility::translate('coreselector_switched_to_default_core', 'meilisearch', [$currentMeilisearchCorePath, $this->selectedSite->getLabel(), $this->selectedMeilisearchCoreConnection->getAdminService()->getCorePath()]);
$this->addFlashMessage($message, '', AbstractMessage::NOTICE);
}
}
/**
* @param SolrCoreConnection[] $solrCoreConnections
* @param MeilisearchCoreConnection[] $meilisearchCoreConnections
*/
private function initializeFirstAvailableSolrCoreConnection(array $solrCoreConnections, $moduleData)
private function initializeFirstAvailableMeilisearchCoreConnection(array $meilisearchCoreConnections, $moduleData)
{
if (empty($solrCoreConnections)) {
if (empty($meilisearchCoreConnections)) {
return;
}
$this->selectedSolrCoreConnection = $solrCoreConnections[0];
$moduleData->setCore($this->selectedSolrCoreConnection->getAdminService()->getCorePath());
$this->selectedMeilisearchCoreConnection = $meilisearchCoreConnections[0];
$moduleData->setCore($this->selectedMeilisearchCoreConnection->getAdminService()->getCorePath());
$this->moduleDataStorageService->persistModuleData($moduleData);
}
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
/***************************************************************
* Copyright notice
*
* (c) 2010-2017 dkd Internet Service GmbH <solrs-support@dkd.de>
* (c) 2010-2017 dkd Internet Service GmbH <meilisearchs-support@dkd.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@ -60,13 +60,13 @@ class CoreOptimizationModuleController extends AbstractModuleController
*/
public function indexAction()
{
if ($this->selectedSolrCoreConnection === null) {
if ($this->selectedMeilisearchCoreConnection === null) {
$this->view->assign('can_not_proceed', true);
return;
}
$synonyms = [];
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$rawSynonyms = $coreAdmin->getSynonyms();
foreach ($rawSynonyms as $baseWord => $synonymList) {
$synonyms[$baseWord] = implode(', ', $synonymList);
@ -100,7 +100,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
$baseWord = mb_strtolower($baseWord);
$synonyms = mb_strtolower($synonyms);
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
if ($overrideExisting && $coreAdmin->getSynonyms($baseWord)) {
$coreAdmin->deleteSynonym($baseWord);
}
@ -121,7 +121,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
*/
public function exportStopWordsAction($fileFormat = 'txt')
{
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$this->exportFile(
implode(PHP_EOL, $coreAdmin->getStopWords()),
'stopwords',
@ -137,7 +137,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
*/
public function exportSynonymsAction($fileFormat = 'txt')
{
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$synonyms = $coreAdmin->getSynonyms();
return $this->exportFile(ManagedResourcesUtility::exportSynonymsToTxt($synonyms), 'synonyms', $fileFormat);
}
@ -157,7 +157,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
$fileLines = ManagedResourcesUtility::importSynonymsFromPlainTextContents($synonymFileUpload);
$synonymCount = 0;
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
foreach ($fileLines as $baseWord => $synonyms) {
if (!isset($baseWord) || empty($synonyms)) {
continue;
@ -197,7 +197,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
{
$allSynonymsCouldBeDeleted = $this->deleteAllSynonyms();
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$reloadResponse = $coreAdmin->reloadCore();
if ($allSynonymsCouldBeDeleted
@ -223,7 +223,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
*/
public function deleteSynonymsAction($baseWord)
{
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$deleteResponse = $coreAdmin->deleteSynonym($baseWord);
$reloadResponse = $coreAdmin->reloadCore();
@ -245,7 +245,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
}
/**
* Saves the edited stop word list to Solr
* Saves the edited stop word list to Meilisearch
*
* @param string $stopWords
* @param bool $replaceStopwords
@ -257,7 +257,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
$newStopWords = mb_strtolower($stopWords);
$newStopWords = GeneralUtility::trimExplode("\n", $newStopWords, true);
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$oldStopWords = $coreAdmin->getStopWords();
if ($replaceStopwords) {
@ -292,7 +292,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
*/
protected function exportFile($content, $type = 'synonyms', $fileExtension = 'txt') : string
{
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$this->response->setHeader('Content-type', 'text/plain', true);
$this->response->setHeader('Cache-control', 'public', true);
@ -322,13 +322,13 @@ class CoreOptimizationModuleController extends AbstractModuleController
}
/**
* Delete complete synonym list form solr
* Delete complete synonym list form meilisearch
*
* @return bool
*/
protected function deleteAllSynonyms() : bool
{
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
$synonyms = $coreAdmin->getSynonyms();
$allSynonymsCouldBeDeleted = true;
@ -347,7 +347,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
protected function removeStopsWordsFromIndex($stopwordsToRemove) : bool
{
$wordsRemoved = true;
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
foreach ($stopwordsToRemove as $word) {
$response = $coreAdmin->deleteStopWord($word);
@ -373,7 +373,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
*/
protected function deleteExistingSynonym($overrideExisting, $deleteSynonymsBefore, $baseWord)
{
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
if (!$deleteSynonymsBefore &&
$overrideExisting &&

View File

@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
use WapplerSystems\Meilisearch\ConnectionManager;
use WapplerSystems\Meilisearch\IndexQueue\Queue;
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder;
use TYPO3\CMS\Core\Messaging\FlashMessage;
@ -50,14 +50,14 @@ class IndexAdministrationModuleController extends AbstractModuleController
/**
* @var ConnectionManager
*/
protected $solrConnectionManager = null;
protected $meilisearchConnectionManager = null;
/**
* @param ConnectionManager $solrConnectionManager
* @param ConnectionManager $meilisearchConnectionManager
*/
public function setSolrConnectionManager(ConnectionManager $solrConnectionManager)
public function setMeilisearchConnectionManager(ConnectionManager $meilisearchConnectionManager)
{
$this->solrConnectionManager = $solrConnectionManager;
$this->meilisearchConnectionManager = $meilisearchConnectionManager;
}
/**
@ -67,7 +67,7 @@ class IndexAdministrationModuleController extends AbstractModuleController
{
parent::initializeAction();
$this->indexQueue = GeneralUtility::makeInstance(Queue::class);
$this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
$this->meilisearchConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
}
/**
@ -77,7 +77,7 @@ class IndexAdministrationModuleController extends AbstractModuleController
*/
public function indexAction()
{
if ($this->selectedSite === null || empty($this->solrConnectionManager->getConnectionsBySite($this->selectedSite))) {
if ($this->selectedSite === null || empty($this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite))) {
$this->view->assign('can_not_proceed', true);
}
}
@ -93,18 +93,18 @@ class IndexAdministrationModuleController extends AbstractModuleController
try {
$affectedCores = [];
$solrServers = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
foreach ($solrServers as $solrServer) {
$writeService = $solrServer->getWriteService();
/* @var $solrServer SolrConnection */
$meilisearchServers = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
foreach ($meilisearchServers as $meilisearchServer) {
$writeService = $meilisearchServer->getWriteService();
/* @var $meilisearchServer MeilisearchConnection */
$writeService->deleteByQuery('siteHash:' . $siteHash);
$writeService->commit(false, false, false);
$affectedCores[] = $writeService->getPrimaryEndpoint()->getCore();
}
$message = LocalizationUtility::translate('solr.backend.index_administration.index_emptied_all', 'Solr', [$this->selectedSite->getLabel(), implode(', ', $affectedCores)]);
$message = LocalizationUtility::translate('meilisearch.backend.index_administration.index_emptied_all', 'Meilisearch', [$this->selectedSite->getLabel(), implode(', ', $affectedCores)]);
$this->addFlashMessage($message);
} catch (\Exception $e) {
$this->addFlashMessage(LocalizationUtility::translate('solr.backend.index_administration.error.on_empty_index', 'Solr', [$e->__toString()]), '', FlashMessage::ERROR);
$this->addFlashMessage(LocalizationUtility::translate('meilisearch.backend.index_administration.error.on_empty_index', 'Meilisearch', [$e->__toString()]), '', FlashMessage::ERROR);
}
$this->redirect('index');
@ -119,14 +119,14 @@ class IndexAdministrationModuleController extends AbstractModuleController
{
$this->indexQueue->deleteItemsBySite($this->selectedSite);
$this->addFlashMessage(
LocalizationUtility::translate('solr.backend.index_administration.success.queue_emptied', 'Solr',
LocalizationUtility::translate('meilisearch.backend.index_administration.success.queue_emptied', 'Meilisearch',
[$this->selectedSite->getLabel()])
);
$this->redirectToReferrerModule();
}
/**
* Reloads the site's Solr cores.
* Reloads the site's Meilisearch cores.
*
* @return void
*/
@ -134,11 +134,11 @@ class IndexAdministrationModuleController extends AbstractModuleController
{
$coresReloaded = true;
$reloadedCores = [];
$solrServers = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
$meilisearchServers = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
foreach ($solrServers as $solrServer) {
/* @var $solrServer SolrConnection */
$coreAdmin = $solrServer->getAdminService();
foreach ($meilisearchServers as $meilisearchServer) {
/* @var $meilisearchServer MeilisearchConnection */
$coreAdmin = $meilisearchServer->getAdminService();
$coreReloaded = $coreAdmin->reloadCore()->getHttpStatus() === 200;
$coreName = $coreAdmin->getPrimaryEndpoint()->getCore();
@ -188,7 +188,7 @@ class IndexAdministrationModuleController extends AbstractModuleController
$backendUriBuilder = GeneralUtility::makeInstance(BackendUriBuilder::class);
$parameters = ['id' => $this->selectedPageUID];
$referringUri = $backendUriBuilder->buildUriFromRoute('searchbackend_SolrIndexqueue', $parameters);
$referringUri = $backendUriBuilder->buildUriFromRoute('searchbackend_MeilisearchIndexqueue', $parameters);
$this->redirectToUri($referringUri);
}

View File

@ -114,10 +114,10 @@ class IndexQueueModuleController extends AbstractModuleController
*/
protected function canQueueSelectedSite()
{
if ($this->selectedSite === null || empty($this->solrConnectionManager->getConnectionsBySite($this->selectedSite))) {
if ($this->selectedSite === null || empty($this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite))) {
return false;
}
$enabledIndexQueueConfigurationNames = $this->selectedSite->getSolrConfiguration()->getEnabledIndexQueueConfigurationNames();
$enabledIndexQueueConfigurationNames = $this->selectedSite->getMeilisearchConfiguration()->getEnabledIndexQueueConfigurationNames();
if (empty($enabledIndexQueueConfigurationNames)) {
return false;
}
@ -153,11 +153,11 @@ class IndexQueueModuleController extends AbstractModuleController
// initialize selected indexing configuration
$initializedIndexingConfigurations = $this->indexQueue->getInitializationService()->initializeBySiteAndIndexConfigurations($this->selectedSite, $indexingConfigurationsToInitialize);
} else {
$messageLabel = 'solr.backend.index_queue_module.flashmessage.initialize.no_selection';
$titleLabel = 'solr.backend.index_queue_module.flashmessage.not_initialized.title';
$messageLabel = 'meilisearch.backend.index_queue_module.flashmessage.initialize.no_selection';
$titleLabel = 'meilisearch.backend.index_queue_module.flashmessage.not_initialized.title';
$this->addFlashMessage(
LocalizationUtility::translate($messageLabel, 'Solr'),
LocalizationUtility::translate($titleLabel, 'Solr'),
LocalizationUtility::translate($messageLabel, 'Meilisearch'),
LocalizationUtility::translate($titleLabel, 'Meilisearch'),
FlashMessage::WARNING
);
}
@ -168,11 +168,11 @@ class IndexQueueModuleController extends AbstractModuleController
}
if (!empty($initializedIndexingConfigurations)) {
$messageLabel = 'solr.backend.index_queue_module.flashmessage.initialize.success';
$titleLabel = 'solr.backend.index_queue_module.flashmessage.initialize.title';
$messageLabel = 'meilisearch.backend.index_queue_module.flashmessage.initialize.success';
$titleLabel = 'meilisearch.backend.index_queue_module.flashmessage.initialize.title';
$this->addFlashMessage(
LocalizationUtility::translate($messageLabel, 'Solr', [implode(', ', $messagesForConfigurations)]),
LocalizationUtility::translate($titleLabel, 'Solr'),
LocalizationUtility::translate($messageLabel, 'Meilisearch', [implode(', ', $messagesForConfigurations)]),
LocalizationUtility::translate($titleLabel, 'Meilisearch'),
FlashMessage::OK
);
}
@ -189,10 +189,10 @@ class IndexQueueModuleController extends AbstractModuleController
{
$resetResult = $this->indexQueue->resetAllErrors();
$label = 'solr.backend.index_queue_module.flashmessage.success.reset_errors';
$label = 'meilisearch.backend.index_queue_module.flashmessage.success.reset_errors';
$severity = FlashMessage::OK;
if (!$resetResult) {
$label = 'solr.backend.index_queue_module.flashmessage.error.reset_errors';
$label = 'meilisearch.backend.index_queue_module.flashmessage.error.reset_errors';
$severity = FlashMessage::ERROR;
}
@ -211,12 +211,12 @@ class IndexQueueModuleController extends AbstractModuleController
*/
public function requeueDocumentAction(string $type, int $uid)
{
$label = 'solr.backend.index_queue_module.flashmessage.error.single_item_not_requeued';
$label = 'meilisearch.backend.index_queue_module.flashmessage.error.single_item_not_requeued';
$severity = FlashMessage::ERROR;
$updateCount = $this->indexQueue->updateItem($type, $uid, time());
if ($updateCount > 0) {
$label = 'solr.backend.index_queue_module.flashmessage.success.single_item_was_requeued';
$label = 'meilisearch.backend.index_queue_module.flashmessage.success.single_item_was_requeued';
$severity = FlashMessage::OK;
}
@ -235,7 +235,7 @@ class IndexQueueModuleController extends AbstractModuleController
{
if (is_null($indexQueueItemId)) {
// add a flash message and quit
$label = 'solr.backend.index_queue_module.flashmessage.error.no_queue_item_for_queue_error';
$label = 'meilisearch.backend.index_queue_module.flashmessage.error.no_queue_item_for_queue_error';
$severity = FlashMessage::ERROR;
$this->addIndexQueueFlashMessage($label, $severity);
@ -258,16 +258,16 @@ class IndexQueueModuleController extends AbstractModuleController
$indexService = GeneralUtility::makeInstance(IndexService::class, /** @scrutinizer ignore-type */ $this->selectedSite);
$indexWithoutErrors = $indexService->indexItems(10);
$label = 'solr.backend.index_queue_module.flashmessage.success.index_manual';
$label = 'meilisearch.backend.index_queue_module.flashmessage.success.index_manual';
$severity = FlashMessage::OK;
if (!$indexWithoutErrors) {
$label = 'solr.backend.index_queue_module.flashmessage.error.index_manual';
$label = 'meilisearch.backend.index_queue_module.flashmessage.error.index_manual';
$severity = FlashMessage::ERROR;
}
$this->addFlashMessage(
LocalizationUtility::translate($label, 'Solr'),
LocalizationUtility::translate('solr.backend.index_queue_module.flashmessage.index_manual', 'Solr'),
LocalizationUtility::translate($label, 'Meilisearch'),
LocalizationUtility::translate('meilisearch.backend.index_queue_module.flashmessage.index_manual', 'Meilisearch'),
$severity
);
@ -282,6 +282,6 @@ class IndexQueueModuleController extends AbstractModuleController
*/
protected function addIndexQueueFlashMessage($label, $severity)
{
$this->addFlashMessage(LocalizationUtility::translate($label, 'Solr'), LocalizationUtility::translate('solr.backend.index_queue_module.flashmessage.title', 'Solr'), $severity);
$this->addFlashMessage(LocalizationUtility::translate($label, 'Meilisearch'), LocalizationUtility::translate('meilisearch.backend.index_queue_module.flashmessage.title', 'Meilisearch'), $severity);
}
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
/***************************************************************
* Copyright notice
*
* (c) 2010-2017 dkd Internet Service GmbH <solr-support@dkd.de>
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-support@dkd.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@ -27,8 +27,8 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
use WapplerSystems\Meilisearch\Api;
use WapplerSystems\Meilisearch\ConnectionManager;
use WapplerSystems\Meilisearch\Domain\Search\Statistics\StatisticsRepository;
use WapplerSystems\Meilisearch\Domain\Search\ApacheSolrDocument\Repository;
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
use WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument\Repository;
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Validator\Path;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
@ -46,12 +46,12 @@ class InfoModuleController extends AbstractModuleController
/**
* @var ConnectionManager
*/
protected $solrConnectionManager;
protected $meilisearchConnectionManager;
/**
* @var Repository
*/
protected $apacheSolrDocumentRepository;
protected $apacheMeilisearchDocumentRepository;
/**
* Initializes the controller before invoking an action method.
@ -59,8 +59,8 @@ class InfoModuleController extends AbstractModuleController
protected function initializeAction()
{
parent::initializeAction();
$this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
$this->apacheSolrDocumentRepository = GeneralUtility::makeInstance(Repository::class);
$this->meilisearchConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
//$this->apacheMeilisearchDocumentRepository = GeneralUtility::makeInstance(Repository::class);
}
/**
@ -80,7 +80,7 @@ class InfoModuleController extends AbstractModuleController
}
/**
* Index action, shows an overview of the state of the Solr index
* Index action, shows an overview of the state of the Meilisearch index
*
* @return void
*/
@ -106,12 +106,12 @@ class InfoModuleController extends AbstractModuleController
*/
public function documentsDetailsAction(string $type, int $uid, int $pageId, int $languageUid)
{
$documents = $this->apacheSolrDocumentRepository->findByTypeAndPidAndUidAndLanguageId($type, $uid, $pageId, $languageUid);
$documents = $this->apacheMeilisearchDocumentRepository->findByTypeAndPidAndUidAndLanguageId($type, $uid, $pageId, $languageUid);
$this->view->assign('documents', $documents);
}
/**
* Checks whether the configured Solr server can be reached and provides a
* Checks whether the configured Meilisearch server can be reached and provides a
* flash message according to the result of the check.
*
* @return void
@ -124,7 +124,7 @@ class InfoModuleController extends AbstractModuleController
/* @var Path $path */
$path = GeneralUtility::makeInstance(Path::class);
$connections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
$connections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
if (empty($connections)) {
$this->view->assign('can_not_proceed', true);
@ -141,7 +141,7 @@ class InfoModuleController extends AbstractModuleController
$missingHosts[] = $coreUrl;
}
if (!$path->isValidSolrPath($coreAdmin->getCorePath())) {
if (!$path->isValidMeilisearchPath($coreAdmin->getCorePath())) {
$invalidPaths[] = $coreAdmin->getCorePath();
}
}
@ -156,7 +156,7 @@ class InfoModuleController extends AbstractModuleController
}
/**
* Index action, shows an overview of the state of the Solr index
* Index action, shows an overview of the state of the Meilisearch index