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
*
* @return void
*/
@ -204,9 +204,9 @@ class InfoModuleController extends AbstractModuleController
{
$indexFieldsInfoByCorePaths = [];
$solrCoreConnections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
foreach ($solrCoreConnections as $solrCoreConnection) {
$coreAdmin = $solrCoreConnection->getAdminService();
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
foreach ($meilisearchCoreConnections as $meilisearchCoreConnection) {
$coreAdmin = $meilisearchCoreConnection->getAdminService();
$indexFieldsInfo = [
'corePath' => $coreAdmin->getCorePath()
@ -239,7 +239,7 @@ class InfoModuleController extends AbstractModuleController
$this->addFlashMessage(
'',
'Unable to contact Apache Solr server: ' . $this->selectedSite->getLabel() . ' ' . $coreAdmin->getCorePath(),
'Unable to contact Meilisearch server: ' . $this->selectedSite->getLabel() . ' ' . $coreAdmin->getCorePath(),
FlashMessage::ERROR
);
}
@ -255,11 +255,11 @@ class InfoModuleController extends AbstractModuleController
*/
protected function collectIndexInspectorInfo()
{
$solrCoreConnections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
$documentsByCoreAndType = [];
foreach ($solrCoreConnections as $languageId => $solrCoreConnection) {
$coreAdmin = $solrCoreConnection->getAdminService();
$documents = $this->apacheSolrDocumentRepository->findByPageIdAndByLanguageId($this->selectedPageUID, $languageId);
foreach ($meilisearchCoreConnections as $languageId => $meilisearchCoreConnection) {
$coreAdmin = $meilisearchCoreConnection->getAdminService();
$documents = $this->apacheMeilisearchDocumentRepository->findByPageIdAndByLanguageId($this->selectedPageUID, $languageId);
$documentsByType = [];
foreach ($documents as $document) {

View File

@ -15,8 +15,8 @@ namespace WapplerSystems\Meilisearch\Controller;
*/
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Solr\SolrUnavailableException;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchUnavailableException;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Mvc\Web\Response;
@ -115,8 +115,8 @@ class SearchController extends AbstractBaseController
$values = $this->emitActionSignal(__CLASS__, __FUNCTION__, [$values]);
$this->view->assignMultiple($values);
} catch (SolrUnavailableException $e) {
$this->handleSolrUnavailable();
} catch (MeilisearchUnavailableException $e) {
$this->handleMeilisearchUnavailable();
}
}
@ -161,7 +161,7 @@ class SearchController extends AbstractBaseController
}
/**
* This action allows to render a detailView with data from solr.
* This action allows to render a detailView with data from meilisearch.
*
* @param string $documentId
*/
@ -170,8 +170,8 @@ class SearchController extends AbstractBaseController
try {
$document = $this->searchService->getDocumentById($documentId);
$this->view->assign('document', $document);
} catch (SolrUnavailableException $e) {
$this->handleSolrUnavailable();
} catch (MeilisearchUnavailableException $e) {
$this->handleMeilisearchUnavailable();
}
}
@ -179,7 +179,7 @@ class SearchController extends AbstractBaseController
* Rendered when no search is available.
* @return string
*/
public function solrNotAvailableAction()
public function meilisearchNotAvailableAction()
{
if ($this->response instanceof Response) {
$this->response->setStatus(503);
@ -187,14 +187,14 @@ class SearchController extends AbstractBaseController
}
/**
* Called when the solr server is unavailable.
* Called when the meilisearch server is unavailable.
*
* @return void
*/
protected function handleSolrUnavailable()
protected function handleMeilisearchUnavailable()
{
parent::handleSolrUnavailable();
$this->forward('solrNotAvailable');
parent::handleMeilisearchUnavailable();
$this->forward('meilisearchNotAvailable');
}
/**

View File

@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Controller;
***************************************************************/
use WapplerSystems\Meilisearch\Domain\Search\Suggest\SuggestService;
use WapplerSystems\Meilisearch\System\Solr\SolrUnavailableException;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchUnavailableException;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@ -66,16 +66,14 @@ class SuggestController extends AbstractBaseController
$searchRequest = $this->getSearchRequestBuilder()->buildForSuggest($arguments, $rawQuery, $pageId, $languageId);
$result = $suggestService->getSuggestions($searchRequest, $additionalFilters);
} catch (SolrUnavailableException $e) {
$this->handleSolrUnavailable();
} catch (MeilisearchUnavailableException $e) {
$this->handleMeilisearchUnavailable();
$result = ['status' => false];
}
if ($callback) {
return htmlspecialchars($callback) . '(' . json_encode($result) . ')';
}
else {
return json_encode($result);
}
}
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Classification;
/***************************************************************
* 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

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Classification;
/***************************************************************
* 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

View File

@ -31,7 +31,7 @@ use WapplerSystems\Meilisearch\IndexQueue\Item;
use WapplerSystems\Meilisearch\IndexQueue\Queue;
use WapplerSystems\Meilisearch\Domain\Site\Site;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\Task\IndexQueueWorkerTask;
use Solarium\Exception\HttpException;
use TYPO3\CMS\Backend\Utility\BackendUtility;
@ -71,7 +71,7 @@ class IndexService
protected $signalSlotDispatcher;
/**
* @var \WapplerSystems\Meilisearch\System\Logging\SolrLogManager
* @var \WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager
*/
protected $logger = null;
@ -80,14 +80,14 @@ class IndexService
* @param Site $site
* @param Queue|null $queue
* @param Dispatcher|null $dispatcher
* @param SolrLogManager|null $solrLogManager
* @param MeilisearchLogManager|null $meilisearchLogManager
*/
public function __construct(Site $site, Queue $queue = null, Dispatcher $dispatcher = null, SolrLogManager $solrLogManager = null)
public function __construct(Site $site, Queue $queue = null, Dispatcher $dispatcher = null, MeilisearchLogManager $meilisearchLogManager = null)
{
$this->site = $site;
$this->indexQueue = $queue ?? GeneralUtility::makeInstance(Queue::class);
$this->signalSlotDispatcher = $dispatcher ?? GeneralUtility::makeInstance(Dispatcher::class);
$this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->logger = $meilisearchLogManager ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
}
/**
@ -116,7 +116,7 @@ class IndexService
{
$errors = 0;
$indexRunId = uniqid();
$configurationToUse = $this->site->getSolrConfiguration();
$configurationToUse = $this->site->getMeilisearchConfiguration();
$enableCommitsSetting = $configurationToUse->getEnableCommits();
// get items to index
@ -140,10 +140,10 @@ class IndexService
$this->emitSignal('afterIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);
if ($enableCommitsSetting && count($itemsToIndex) > 0) {
$solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
foreach ($solrServers as $solrServer) {
$meilisearchServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
foreach ($meilisearchServers as $meilisearchServer) {
try {
$solrServer->getWriteService()->commit(false, false, false);
$meilisearchServer->getWriteService()->commit(false, false, false);
} catch (HttpException $e) {
$errors++;
}
@ -165,7 +165,7 @@ class IndexService
$data = ['code' => $e->getCode(), 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString(), 'item' => (array)$itemToIndex];
$this->logger->log(
SolrLogManager::ERROR,
MeilisearchLogManager::ERROR,
$message,
$data
);

View File

@ -30,27 +30,27 @@ namespace WapplerSystems\Meilisearch\Domain\Index\PageIndexer\Helper\UriBuilder;
use WapplerSystems\Meilisearch\IndexQueue\Item;
use WapplerSystems\Meilisearch\IndexQueue\PageIndexerDataUrlModifier;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\System\Url\UrlHelper;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Implementations of this class are able to build an indexing url for solr page indexing.
* Implementations of this class are able to build an indexing url for meilisearch page indexing.
*/
abstract class AbstractUriStrategy
{
/**
* @var SolrLogManager|null|object
* @var MeilisearchLogManager|null|object
*/
protected $logger;
/**
* AbstractUriStrategy constructor.
* @param SolrLogManager|null $logger
* @param MeilisearchLogManager|null $logger
*/
public function __construct(SolrLogManager $logger = null)
public function __construct(MeilisearchLogManager $logger = null)
{
$this->logger = $logger ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->logger = $logger ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
}
/**
@ -100,7 +100,7 @@ abstract class AbstractUriStrategy
if (!GeneralUtility::isValidUrl($dataUrl)) {
$this->logger->log(
SolrLogManager::ERROR,
MeilisearchLogManager::ERROR,
'Could not create a valid URL to get frontend data while trying to index a page.',
[
'item' => (array)$item,
@ -140,13 +140,13 @@ abstract class AbstractUriStrategy
*/
protected function applyDataUrlModifier(Item $item, int $language, $dataUrl, UrlHelper $urlHelper):string
{
if (empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier'])) {
if (empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['IndexQueuePageIndexer']['dataUrlModifier'])) {
return $dataUrl;
}
$dataUrlModifier = GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier']);
$dataUrlModifier = GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['IndexQueuePageIndexer']['dataUrlModifier']);
if (!$dataUrlModifier instanceof PageIndexerDataUrlModifier) {
throw new \RuntimeException($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueuePageIndexer']['dataUrlModifier'] . ' is not an implementation of WapplerSystems\Meilisearch\IndexQueue\PageIndexerDataUrlModifier', 1290523345);
throw new \RuntimeException($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['IndexQueuePageIndexer']['dataUrlModifier'] . ' is not an implementation of WapplerSystems\Meilisearch\IndexQueue\PageIndexerDataUrlModifier', 1290523345);
}
return $dataUrlModifier->modifyDataUrl($dataUrl,

View File

@ -29,7 +29,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\PageIndexer\Helper\UriBuilder;
***************************************************************/
use WapplerSystems\Meilisearch\IndexQueue\Item;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Routing\InvalidRouteArgumentsException;
use TYPO3\CMS\Core\Site\SiteFinder;
@ -49,10 +49,10 @@ class TYPO3SiteStrategy extends AbstractUriStrategy
/**
* TYPO3SiteStrategy constructor.
* @param SolrLogManager|null $logger
* @param MeilisearchLogManager|null $logger
* @param SiteFinder|null $siteFinder
*/
public function __construct(SolrLogManager $logger = null, SiteFinder $siteFinder = null)
public function __construct(MeilisearchLogManager $logger = null, SiteFinder $siteFinder = null)
{
parent::__construct($logger);
$this->siteFinder = $siteFinder ?? GeneralUtility::makeInstance(SiteFinder::class);

View File

@ -40,7 +40,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* This can be:
* * A TYPO3 site managed with site management
* * A TYPO3 site without site management where the url is build by EXT:meilisearch with L and id param and information from the domain
* record or solr specific configuration.
* record or meilisearch specific configuration.
*/
class UriStrategyFactory
{

View File

@ -28,12 +28,12 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue\GarbageRemover;
use WapplerSystems\Meilisearch\ConnectionManager;
use WapplerSystems\Meilisearch\GarbageCollectorPostProcessor;
use WapplerSystems\Meilisearch\IndexQueue\Queue;
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* An implementation ob a garbage remover strategy is responsible to remove all garbage from the index queue and
* the solr server for a certain table and uid combination.
* the meilisearch server for a certain table and uid combination.
*/
abstract class AbstractStrategy
{
@ -74,7 +74,7 @@ abstract class AbstractStrategy
/**
* A implementation of the GarbageCollection strategy is responsible to remove the garbage from
* the indexqueue and from the solr server.
* the indexqueue and from the meilisearch server.
*
* @param string $table
* @param int $uid
@ -83,24 +83,24 @@ abstract class AbstractStrategy
abstract protected function removeGarbageOfByStrategy($table, $uid);
/**
* Deletes a document from solr and from the index queue.
* Deletes a document from meilisearch and from the index queue.
*
* @param string $table
* @param integer $uid
*/
protected function deleteInSolrAndRemoveFromIndexQueue($table, $uid)
protected function deleteInMeilisearchAndRemoveFromIndexQueue($table, $uid)
{
$this->deleteIndexDocuments($table, $uid);
$this->queue->deleteItem($table, $uid);
}
/**
* Deletes a document from solr and updates the item in the index queue (e.g. on page content updates).
* Deletes a document from meilisearch and updates the item in the index queue (e.g. on page content updates).
*
* @param string $table
* @param integer $uid
*/
protected function deleteInSolrAndUpdateIndexQueue($table, $uid)
protected function deleteInMeilisearchAndUpdateIndexQueue($table, $uid)
{
$this->deleteIndexDocuments($table, $uid);
$this->queue->updateItem($table, $uid);
@ -118,32 +118,32 @@ abstract class AbstractStrategy
$indexQueueItems = $this->queue->getItems($table, $uid);
foreach ($indexQueueItems as $indexQueueItem) {
$site = $indexQueueItem->getSite();
$enableCommitsSetting = $site->getSolrConfiguration()->getEnableCommits();
$enableCommitsSetting = $site->getMeilisearchConfiguration()->getEnableCommits();
$siteHash = $site->getSiteHash();
// a site can have multiple connections (cores / languages)
$solrConnections = $this->connectionManager->getConnectionsBySite($site);
$meilisearchConnections = $this->connectionManager->getConnectionsBySite($site);
if ($language > 0) {
$solrConnections = [$language => $solrConnections[$language]];
$meilisearchConnections = [$language => $meilisearchConnections[$language]];
}
$this->deleteRecordInAllSolrConnections($table, $uid, $solrConnections, $siteHash, $enableCommitsSetting);
$this->deleteRecordInAllMeilisearchConnections($table, $uid, $meilisearchConnections, $siteHash, $enableCommitsSetting);
}
}
/**
* Deletes the record in all solr connections from that site.
* Deletes the record in all meilisearch connections from that site.
*
* @param string $table
* @param int $uid
* @param SolrConnection[] $solrConnections
* @param MeilisearchConnection[] $meilisearchConnections
* @param string $siteHash
* @param boolean $enableCommitsSetting
*/
protected function deleteRecordInAllSolrConnections($table, $uid, $solrConnections, $siteHash, $enableCommitsSetting)
protected function deleteRecordInAllMeilisearchConnections($table, $uid, $meilisearchConnections, $siteHash, $enableCommitsSetting)
{
foreach ($solrConnections as $solr) {
$solr->getWriteService()->deleteByQuery('type:' . $table . ' AND uid:' . (int)$uid . ' AND siteHash:' . $siteHash);
foreach ($meilisearchConnections as $meilisearch) {
$meilisearch->getWriteService()->deleteByQuery('type:' . $table . ' AND uid:' . (int)$uid . ' AND siteHash:' . $siteHash);
if ($enableCommitsSetting) {
$solr->getWriteService()->commit(false, false);
$meilisearch->getWriteService()->commit(false, false);
}
}
}
@ -156,11 +156,11 @@ abstract class AbstractStrategy
*/
protected function callPostProcessGarbageCollectorHook($table, $uid)
{
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessGarbageCollector'])) {
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['postProcessGarbageCollector'])) {
return;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessGarbageCollector'] as $classReference) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['postProcessGarbageCollector'] as $classReference) {
$garbageCollectorPostProcessor = GeneralUtility::makeInstance($classReference);
if ($garbageCollectorPostProcessor instanceof GarbageCollectorPostProcessor) {

View File

@ -52,7 +52,7 @@ class PageStrategy extends AbstractStrategy {
}
/**
* Determines the relevant page id for an content element update. Deletes the page from solr and requeues the
* Determines the relevant page id for an content element update. Deletes the page from meilisearch and requeues the
* page for a reindex.
*
* @param int $ttContentUid
@ -60,7 +60,7 @@ class PageStrategy extends AbstractStrategy {
protected function collectPageGarbageByContentChange($ttContentUid)
{
$contentElement = BackendUtility::getRecord('tt_content', $ttContentUid, 'uid, pid', '', false);
$this->deleteInSolrAndUpdateIndexQueue('pages', $contentElement['pid']);
$this->deleteInMeilisearchAndUpdateIndexQueue('pages', $contentElement['pid']);
}
/**
@ -74,7 +74,7 @@ class PageStrategy extends AbstractStrategy {
if (!empty($pageOverlay['l10n_parent']) && intval($pageOverlay['l10n_parent']) !== 0) {
$this->deleteIndexDocuments('pages', (int)$pageOverlay['l10n_parent'], (int)$pageOverlay['sys_language_uid']);
} else {
$this->deleteInSolrAndRemoveFromIndexQueue('pages', $uid);
$this->deleteInMeilisearchAndRemoveFromIndexQueue('pages', $uid);
}
}
}

View File

@ -38,6 +38,6 @@ class RecordStrategy extends AbstractStrategy {
*/
protected function removeGarbageOfByStrategy($table, $uid)
{
$this->deleteInSolrAndRemoveFromIndexQueue($table, $uid);
$this->deleteInMeilisearchAndRemoveFromIndexQueue($table, $uid);
}
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
/***************************************************************
* 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

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
/***************************************************************
* 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
@ -97,16 +97,16 @@ class QueueInitializationService {
$initializationStatus = [];
$hasWildcardConfiguration = in_array('*', $indexingConfigurationNames);
$indexingConfigurationNames = $hasWildcardConfiguration ? $site->getSolrConfiguration()->getEnabledIndexQueueConfigurationNames() : $indexingConfigurationNames;
$indexingConfigurationNames = $hasWildcardConfiguration ? $site->getMeilisearchConfiguration()->getEnabledIndexQueueConfigurationNames() : $indexingConfigurationNames;
foreach ($indexingConfigurationNames as $indexingConfigurationName) {
$initializationStatus[$indexingConfigurationName] = $this->applyInitialization($site, (string)$indexingConfigurationName);
}
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessIndexQueueInitialization'])) {
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['postProcessIndexQueueInitialization'])) {
return $initializationStatus;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessIndexQueueInitialization'] as $classReference) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['postProcessIndexQueueInitialization'] as $classReference) {
$indexQueueInitializationPostProcessor = GeneralUtility::makeInstance($classReference);
if ($indexQueueInitializationPostProcessor instanceof InitializationPostProcessor) {
$indexQueueInitializationPostProcessor->postProcessIndexQueueInitialization($site, $indexingConfigurationNames, $initializationStatus);
@ -131,10 +131,10 @@ class QueueInitializationService {
// clear queue
$this->queue->deleteItemsBySite($site, $indexingConfigurationName);
$solrConfiguration = $site->getSolrConfiguration();
$tableToIndex = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
$initializerClass = $solrConfiguration->getIndexQueueInitializerClassByConfigurationName($indexingConfigurationName);
$indexConfiguration = $solrConfiguration->getIndexQueueConfigurationByName($indexingConfigurationName);
$meilisearchConfiguration = $site->getMeilisearchConfiguration();
$tableToIndex = $meilisearchConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
$initializerClass = $meilisearchConfiguration->getIndexQueueInitializerClassByConfigurationName($indexingConfigurationName);
$indexConfiguration = $meilisearchConfiguration->getIndexQueueConfigurationByName($indexingConfigurationName);
return $this->executeInitializer($site, $indexingConfigurationName, $initializerClass, $tableToIndex, $indexConfiguration);
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
/***************************************************************
* 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
@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
use WapplerSystems\Meilisearch\IndexQueue\Item;
use WapplerSystems\Meilisearch\Domain\Site\Site;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\System\Records\AbstractRepository;
use Doctrine\DBAL\DBALException;
use TYPO3\CMS\Core\Database\ConnectionPool;
@ -47,18 +47,18 @@ class QueueItemRepository extends AbstractRepository
protected $table = 'tx_meilisearch_indexqueue_item';
/**
* @var SolrLogManager
* @var MeilisearchLogManager
*/
protected $logger;
/**
* QueueItemRepository constructor.
*
* @param SolrLogManager|null $logManager
* @param MeilisearchLogManager|null $logManager
*/
public function __construct(SolrLogManager $logManager = null)
public function __construct(MeilisearchLogManager $logManager = null)
{
$this->logger = $logManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->logger = $logManager ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
}
/**
@ -606,7 +606,7 @@ class QueueItemRepository extends AbstractRepository
*
* @param Site $site TYPO3 site
* @param int $limit Number of items to get from the queue
* @return Item[] Items to index to the given solr server
* @return Item[] Items to index to the given meilisearch server
*/
public function findItemsToIndex(Site $site, int $limit = 50) : array
{
@ -717,11 +717,11 @@ class QueueItemRepository extends AbstractRepository
*/
protected function hookPostProcessFetchRecordsForIndexQueueItem(string $table, array $uids, array &$tableRecords)
{
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessFetchRecordsForIndexQueueItem'])) {
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['postProcessFetchRecordsForIndexQueueItem'])) {
return;
}
$params = ['table' => $table, 'uids' => $uids, 'tableRecords' => &$tableRecords];
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessFetchRecordsForIndexQueueItem'] as $reference) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['postProcessFetchRecordsForIndexQueueItem'] as $reference) {
GeneralUtility::callUserFunction($reference, $params, $this);
}
}
@ -745,7 +745,7 @@ class QueueItemRepository extends AbstractRepository
);
} else {
$this->logger->log(
SolrLogManager::ERROR,
MeilisearchLogManager::ERROR,
'Record missing for Index Queue item. Item removed.',
[
$indexQueueItemRecord

View File

@ -43,21 +43,21 @@ class ConfigurationAwareRecordService
*
* @param string $recordTable Table to read from
* @param int $recordUid Id of the record
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return string|null Name of indexing configuration
*/
public function getIndexingConfigurationName($recordTable, $recordUid, TypoScriptConfiguration $solrConfiguration)
public function getIndexingConfigurationName($recordTable, $recordUid, TypoScriptConfiguration $meilisearchConfiguration)
{
$name = null;
$indexingConfigurations = $solrConfiguration->getEnabledIndexQueueConfigurationNames();
$indexingConfigurations = $meilisearchConfiguration->getEnabledIndexQueueConfigurationNames();
foreach ($indexingConfigurations as $indexingConfigurationName) {
if (!$solrConfiguration->getIndexQueueConfigurationIsEnabled($indexingConfigurationName)) {
if (!$meilisearchConfiguration->getIndexQueueConfigurationIsEnabled($indexingConfigurationName)) {
// ignore disabled indexing configurations
continue;
}
$record = $this->getRecordIfIndexConfigurationIsValid($recordTable, $recordUid,
$indexingConfigurationName, $solrConfiguration);
$indexingConfigurationName, $meilisearchConfiguration);
if (!empty($record)) {
$name = $indexingConfigurationName;
// FIXME currently returns after the first configuration match
@ -74,16 +74,16 @@ class ConfigurationAwareRecordService
*
* @param string $recordTable Table to read from
* @param int $recordUid Id of the record
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return array Record if found, otherwise empty array
*/
public function getRecord($recordTable, $recordUid, TypoScriptConfiguration $solrConfiguration)
public function getRecord($recordTable, $recordUid, TypoScriptConfiguration $meilisearchConfiguration)
{
$record = [];
$indexingConfigurations = $solrConfiguration->getEnabledIndexQueueConfigurationNames();
$indexingConfigurations = $meilisearchConfiguration->getEnabledIndexQueueConfigurationNames();
foreach ($indexingConfigurations as $indexingConfigurationName) {
$record = $this->getRecordIfIndexConfigurationIsValid($recordTable, $recordUid,
$indexingConfigurationName, $solrConfiguration);
$indexingConfigurationName, $meilisearchConfiguration);
if (!empty($record)) {
// if we found a record which matches the conditions, we can continue
break;
@ -99,16 +99,16 @@ class ConfigurationAwareRecordService
* @param string $recordTable
* @param integer $recordUid
* @param string $indexingConfigurationName
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return array
*/
protected function getRecordIfIndexConfigurationIsValid($recordTable, $recordUid, $indexingConfigurationName, TypoScriptConfiguration $solrConfiguration)
protected function getRecordIfIndexConfigurationIsValid($recordTable, $recordUid, $indexingConfigurationName, TypoScriptConfiguration $meilisearchConfiguration)
{
if (!$this->isValidTableForIndexConfigurationName($recordTable, $indexingConfigurationName, $solrConfiguration)) {
if (!$this->isValidTableForIndexConfigurationName($recordTable, $indexingConfigurationName, $meilisearchConfiguration)) {
return [];
}
$recordWhereClause = $solrConfiguration->getIndexQueueAdditionalWhereClauseByConfigurationName($indexingConfigurationName);
$recordWhereClause = $meilisearchConfiguration->getIndexQueueAdditionalWhereClauseByConfigurationName($indexingConfigurationName);
$row = $this->getRecordForIndexConfigurationIsValid($recordTable, $recordUid, $recordWhereClause);
@ -146,12 +146,12 @@ class ConfigurationAwareRecordService
*
* @param string $recordTable
* @param string $indexingConfigurationName
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return boolean
*/
protected function isValidTableForIndexConfigurationName($recordTable, $indexingConfigurationName, TypoScriptConfiguration $solrConfiguration)
protected function isValidTableForIndexConfigurationName($recordTable, $indexingConfigurationName, TypoScriptConfiguration $meilisearchConfiguration)
{
$tableToIndex = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
$tableToIndex = $meilisearchConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
$isMatchingTable = ($tableToIndex === $recordTable);

View File

@ -299,12 +299,12 @@ class RootPageResolver implements SingletonInterface
$allSites = $siteRepository->getAvailableSites();
foreach ($allSites as $site) {
$solrConfiguration = $site->getSolrConfiguration();
$indexingConfigurationName = $this->recordService->getIndexingConfigurationName($table, $uid, $solrConfiguration);
$meilisearchConfiguration = $site->getMeilisearchConfiguration();
$indexingConfigurationName = $this->recordService->getIndexingConfigurationName($table, $uid, $meilisearchConfiguration);
if ($indexingConfigurationName === null) {
continue;
}
$observedPageIdsOfSiteRoot = $solrConfiguration->getIndexQueueAdditionalPageIdsByConfigurationName($indexingConfigurationName);
$observedPageIdsOfSiteRoot = $meilisearchConfiguration->getIndexQueueAdditionalPageIdsByConfigurationName($indexingConfigurationName);
foreach ($observedPageIdsOfSiteRoot as $observedPageIdOfSiteRoot) {
$siteRootByObservedPageIds[$observedPageIdOfSiteRoot][] = $site->getRootPageId();
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue\Statistic;
/***************************************************************
* 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

View File

@ -1,5 +1,5 @@
<?php
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheSolrDocument;
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument;
/***************************************************************
* Copyright notice
@ -28,16 +28,16 @@ use WapplerSystems\Meilisearch\Access\Rootline;
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
use WapplerSystems\Meilisearch\Domain\Variants\IdBuilder;
use WapplerSystems\Meilisearch\Domain\Site\Site;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use WapplerSystems\Meilisearch\Typo3PageContentExtractor;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* Builder class to build an ApacheSolrDocument
* Builder class to build an ApacheMeilisearchDocument
*
* Responsible to build \WapplerSystems\Meilisearch\System\Solr\Document\Document
* Responsible to build \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document
*
* @author Timo Hund <timo.hund@dkd.de>
*/
@ -121,7 +121,7 @@ class Builder
/**
* Creates a Solr document with the basic / core fields set already.
* Creates a Meilisearch document with the basic / core fields set already.
*
* @param array $itemRecord
* @param string $type

View File

@ -1,5 +1,5 @@
<?php
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheSolrDocument;
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument;
/***************************************************************
* Copyright notice
@ -28,12 +28,12 @@ use WapplerSystems\Meilisearch\ConnectionManager;
use WapplerSystems\Meilisearch\Domain\Search\Query\QueryBuilder;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\Parser\DocumentEscapeService;
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
use WapplerSystems\Meilisearch\Search;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Solr\SolrCommunicationException;
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchCommunicationException;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@ -73,13 +73,13 @@ class Repository implements SingletonInterface
*/
public function __construct(DocumentEscapeService $documentEscapeService = null, TypoScriptConfiguration $typoScriptConfiguration = null, QueryBuilder $queryBuilder = null)
{
$this->typoScriptConfiguration = $typoScriptConfiguration ?? Util::getSolrConfiguration();
$this->typoScriptConfiguration = $typoScriptConfiguration ?? Util::getMeilisearchConfiguration();
$this->documentEscapeService = $documentEscapeService ?? GeneralUtility::makeInstance(DocumentEscapeService::class, /** @scrutinizer ignore-type */ $typoScriptConfiguration);
$this->queryBuilder = $queryBuilder ?? GeneralUtility::makeInstance(QueryBuilder::class, /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);
}
/**
* Returns firs found \WapplerSystems\Meilisearch\System\Solr\Document\Document for current page by given language id.
* Returns firs found \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document for current page by given language id.
*
* @param $languageId
* @return Document|false
@ -91,7 +91,7 @@ class Repository implements SingletonInterface
}
/**
* Returns all found \WapplerSystems\Meilisearch\System\Solr\Document\Document[] by given page id and language id.
* Returns all found \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document[] by given page id and language id.
* Returns empty array if nothing found, e.g. if no language or no page(or no index for page) is present.
*
* @param int $pageId
@ -104,9 +104,9 @@ class Repository implements SingletonInterface
$this->initializeSearch($pageId, $languageId);
$pageQuery = $this->queryBuilder->buildPageQuery($pageId);
$response = $this->search->search($pageQuery, 0, 10000);
} catch (NoSolrConnectionFoundException $exception) {
} catch (NoMeilisearchConnectionFoundException $exception) {
return [];
} catch (SolrCommunicationException $exception) {
} catch (MeilisearchCommunicationException $exception) {
return [];
}
$data = $response->getParsedData();
@ -127,9 +127,9 @@ class Repository implements SingletonInterface
$this->initializeSearch($pageId, $languageId);
$recordQuery = $this->queryBuilder->buildRecordQuery($type, $uid, $pageId);
$response = $this->search->search($recordQuery, 0, 10000);
} catch (NoSolrConnectionFoundException $exception) {
} catch (NoMeilisearchConnectionFoundException $exception) {
return [];
} catch (SolrCommunicationException $exception) {
} catch (MeilisearchCommunicationException $exception) {
return [];
}
$data = $response->getParsedData();
@ -152,19 +152,19 @@ class Repository implements SingletonInterface
}
/* @var $connectionManager ConnectionManager */
$connectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
$solrConnection = $connectionManager->getConnectionByPageId($pageId, $languageId);
$meilisearchConnection = $connectionManager->getConnectionByPageId($pageId, $languageId);
$this->search = $this->getSearch($solrConnection);
$this->search = $this->getSearch($meilisearchConnection);
}
/**
* Retrieves an instance of the Search object.
*
* @param SolrConnection $solrConnection
* @param MeilisearchConnection $meilisearchConnection
* @return Search
*/
protected function getSearch($solrConnection)
protected function getSearch($meilisearchConnection)
{
return GeneralUtility::makeInstance(Search::class, /** @scrutinizer ignore-type */ $solrConnection);
return GeneralUtility::makeInstance(Search::class, /** @scrutinizer ignore-type */ $meilisearchConnection);
}
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\LastSearches;
/***************************************************************
* 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

View File

@ -44,7 +44,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* The AbstractQueryBuilder contains all logic to initialize solr queries independent from TYPO3.
* The AbstractQueryBuilder contains all logic to initialize meilisearch queries independent from TYPO3.
*/
abstract class AbstractQueryBuilder {
@ -340,7 +340,7 @@ abstract class AbstractQueryBuilder {
}
/**
* Can be used to use a specific filter string in the solr query.
* Can be used to use a specific filter string in the meilisearch query.
*
* @param string $filterString
* @param string $filterName

View File

@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query;
use Solarium\QueryType\Extract\Query as SolariumExtractQuery;
/**
* Specialized query for content extraction using Solr Cell
* Specialized query for content extraction using Meilisearch Cell
*
*/
class ExtractingQuery extends SolariumExtractQuery

View File

@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\Helper;
***************************************************************/
/**
* The EscpaeService is responsible to escape the querystring as expected for Apache Solr.
* The EscpaeService is responsible to escape the querystring as expected for Meilisearch.
*
* This class should have no dependencies since it only contains static functions
*

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
/***************************************************************
* 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
@ -37,7 +37,7 @@ abstract class AbstractFieldList extends AbstractDeactivatable
protected $fieldList = [];
/**
* Parameter key which should be used for Apache Solr URL query
* Parameter key which should be used for Meilisearch URL query
*
* @var string
*/

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
/***************************************************************
* 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
@ -33,7 +33,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
class BigramPhraseFields extends AbstractFieldList implements ParameterBuilder
{
/**
* Parameter key which should be used for Apache Solr URL query
* Parameter key which should be used for Meilisearch URL query
*
* @var string
*/
@ -52,17 +52,17 @@ class BigramPhraseFields extends AbstractFieldList implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return BigramPhraseFields
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getBigramPhraseSearchIsEnabled();
$isEnabled = $meilisearchConfiguration->getBigramPhraseSearchIsEnabled();
if (!$isEnabled) {
return new BigramPhraseFields(false);
}
return self::fromString((string)$solrConfiguration->getSearchQueryBigramPhraseFields());
return self::fromString((string)$meilisearchConfiguration->getSearchQueryBigramPhraseFields());
}
/**

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
/**
* The Elevation ParameterProvider is responsible to build the solr query parameters
* The Elevation ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the elevation.
*/
class Elevation extends AbstractDeactivatable implements ParameterBuilder
@ -89,18 +89,18 @@ class Elevation extends AbstractDeactivatable implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Elevation
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getSearchElevation();
$isEnabled = $meilisearchConfiguration->getSearchElevation();
if (!$isEnabled) {
return new Elevation(false);
}
$force = $solrConfiguration->getSearchElevationForceElevation();
$markResults = $solrConfiguration->getSearchElevationMarkElevatedResults();
$force = $meilisearchConfiguration->getSearchElevationForceElevation();
$markResults = $meilisearchConfiguration->getSearchElevationMarkElevatedResults();
return new Elevation(true, $force, $markResults);
}

View File

@ -30,7 +30,7 @@ use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\SortingExpression;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
/**
* The Faceting ParameterProvider is responsible to build the solr query parameters
* The Faceting ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the highlighting.
*/
class Faceting extends AbstractDeactivatable implements ParameterBuilder
@ -196,19 +196,19 @@ class Faceting extends AbstractDeactivatable implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Faceting
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getSearchFaceting();
$isEnabled = $meilisearchConfiguration->getSearchFaceting();
if (!$isEnabled) {
return new Faceting(false);
}
$minCount = $solrConfiguration->getSearchFacetingMinimumCount();
$limit = $solrConfiguration->getSearchFacetingFacetLimit();
$sorting = $solrConfiguration->getSearchFacetingSortBy();
$minCount = $meilisearchConfiguration->getSearchFacetingMinimumCount();
$limit = $meilisearchConfiguration->getSearchFacetingFacetLimit();
$sorting = $meilisearchConfiguration->getSearchFacetingSortBy();
return new Faceting($isEnabled, $sorting, $minCount, $limit);
}

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
/**
* The FieldCollapsing ParameterProvider is responsible to build the solr query parameters
* The FieldCollapsing ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the field collapsing.
*/
class FieldCollapsing extends AbstractDeactivatable implements ParameterBuilder
@ -112,19 +112,19 @@ class FieldCollapsing extends AbstractDeactivatable implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return FieldCollapsing
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getSearchVariants();
$isEnabled = $meilisearchConfiguration->getSearchVariants();
if (!$isEnabled) {
return new FieldCollapsing(false);
}
$collapseField = $solrConfiguration->getSearchVariantsField();
$expand = (bool)$solrConfiguration->getSearchVariantsExpand();
$expandRows = $solrConfiguration->getSearchVariantsLimit();
$collapseField = $meilisearchConfiguration->getSearchVariantsField();
$expand = (bool)$meilisearchConfiguration->getSearchVariantsExpand();
$expandRows = $meilisearchConfiguration->getSearchVariantsLimit();
return new FieldCollapsing(true, $collapseField, $expand, $expandRows);
}

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The Filters ParameterProvider is responsible to build the solr query parameters
* The Filters ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the filtering.
*/
class Filters
@ -140,10 +140,10 @@ class Filters
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Filters
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
return new Filters();
}

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
/**
* The Grouping ParameterProvider is responsible to build the solr query parameters
* The Grouping ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the grouping.
*/
class Grouping extends AbstractDeactivatable implements ParameterBuilder
@ -185,12 +185,12 @@ class Grouping extends AbstractDeactivatable implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Grouping
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getSearchGrouping();
$isEnabled = $meilisearchConfiguration->getSearchGrouping();
if (!$isEnabled) {
return new Grouping(false);
}
@ -199,10 +199,10 @@ class Grouping extends AbstractDeactivatable implements ParameterBuilder
$queries = [];
$sortings = [];
$resultsPerGroup = $solrConfiguration->getSearchGroupingHighestGroupResultsLimit();
$configuredGroups = $solrConfiguration->getSearchGroupingGroupsConfiguration();
$numberOfGroups = $solrConfiguration->getSearchGroupingNumberOfGroups();
$sortBy = $solrConfiguration->getSearchGroupingSortBy();
$resultsPerGroup = $meilisearchConfiguration->getSearchGroupingHighestGroupResultsLimit();
$configuredGroups = $meilisearchConfiguration->getSearchGroupingGroupsConfiguration();
$numberOfGroups = $meilisearchConfiguration->getSearchGroupingNumberOfGroups();
$sortBy = $meilisearchConfiguration->getSearchGroupingSortBy();
foreach ($configuredGroups as $groupName => $groupConfiguration) {
if (isset($groupConfiguration['field'])) {

View File

@ -30,7 +30,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The Highlighting ParameterProvider is responsible to build the solr query parameters
* The Highlighting ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the highlighting.
*/
class Highlighting extends AbstractDeactivatable implements ParameterBuilder
@ -147,19 +147,19 @@ class Highlighting extends AbstractDeactivatable implements ParameterBuilder
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Highlighting
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getSearchResultsHighlighting();
$isEnabled = $meilisearchConfiguration->getSearchResultsHighlighting();
if (!$isEnabled) {
return new Highlighting(false);
}
$fragmentSize = $solrConfiguration->getSearchResultsHighlightingFragmentSize();
$highlightingFields = $solrConfiguration->getSearchResultsHighlightingFields();
$wrap = explode('|', $solrConfiguration->getSearchResultsHighlightingWrap());
$fragmentSize = $meilisearchConfiguration->getSearchResultsHighlightingFragmentSize();
$highlightingFields = $meilisearchConfiguration->getSearchResultsHighlightingFields();
$wrap = explode('|', $meilisearchConfiguration->getSearchResultsHighlightingWrap());
$prefix = isset($wrap[0]) ? $wrap[0] : '';
$postfix = isset($wrap[1]) ? $wrap[1] : '';

View File

@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
/**
* The Operator ParameterProvider is responsible to build the solr query parameters
* The Operator ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the operator q.op.
*/
class Operator extends AbstractDeactivatable

View File

@ -29,7 +29,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
/**
* The implementation of ParameterBuilder is responsible to build an array with
* the query parameter that are needed for solr
* the query parameter that are needed for meilisearch
*
* Interface ParameterProvider
*/

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
/***************************************************************
* 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
@ -33,7 +33,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
class PhraseFields extends AbstractFieldList implements ParameterBuilder
{
/**
* Parameter key which should be used for Apache Solr URL query
* Parameter key which should be used for Meilisearch URL query
*
* @var string
*/
@ -52,17 +52,17 @@ class PhraseFields extends AbstractFieldList implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return PhraseFields
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getPhraseSearchIsEnabled();
$isEnabled = $meilisearchConfiguration->getPhraseSearchIsEnabled();
if (!$isEnabled) {
return new PhraseFields(false);
}
return self::fromString((string)$solrConfiguration->getSearchQueryPhraseFields());
return self::fromString((string)$meilisearchConfiguration->getSearchQueryPhraseFields());
}
/**

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The QueryFields class holds all information for the query which fields should be used to query (Solr qf parameter).
* The QueryFields class holds all information for the query which fields should be used to query (Meilisearch qf parameter).
*/
class QueryFields implements ParameterBuilder
{

View File

@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The ReturnFields class is responsible to hold a list of field names that should be returned from
* solr.
* meilisearch.
*/
class ReturnFields implements ParameterBuilder
{

View File

@ -29,7 +29,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
/**
* The Slops ParameterProvider is responsible to build the solr query parameters
* The Slops ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the several slop arguments.
*/
class Slops implements ParameterBuilder
@ -171,12 +171,12 @@ class Slops implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Slops
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$searchConfiguration = $solrConfiguration->getSearchConfiguration();
$searchConfiguration = $meilisearchConfiguration->getSearchConfiguration();
$querySlop = static::getQuerySlopFromConfiguration($searchConfiguration);
$phraseSlop = static::getPhraseSlopFromConfiguration($searchConfiguration);
$bigramPhraseSlop = static::getBigramPhraseSlopFromConfiguration($searchConfiguration);

View File

@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The Sorting ParameterProvider is responsible to build the solr query parameters
* The Sorting ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the sorting.
*/
class Sorting extends AbstractDeactivatable

View File

@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The Sorting ParameterProvider is responsible to build the solr query parameters
* The Sorting ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the sorting.
*/
class Sortings extends AbstractDeactivatable

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
/**
* The Spellchecking ParameterProvider is responsible to build the solr query parameters
* The Spellchecking ParameterProvider is responsible to build the meilisearch query parameters
* that are needed for the spellchecking.
*/
class Spellchecking extends AbstractDeactivatable implements ParameterBuilder
@ -60,17 +60,17 @@ class Spellchecking extends AbstractDeactivatable implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return Spellchecking
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getSearchSpellchecking();
$isEnabled = $meilisearchConfiguration->getSearchSpellchecking();
if (!$isEnabled) {
return new Spellchecking(false);
}
$maxCollationTries = $solrConfiguration->getSearchSpellcheckingNumberOfSuggestionsToTry();
$maxCollationTries = $meilisearchConfiguration->getSearchSpellcheckingNumberOfSuggestionsToTry();
return new Spellchecking($isEnabled, $maxCollationTries);
}

View File

@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
/***************************************************************
* 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
@ -33,7 +33,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
class TrigramPhraseFields extends AbstractFieldList implements ParameterBuilder
{
/**
* Parameter key which should be used for Apache Solr URL query
* Parameter key which should be used for Meilisearch URL query
*
* @var string
*/
@ -52,17 +52,17 @@ class TrigramPhraseFields extends AbstractFieldList implements ParameterBuilder
}
/**
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
* @return TrigramPhraseFields
*/
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
{
$isEnabled = $solrConfiguration->getTrigramPhraseSearchIsEnabled();
$isEnabled = $meilisearchConfiguration->getTrigramPhraseSearchIsEnabled();
if (!$isEnabled) {
return new TrigramPhraseFields(false);
}
return self::fromString((string)$solrConfiguration->getSearchQueryTrigramPhraseFields());
return self::fromString((string)$meilisearchConfiguration->getSearchQueryTrigramPhraseFields());
}
/**

View File

@ -43,13 +43,13 @@ use WapplerSystems\Meilisearch\Domain\Site\SiteHashService;
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
use WapplerSystems\Meilisearch\FieldProcessor\PageUidToHierarchy;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* The concrete QueryBuilder contains all TYPO3 specific initialization logic of solr queries, for TYPO3.
* The concrete QueryBuilder contains all TYPO3 specific initialization logic of meilisearch queries, for TYPO3.
*/
class QueryBuilder extends AbstractQueryBuilder {
@ -67,7 +67,7 @@ class QueryBuilder extends AbstractQueryBuilder {
protected $typoScriptConfiguration = null;
/**
* @var SolrLogManager;
* @var MeilisearchLogManager;
*/
protected $logger = null;
@ -79,13 +79,13 @@ class QueryBuilder extends AbstractQueryBuilder {
/**
* QueryBuilder constructor.
* @param TypoScriptConfiguration|null $configuration
* @param SolrLogManager|null $solrLogManager
* @param MeilisearchLogManager|null $meilisearchLogManager
* @param SiteHashService|null $siteHashService
*/
public function __construct(TypoScriptConfiguration $configuration = null, SolrLogManager $solrLogManager = null, SiteHashService $siteHashService = null)
public function __construct(TypoScriptConfiguration $configuration = null, MeilisearchLogManager $meilisearchLogManager = null, SiteHashService $siteHashService = null)
{
$this->typoScriptConfiguration = $configuration ?? Util::getSolrConfiguration();
$this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->typoScriptConfiguration = $configuration ?? Util::getMeilisearchConfiguration();
$this->logger = $meilisearchLogManager ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->siteHashService = $siteHashService ?? GeneralUtility::makeInstance(SiteHashService::class);
}
@ -121,7 +121,7 @@ class QueryBuilder extends AbstractQueryBuilder {
public function buildSearchQuery($rawQuery, $resultsPerPage = 10, array $additionalFiltersFromRequest = []) : SearchQuery
{
if ($this->typoScriptConfiguration->getLoggingQuerySearchWords()) {
$this->logger->log(SolrLogManager::INFO, 'Received search query', [$rawQuery]);
$this->logger->log(MeilisearchLogManager::INFO, 'Received search query', [$rawQuery]);
}
/* @var $query SearchQuery */
@ -170,7 +170,7 @@ class QueryBuilder extends AbstractQueryBuilder {
/**
* Returns Query for Search which finds document for given page.
* Note: The Connection is per language as recommended in ext-solr docs.
* Note: The Connection is per language as recommended in ext-meilisearch docs.
*
* @return Query
*/
@ -361,7 +361,7 @@ class QueryBuilder extends AbstractQueryBuilder {
}
/**
* Applies the configured initial query settings to set the alternative query for solr as required.
* Applies the configured initial query settings to set the alternative query for meilisearch as required.
*
* @return QueryBuilder
*/

View File

@ -50,17 +50,17 @@ class SuggestQuery extends Query
* SuggestQuery constructor.
*
* @param string $keywords
* @param TypoScriptConfiguration $solrConfiguration
* @param TypoScriptConfiguration $meilisearchConfiguration
*/
public function __construct($keywords, $solrConfiguration = null)
public function __construct($keywords, $meilisearchConfiguration = null)
{
parent::__construct();
$keywords = (string)$keywords;
$solrConfiguration = $solrConfiguration ?? Util::getSolrConfiguration();
$meilisearchConfiguration = $meilisearchConfiguration ?? Util::getMeilisearchConfiguration();
$this->setQuery($keywords);
$this->configuration = $solrConfiguration->getObjectByPathOrDefault('plugin.tx_meilisearch.suggest.', []);
$this->configuration = $meilisearchConfiguration->getObjectByPathOrDefault('plugin.tx_meilisearch.suggest.', []);
if (!empty($this->configuration['treatMultipleTermsAsSingleTerm'])) {
$this->prefix = EscapeService::escape($keywords);

View File

@ -117,7 +117,7 @@ abstract class AbstractFacet
}
/**
* Get solr field name
* Get meilisearch field name
*
* @return string
*/

View File

@ -118,13 +118,13 @@ abstract class AbstractFacetParser implements FacetParserInterface
/**
* @param array $facetValuesFromSolrResponse
* @param array $facetValuesFromMeilisearchResponse
* @param array $facetValuesFromSearchRequest
* @return mixed
*/
protected function getMergedFacetValueFromSearchRequestAndSolrResponse($facetValuesFromSolrResponse, $facetValuesFromSearchRequest)
protected function getMergedFacetValueFromSearchRequestAndMeilisearchResponse($facetValuesFromMeilisearchResponse, $facetValuesFromSearchRequest)
{
$facetValueItemsToCreate = $facetValuesFromSolrResponse;
$facetValueItemsToCreate = $facetValuesFromMeilisearchResponse;
foreach ($facetValuesFromSearchRequest as $valueFromRequest) {
// if we have options in the request that have not been in the response we add them with a count of 0

View File

@ -16,7 +16,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\OptionBased\
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\AbstractFacetParser;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
use WapplerSystems\Meilisearch\System\Solr\ParsingUtil;
use WapplerSystems\Meilisearch\System\Meilisearch\ParsingUtil;
/**
* Class HierarchyFacetParser
@ -34,9 +34,9 @@ class HierarchyFacetParser extends AbstractFacetParser
$response = $resultSet->getResponse();
$fieldName = $facetConfiguration['field'];
$label = $this->getPlainLabelOrApplyCObject($facetConfiguration);
$optionsFromSolrResponse = isset($response->facet_counts->facet_fields->{$fieldName}) ? ParsingUtil::getMapArrayFromFlatArray($response->facet_counts->facet_fields->{$fieldName}) : [];
$optionsFromMeilisearchResponse = isset($response->facet_counts->facet_fields->{$fieldName}) ? ParsingUtil::getMapArrayFromFlatArray($response->facet_counts->facet_fields->{$fieldName}) : [];
$optionsFromRequest = $this->getActiveFacetValuesFromRequest($resultSet, $facetName);
$hasOptionsInResponse = !empty($optionsFromSolrResponse);
$hasOptionsInResponse = !empty($optionsFromMeilisearchResponse);
$hasSelectedOptionsInRequest = count($optionsFromRequest) > 0;
$hasNoOptionsToShow = !$hasOptionsInResponse && !$hasSelectedOptionsInRequest;
$hideEmpty = !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingShowEmptyFacetsByName($facetName);
@ -53,7 +53,7 @@ class HierarchyFacetParser extends AbstractFacetParser
$facet->setIsAvailable($hasOptionsInResponse);
$nodesToCreate = $this->getMergedFacetValueFromSearchRequestAndSolrResponse($optionsFromSolrResponse, $optionsFromRequest);
$nodesToCreate = $this->getMergedFacetValueFromSearchRequestAndMeilisearchResponse($optionsFromMeilisearchResponse, $optionsFromRequest);
if ($this->facetOptionsMustBeResorted($facetConfiguration)) {
$nodesToCreate = $this->sortFacetOptionsInNaturalOrder($nodesToCreate);
@ -96,13 +96,13 @@ class HierarchyFacetParser extends AbstractFacetParser
/**
* Checks if options must be resorted.
*
* Apache Solr facet.sort can be set globally or per facet.
* Meilisearch facet.sort can be set globally or per facet.
* Relevant TypoScript paths:
* plugin.tx_meilisearch.search.faceting.sortBy causes facet.sort Apache Solr parameter
* plugin.tx_meilisearch.search.faceting.sortBy causes facet.sort Meilisearch parameter
* plugin.tx_meilisearch.search.faceting.facets.[facetName].sortBy causes f.<fieldname>.facet.sort parameter
*
* see: https://lucene.apache.org/solr/guide/6_6/faceting.html#Faceting-Thefacet.sortParameter
* see: https://wiki.apache.org/solr/SimpleFacetParameters#facet.sort : "This parameter can be specified on a per field basis."
* see: https://lucene.apache.org/meilisearch/guide/6_6/faceting.html#Faceting-Thefacet.sortParameter
* see: https://wiki.apache.org/meilisearch/SimpleFacetParameters#facet.sort : "This parameter can be specified on a per field basis."
*
* @param array $facetConfiguration
* @return bool

View File

@ -29,7 +29,7 @@ class HierarchyTool
}
/**
* Replaces @@@slash@@@ with \/ to have the path usable for solr again.
* Replaces @@@slash@@@ with \/ to have the path usable for meilisearch again.
*
* @param string $pathWithReplacedContentSlashes
* @return string

View File

@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\OptionBased\
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\FacetUrlDecoderInterface;
/**
* Filter encoder to build Solr hierarchy queries from tx_meilisearch[filter]
* Filter encoder to build Meilisearch hierarchy queries from tx_meilisearch[filter]
*
* @author Ingo Renner <ingo@typo3.org>
*/
@ -42,11 +42,11 @@ class HierarchyUrlDecoder implements FacetUrlDecoderInterface
const DELIMITER = '/';
/**
* Parses the given hierarchy filter and returns a Solr filter query.
* Parses the given hierarchy filter and returns a Meilisearch filter query.
*
* @param string $hierarchy The hierarchy filter query.
* @param array $configuration Facet configuration
* @return string Lucene query language filter to be used for querying Solr
* @return string Lucene query language filter to be used for querying Meilisearch
*/
public function decode($hierarchy, array $configuration = [])
{

View File

@ -16,7 +16,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\OptionBased\
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\AbstractFacetParser;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
@ -49,10 +49,10 @@ class OptionsFacetParser extends AbstractFacetParser
$response = $resultSet->getResponse();
$fieldName = $facetConfiguration['field'];
$label = $this->getPlainLabelOrApplyCObject($facetConfiguration);
$optionsFromSolrResponse = $this->getOptionsFromSolrResponse($facetName, $response);
$metricsFromSolrResponse = $this->getMetricsFromSolrResponse($facetName, $response);
$optionsFromMeilisearchResponse = $this->getOptionsFromMeilisearchResponse($facetName, $response);
$metricsFromMeilisearchResponse = $this->getMetricsFromMeilisearchResponse($facetName, $response);
$optionsFromRequest = $this->getActiveFacetValuesFromRequest($resultSet, $facetName);
$hasOptionsInResponse = !empty($optionsFromSolrResponse);
$hasOptionsInResponse = !empty($optionsFromMeilisearchResponse);
$hasSelectedOptionsInRequest = count($optionsFromRequest) > 0;
$hasNoOptionsToShow = !$hasOptionsInResponse && !$hasSelectedOptionsInRequest;
$hideEmpty = !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingShowEmptyFacetsByName($facetName);
@ -75,7 +75,7 @@ class OptionsFacetParser extends AbstractFacetParser
$facet->setIsUsed($hasActiveOptions);
$facet->setIsAvailable($hasOptionsInResponse);
$optionsToCreate = $this->getMergedFacetValueFromSearchRequestAndSolrResponse($optionsFromSolrResponse, $optionsFromRequest);
$optionsToCreate = $this->getMergedFacetValueFromSearchRequestAndMeilisearchResponse($optionsFromMeilisearchResponse, $optionsFromRequest);
foreach ($optionsToCreate as $optionsValue => $count) {
if ($this->getIsExcludedFacetValue($optionsValue, $facetConfiguration)) {
continue;
@ -83,11 +83,11 @@ class OptionsFacetParser extends AbstractFacetParser
$isOptionsActive = in_array($optionsValue, $optionsFromRequest);
$label = $this->getLabelFromRenderingInstructions($optionsValue, $count, $facetName, $facetConfiguration);
$facet->addOption($this->objectManager->get(Option::class, $facet, $label, $optionsValue, $count, $isOptionsActive, $metricsFromSolrResponse[$optionsValue]));
$facet->addOption($this->objectManager->get(Option::class, $facet, $label, $optionsValue, $count, $isOptionsActive, $metricsFromMeilisearchResponse[$optionsValue]));
}
// after all options have been created we apply a manualSortOrder if configured
// the sortBy (lex,..) is done by the solr server and triggered by the query, therefore it does not
// the sortBy (lex,..) is done by the meilisearch server and triggered by the query, therefore it does not
// need to be handled in the frontend.
$this->applyManualSortOrder($facet, $facetConfiguration);
$this->applyReverseOrder($facet, $facetConfiguration);
@ -104,20 +104,20 @@ class OptionsFacetParser extends AbstractFacetParser
* @param ResponseAdapter $response
* @return array
*/
protected function getOptionsFromSolrResponse($facetName, ResponseAdapter $response)
protected function getOptionsFromMeilisearchResponse($facetName, ResponseAdapter $response)
{
$optionsFromSolrResponse = [];
$optionsFromMeilisearchResponse = [];
if (!isset($response->facets->{$facetName})) {
return $optionsFromSolrResponse;
return $optionsFromMeilisearchResponse;
}
foreach ($response->facets->{$facetName}->buckets as $bucket) {
$optionValue = $bucket->val;
$optionCount = $bucket->count;
$optionsFromSolrResponse[$optionValue] = $optionCount;
$optionsFromMeilisearchResponse[$optionValue] = $optionCount;
}
return $optionsFromSolrResponse;
return $optionsFromMeilisearchResponse;
}
/**
@ -125,9 +125,9 @@ class OptionsFacetParser extends AbstractFacetParser
* @param ResponseAdapter $response
* @return array
*/
protected function getMetricsFromSolrResponse($facetName, ResponseAdapter $response)
protected function getMetricsFromMeilisearchResponse($facetName, ResponseAdapter $response)
{
$metricsFromSolrResponse = [];
$metricsFromMeilisearchResponse = [];
if (!isset($response->facets->{$facetName}->buckets)) {
return [];
@ -138,11 +138,11 @@ class OptionsFacetParser extends AbstractFacetParser
foreach ($bucketVariables as $key => $value) {
if (strpos($key, 'metrics_') === 0) {
$metricsKey = str_replace('metrics_', '', $key);
$metricsFromSolrResponse[$bucket->val][$metricsKey] = $value;
$metricsFromMeilisearchResponse[$bucket->val][$metricsKey] = $value;
}
}
}
return $metricsFromSolrResponse;
return $metricsFromMeilisearchResponse;
}
}

View File

@ -16,7 +16,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\OptionBased\
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\AbstractFacetParser;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
/**
* Class QueryGroupFacetParser
@ -86,7 +86,7 @@ class QueryGroupFacetParser extends AbstractFacetParser
// after all options have been created we apply a manualSortOrder if configured
// the sortBy (lex,..) is done by the solr server and triggered by the query, therefore it does not
// the sortBy (lex,..) is done by the meilisearch server and triggered by the query, therefore it does not
// need to be handled in the frontend.
$this->applyManualSortOrder($facet, $facetConfiguration);
$this->applyReverseOrder($facet, $facetConfiguration);
@ -112,7 +112,7 @@ class QueryGroupFacetParser extends AbstractFacetParser
// todo: add test cases to check if this is needed https://forge.typo3.org/issues/45440
// remove tags from the facet.query response, for facet.field
// and facet.range Solr does that on its own automatically
// and facet.range Meilisearch does that on its own automatically
$rawValue = preg_replace('/^\{!ex=[^\}]*\}(.*)/', '\\1', $rawValue);
list($field, $query) = explode(':', $rawValue, 2);

View File

@ -16,7 +16,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\RangeBased;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\AbstractFacetParser;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
use WapplerSystems\Meilisearch\System\Solr\ParsingUtil;
use WapplerSystems\Meilisearch\System\Meilisearch\ParsingUtil;
/**
* Class AbstractRangeFacetParser

View File

@ -103,7 +103,7 @@ class DateRange extends AbstractRangeFacetItem
}
/**
* Retrieves the end date that was received from solr for this facet.
* Retrieves the end date that was received from meilisearch for this facet.
*
* @return \DateTime
*/
@ -113,7 +113,7 @@ class DateRange extends AbstractRangeFacetItem
}
/**
* Retrieves the start date that was received from solr for this facet.
* Retrieves the start date that was received from meilisearch for this facet.
*
* @return \DateTime
*/

View File

@ -30,7 +30,7 @@ use WapplerSystems\Meilisearch\System\DateTime\FormatService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Parser to build solr range queries from tx_meilisearch[filter]
* Parser to build meilisearch range queries from tx_meilisearch[filter]
*
* @author Markus Goldbach <markus.goldbach@dkd.de>
*/
@ -45,12 +45,12 @@ class DateRangeUrlDecoder implements FacetUrlDecoderInterface
const DELIMITER = '-';
/**
* Parses the given date range from a GET parameter and returns a Solr
* Parses the given date range from a GET parameter and returns a Meilisearch
* date range filter.
*
* @param string $dateRange The range filter query string from the query URL
* @param array $configuration Facet configuration
* @return string Lucene query language filter to be used for querying Solr
* @return string Lucene query language filter to be used for querying Meilisearch
*/
public function decode($dateRange, array $configuration = [])
{

View File

@ -102,7 +102,7 @@ class NumericRange extends AbstractRangeFacetItem
}
/**
* Retrieves the end date that was received from solr for this facet.
* Retrieves the end date that was received from meilisearch for this facet.
*
* @return float
*/
@ -112,7 +112,7 @@ class NumericRange extends AbstractRangeFacetItem
}
/**
* Retrieves the start date that was received from solr for this facet.
* Retrieves the start date that was received from meilisearch for this facet.
*
* @return float
*/

View File

@ -29,7 +29,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\RangeBased\N
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\FacetUrlDecoderInterface;
/**
* Parser to build Solr range queries from tx_meilisearch[filter]
* Parser to build Meilisearch range queries from tx_meilisearch[filter]
*
* @author Markus Goldbach <markus.goldbach@dkd.de>
* @author Ingo Renner <ingo@typo3.org>
@ -46,12 +46,12 @@ class NumericRangeUrlDecoder implements FacetUrlDecoderInterface
const DELIMITER = '-';
/**
* Parses the given range from a GET parameter and returns a Solr range
* Parses the given range from a GET parameter and returns a Meilisearch range
* filter.
*
* @param string $range The range filter from the URL.
* @param array $configuration Facet configuration
* @return string Lucene query language filter to be used for querying Solr
* @return string Lucene query language filter to be used for querying Meilisearch
* @throws \InvalidArgumentException
*/
public function decode($range, array $configuration = [])

View File

@ -32,7 +32,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* A ResultParser is responsible to create the result object structure from the \Apache_Solr_Response
* A ResultParser is responsible to create the result object structure from the \Apache_Meilisearch_Response
* and assign it to the SearchResultSet.
*/
abstract class AbstractResultParser {

View File

@ -62,7 +62,7 @@ class DefaultResultParser extends AbstractResultParser {
}
foreach ($documents as $searchResult) {
$searchResultObject = $this->searchResultBuilder->fromApacheSolrDocument($searchResult);
$searchResultObject = $this->searchResultBuilder->fromApacheMeilisearchDocument($searchResult);
$searchResults[] = $searchResultObject;
}

View File

@ -26,11 +26,11 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\Parser;
***************************************************************/
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use WapplerSystems\Meilisearch\Util;
/**
* Applies htmlspecialschars on documents of a solr response.
* Applies htmlspecialschars on documents of a meilisearch response.
*/
class DocumentEscapeService {
@ -44,7 +44,7 @@ class DocumentEscapeService {
* @param TypoScriptConfiguration|null $typoScriptConfiguration
*/
public function __construct(TypoScriptConfiguration $typoScriptConfiguration = null) {
$this->typoScriptConfiguration = $typoScriptConfiguration ?? Util::getSolrConfiguration();
$this->typoScriptConfiguration = $typoScriptConfiguration ?? Util::getMeilisearchConfiguration();
}
/**
@ -56,13 +56,13 @@ class DocumentEscapeService {
*/
public function applyHtmlSpecialCharsOnAllFields(array $documents)
{
$trustedSolrFields = $this->typoScriptConfiguration->getSearchTrustedFieldsArray();
$trustedMeilisearchFields = $this->typoScriptConfiguration->getSearchTrustedFieldsArray();
foreach ($documents as $key => $document) {
$fieldNames = array_keys($document->getFields() ?? []);
foreach ($fieldNames as $fieldName) {
if (is_array($trustedSolrFields) && in_array($fieldName, $trustedSolrFields)) {
if (is_array($trustedMeilisearchFields) && in_array($fieldName, $trustedMeilisearchFields)) {
// we skip this field, since it was marked as secure
continue;
}

View File

@ -26,10 +26,10 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result;
***************************************************************/
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Grouping\GroupItem;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
/**
* Solr document class that should be used in the frontend in the search context.
* Meilisearch document class that should be used in the frontend in the search context.
*
* @author Timo Schmidt <timo.schmidt@dkd.de>
*/
@ -38,7 +38,7 @@ class SearchResult extends Document
/**
* The variant field value
*
* Value of Solr collapse field, which is defined via
* Value of Meilisearch collapse field, which is defined via
* TypoScript variable "variants.variantField"
*
* @var string

View File

@ -25,24 +25,24 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result;
* 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;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* The SearchResultBuilder is responsible to build a SearchResult object from an \WapplerSystems\Meilisearch\System\Solr\Document\Document
* The SearchResultBuilder is responsible to build a SearchResult object from an \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document
* and should use a different class as SearchResult if configured.
*/
class SearchResultBuilder {
/**
* This method is used to wrap the original solr document instance in an instance of the configured SearchResult
* This method is used to wrap the original meilisearch document instance in an instance of the configured SearchResult
* class.
*
* @param Document $originalDocument
* @throws \InvalidArgumentException
* @return SearchResult
*/
public function fromApacheSolrDocument(Document $originalDocument)
public function fromApacheMeilisearchDocument(Document $originalDocument)
{
$searchResultClassName = $this->getResultClassName();
@ -60,7 +60,7 @@ class SearchResultBuilder {
*/
protected function getResultClassName()
{
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName ']) ?
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName '] : SearchResult::class;
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultClassName ']) ?
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultClassName '] : SearchResult::class;
}
}

View File

@ -25,7 +25,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* This processor is used to transform the solr response into a
* This processor is used to transform the meilisearch response into a
* domain object hierarchy that can be used in the application (controller and view).
*
* @author Frans Saris <frans@beech.it>
@ -83,7 +83,7 @@ class ResultSetReconstitutionProcessor implements SearchResultSetProcessor
$resultSet = $this->parseSpellCheckingResponseIntoObjects($resultSet);
$resultSet = $this->parseSortingIntoObjects($resultSet);
// here we can reconstitute other domain objects from the solr response
// here we can reconstitute other domain objects from the meilisearch response
$resultSet = $this->parseFacetsIntoObjects($resultSet);
return $resultSet;

View File

@ -35,10 +35,10 @@ use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Sorting\SortingCollection
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Spellchecking\Suggestion;
use WapplerSystems\Meilisearch\Domain\Search\SearchRequest;
use WapplerSystems\Meilisearch\Search;
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
/**
* The SearchResultSet is used to provided access to the \Apache_Solr_Response and
* The SearchResultSet is used to provided access to the \Apache_Meilisearch_Response and
* other relevant information, like the used Query and Request objects.
*
* @author Timo Schmidt <timo.schmidt@dkd.de>

View File

@ -41,10 +41,10 @@ use WapplerSystems\Meilisearch\Search\QueryAware;
use WapplerSystems\Meilisearch\Search\SearchAware;
use WapplerSystems\Meilisearch\Search\SearchComponentManager;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Solr\SolrIncompleteResponseException;
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchIncompleteResponseException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\SearchResultBuilder;
use TYPO3\CMS\Extbase\Object\ObjectManager;
@ -79,7 +79,7 @@ class SearchResultSetService
/**
* @var boolean
*/
protected $isSolrAvailable = false;
protected $isMeilisearchAvailable = false;
/**
* @var TypoScriptConfiguration
@ -87,7 +87,7 @@ class SearchResultSetService
protected $typoScriptConfiguration;
/**
* @var SolrLogManager
* @var MeilisearchLogManager
*/
protected $logger = null;
@ -109,17 +109,17 @@ class SearchResultSetService
/**
* @param TypoScriptConfiguration $configuration
* @param Search $search
* @param SolrLogManager $solrLogManager
* @param MeilisearchLogManager $meilisearchLogManager
* @param SearchResultBuilder $resultBuilder
* @param QueryBuilder $queryBuilder
*/
public function __construct(TypoScriptConfiguration $configuration, Search $search, SolrLogManager $solrLogManager = null, SearchResultBuilder $resultBuilder = null, QueryBuilder $queryBuilder = null)
public function __construct(TypoScriptConfiguration $configuration, Search $search, MeilisearchLogManager $meilisearchLogManager = null, SearchResultBuilder $resultBuilder = null, QueryBuilder $queryBuilder = null)
{
$this->search = $search;
$this->typoScriptConfiguration = $configuration;
$this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->logger = $meilisearchLogManager ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
$this->searchResultBuilder = $resultBuilder ?? GeneralUtility::makeInstance(SearchResultBuilder::class);
$this->queryBuilder = $queryBuilder ?? GeneralUtility::makeInstance(QueryBuilder::class, /** @scrutinizer ignore-type */ $configuration, /** @scrutinizer ignore-type */ $solrLogManager);
$this->queryBuilder = $queryBuilder ?? GeneralUtility::makeInstance(QueryBuilder::class, /** @scrutinizer ignore-type */ $configuration, /** @scrutinizer ignore-type */ $meilisearchLogManager);
}
/**
@ -134,10 +134,10 @@ class SearchResultSetService
* @param bool $useCache
* @return bool
*/
public function getIsSolrAvailable($useCache = true)
public function getIsMeilisearchAvailable($useCache = true)
{
$this->isSolrAvailable = $this->search->ping($useCache);
return $this->isSolrAvailable;
$this->isMeilisearchAvailable = $this->search->ping($useCache);
return $this->isMeilisearchAvailable;
}
/**
@ -179,8 +179,8 @@ class SearchResultSetService
*/
protected function getResultSetClassName()
{
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName ']) ?
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName '] : SearchResultSet::class;
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultSetClassName ']) ?
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultSetClassName '] : SearchResultSet::class;
}
/**
@ -204,7 +204,7 @@ class SearchResultSetService
$this->initializeRegisteredSearchComponents($query, $searchRequest);
$resultSet->setUsedQuery($query);
// performing the actual search, sending the query to the Solr server
// performing the actual search, sending the query to the Meilisearch server
$query = $this->modifyQuery($query, $searchRequest, $this->search);
$response = $this->doASearch($query, $searchRequest);
@ -294,7 +294,7 @@ class SearchResultSetService
}
/**
* Executes the search and builds a fake response for a current bug in Apache Solr 6.3
* Executes the search and builds a fake response for a current bug in Meilisearch 6.3
*
* @param Query $query
* @param SearchRequest $searchRequest
@ -308,7 +308,7 @@ class SearchResultSetService
$response = $this->search->search($query, $offSet, null);
if($response === null) {
throw new SolrIncompleteResponseException('The response retrieved from solr was incomplete', 1505989678);
throw new MeilisearchIncompleteResponseException('The response retrieved from meilisearch was incomplete', 1505989678);
}
return $response;
@ -375,19 +375,19 @@ class SearchResultSetService
}
/**
* Allows to modify a query before eventually handing it over to Solr.
* Allows to modify a query before eventually handing it over to Meilisearch.
*
* @param Query $query The current query before it's being handed over to Solr.
* @param Query $query The current query before it's being handed over to Meilisearch.
* @param SearchRequest $searchRequest The searchRequest, relevant in the current context
* @param Search $search The search, relevant in the current context
* @throws \UnexpectedValueException
* @return Query The modified query that is actually going to be given to Solr.
* @return Query The modified query that is actually going to be given to Meilisearch.
*/
protected function modifyQuery(Query $query, SearchRequest $searchRequest, Search $search)
{
// hook to modify the search query
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchQuery'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchQuery'] as $classReference) {
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['modifySearchQuery'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['modifySearchQuery'] as $classReference) {
$queryModifier = $this->objectManager->get($classReference);
if ($queryModifier instanceof Modifier) {
@ -413,7 +413,7 @@ class SearchResultSetService
}
/**
* Retrieves a single document from solr by document id.
* Retrieves a single document from meilisearch by document id.
*
* @param string $documentId
* @return SearchResult
@ -431,7 +431,7 @@ class SearchResultSetService
throw new \UnexpectedValueException("Response did not contain a valid Document object");
}
return $this->searchResultBuilder->fromApacheSolrDocument($resultDocument);
return $this->searchResultBuilder->fromApacheMeilisearchDocument($resultDocument);
}
/**
@ -443,11 +443,11 @@ class SearchResultSetService
*/
private function handleSearchHook($eventName, SearchResultSet $resultSet)
{
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$eventName])) {
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch'][$eventName])) {
return $resultSet;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$eventName] as $classReference) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch'][$eventName] as $classReference) {
$afterSearchProcessor = $this->objectManager->get($classReference);
if ($afterSearchProcessor instanceof SearchResultSetProcessor) {
$afterSearchProcessor->process($resultSet);

View File

@ -38,13 +38,13 @@ class ScoreCalculationService
* Renders an overview of how the score for a certain document has been
* calculated.
*
* @param string $solrDebugData debug data from the solr response
* @param string $meilisearchDebugData debug data from the meilisearch response
* @param string $queryFields
* @return string The HTML showing the score analysis
*/
public function getRenderedScores($solrDebugData, $queryFields)
public function getRenderedScores($meilisearchDebugData, $queryFields)
{
$highScores = $this->parseScores($solrDebugData, $queryFields);
$highScores = $this->parseScores($meilisearchDebugData, $queryFields);
return $this->render($highScores);
}

View File

@ -102,8 +102,8 @@ class SearchRequestBuilder
if ($this->shouldHideResultsFromInitialSearch($searchRequest)) {
// initialize search with an empty query, which would by default return all documents
// anyway, tell Solr to not return any result documents
// Solr will still return facets though
// anyway, tell Meilisearch to not return any result documents
// Meilisearch will still return facets though
$currentNumberOfResultsShown = 0;
}

View File

@ -35,7 +35,7 @@ use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetService;
use WapplerSystems\Meilisearch\Domain\Search\SearchRequest;
use WapplerSystems\Meilisearch\Search;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Solr\ParsingUtil;
use WapplerSystems\Meilisearch\System\Meilisearch\ParsingUtil;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
@ -95,15 +95,15 @@ class SuggestService {
$groupList = Util::getFrontendUserGroupsList();
$suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
$solrSuggestions = $this->getSolrSuggestions($suggestQuery);
$meilisearchSuggestions = $this->getMeilisearchSuggestions($suggestQuery);
if ($solrSuggestions === []) {
if ($meilisearchSuggestions === []) {
return ['status' => false];
}
$maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
$showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
$suggestions = $this->getSuggestionArray($suggestQuery, $solrSuggestions, $maxSuggestions);
$suggestions = $this->getSuggestionArray($suggestQuery, $meilisearchSuggestions, $maxSuggestions);
if (!$showTopResults) {
return $this->getResultArray($searchRequest, $suggestions, [], false);
@ -155,17 +155,17 @@ class SuggestService {
}
/**
* Retrieves the suggestions from the solr server.
* Retrieves the suggestions from the meilisearch server.
*
* @param SuggestQuery $suggestQuery
* @return array
*/
protected function getSolrSuggestions(SuggestQuery $suggestQuery) : array
protected function getMeilisearchSuggestions(SuggestQuery $suggestQuery) : array
{
$pageId = $this->tsfe->getRequestedId();
$languageId = Util::getLanguageUid();
$solr = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionByPageId($pageId, $languageId);
$search = GeneralUtility::makeInstance(Search::class, /** @scrutinizer ignore-type */ $solr);
$meilisearch = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionByPageId($pageId, $languageId);
$search = GeneralUtility::makeInstance(Search::class, /** @scrutinizer ignore-type */ $meilisearch);
$response = $search->search($suggestQuery, 0, 0);
$rawResponse = $response->getRawResponse();
@ -178,19 +178,19 @@ class SuggestService {
}
/**
* Extracts the suggestions from solr as array.
* Extracts the suggestions from meilisearch as array.
*
* @param SuggestQuery $suggestQuery
* @param array $solrSuggestions
* @param array $meilisearchSuggestions
* @param integer $maxSuggestions
* @return array
*/
protected function getSuggestionArray(SuggestQuery $suggestQuery, $solrSuggestions, $maxSuggestions) : array
protected function getSuggestionArray(SuggestQuery $suggestQuery, $meilisearchSuggestions, $maxSuggestions) : array
{
$queryString = $suggestQuery->getQuery();
$suggestionCount = 0;
$suggestions = [];
foreach ($solrSuggestions as $string => $count) {
foreach ($meilisearchSuggestions as $string => $count) {
$suggestion = trim($queryString . ' ' . $string);
$suggestions[$suggestion] = $count;
$suggestionCount++;

View File

@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Domain\Site;
***************************************************************/
use WapplerSystems\Meilisearch\Domain\Index\Queue\RecordMonitor\Helper\ConfigurationAwareRecordService;
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository;
use TYPO3\CMS\Backend\Utility\BackendUtility;
@ -128,11 +128,11 @@ abstract class Site implements SiteInterface
}
/**
* Gets the site's Solr TypoScript configuration (plugin.tx_meilisearch.*)
* Gets the site's Meilisearch TypoScript configuration (plugin.tx_meilisearch.*)
*
* @return \WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration The Solr TypoScript configuration
* @return \WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration The Meilisearch TypoScript configuration
*/
public function getSolrConfiguration()
public function getMeilisearchConfiguration()
{
return $this->configuration;
}
@ -167,12 +167,12 @@ abstract class Site implements SiteInterface
$configurationAwareRecordService = GeneralUtility::makeInstance(ConfigurationAwareRecordService::class);
// Fetch configuration in order to be able to read initialPagesAdditionalWhereClause
$solrConfiguration = $this->getSolrConfiguration();
$indexQueueConfigurationName = $configurationAwareRecordService->getIndexingConfigurationName('pages', $this->rootPage['uid'], $solrConfiguration);
$meilisearchConfiguration = $this->getMeilisearchConfiguration();
$indexQueueConfigurationName = $configurationAwareRecordService->getIndexingConfigurationName('pages', $this->rootPage['uid'], $meilisearchConfiguration);
if ($indexQueueConfigurationName === null) {
return $pageIds;
}
$initialPagesAdditionalWhereClause = $solrConfiguration->getInitialPagesAdditionalWhereClause($indexQueueConfigurationName);
$initialPagesAdditionalWhereClause = $meilisearchConfiguration->getInitialPagesAdditionalWhereClause($indexQueueConfigurationName);
return array_merge($pageIds, $this->pagesRepository->findAllSubPageIdsByRootPage($rootPageId, $maxDepth, $initialPagesAdditionalWhereClause));
}
@ -241,26 +241,26 @@ abstract class Site implements SiteInterface
/**
* @return array
* @throws NoSolrConnectionFoundException
* @throws NoMeilisearchConnectionFoundException
*/
public function getAllSolrConnectionConfigurations(): array {
public function getAllMeilisearchConnectionConfigurations(): array {
$configs = [];
foreach ($this->getAvailableLanguageIds() as $languageId) {
try {
$configs[$languageId] = $this->getSolrConnectionConfiguration($languageId);
} catch (NoSolrConnectionFoundException $e) {}
$configs[$languageId] = $this->getMeilisearchConnectionConfiguration($languageId);
} catch (NoMeilisearchConnectionFoundException $e) {}
}
return $configs;
}
public function isEnabled(): bool
{
return !empty($this->getAllSolrConnectionConfigurations());
return !empty($this->getAllMeilisearchConnectionConfigurations());
}
/**
* @param int $languageId
* @return array
*/
abstract function getSolrConnectionConfiguration(int $language = 0): array;
abstract function getMeilisearchConnectionConfiguration(int $language = 0): array;
}

View File

@ -40,8 +40,8 @@ class SiteHashService
/**
* Resolves magic keywords in allowed sites configuration.
* Supported keywords:
* __solr_current_site - The domain of the site the query has been started from
* __current_site - Same as __solr_current_site
* __meilisearch_current_site - The domain of the site the query has been started from
* __current_site - Same as __meilisearch_current_site
* __all - Adds all domains as allowed sites
* * - Means all sites are allowed, same as no siteHash
*
@ -56,8 +56,8 @@ class SiteHashService
} elseif ($allowedSitesConfiguration === '*') {
return '*';
} else {
// we thread empty allowed site configurations as __solr_current_site since this is the default behaviour
$allowedSitesConfiguration = empty($allowedSitesConfiguration) ? '__solr_current_site' : $allowedSitesConfiguration;
// we thread empty allowed site configurations as __meilisearch_current_site since this is the default behaviour
$allowedSitesConfiguration = empty($allowedSitesConfiguration) ? '__meilisearch_current_site' : $allowedSitesConfiguration;
return $this->getDomainByPageIdAndReplaceMarkers($pageId, $allowedSitesConfiguration);
}
}
@ -98,7 +98,7 @@ class SiteHashService
}
/**
* Retrieves the domain of the site that belongs to the passed pageId and replaces their markers __solr_current_site
* Retrieves the domain of the site that belongs to the passed pageId and replaces their markers __meilisearch_current_site
* and __current_site.
*
* @param integer $pageId
@ -108,7 +108,7 @@ class SiteHashService
protected function getDomainByPageIdAndReplaceMarkers($pageId, $allowedSitesConfiguration)
{
$domainOfPage = $this->getSiteByPageId($pageId)->getDomain();
$allowedSites = str_replace(['__solr_current_site', '__current_site'], $domainOfPage, $allowedSitesConfiguration);
$allowedSites = str_replace(['__meilisearch_current_site', '__current_site'], $domainOfPage, $allowedSitesConfiguration);
return (string)$allowedSites;
}

View File

@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\Domain\Site;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
interface SiteInterface
{
@ -52,11 +52,11 @@ interface SiteInterface
public function getLabel();
/**
* Gets the site's Solr TypoScript configuration (plugin.tx_meilisearch.*)
* Gets the site's Meilisearch TypoScript configuration (plugin.tx_meilisearch.*)
*
* @return \WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration The Solr TypoScript configuration
* @return \WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration The Meilisearch TypoScript configuration
*/
public function getSolrConfiguration();
public function getMeilisearchConfiguration();
/**
* Gets the site's default language as configured in
@ -114,15 +114,15 @@ interface SiteInterface
/**
* @param int $language
* @return array
* @throws NoSolrConnectionFoundException
* @throws NoMeilisearchConnectionFoundException
*/
public function getSolrConnectionConfiguration(int $language = 0): array;
public function getMeilisearchConnectionConfiguration(int $language = 0): array;
/**
* @return array
* @throws NoSolrConnectionFoundException
* @throws NoMeilisearchConnectionFoundException
*/
public function getAllSolrConnectionConfigurations(): array;
public function getAllMeilisearchConnectionConfigurations(): array;
public function isEnabled(): bool;
}

View File

@ -152,7 +152,7 @@ class SiteRepository
}
/**
* Gets all available TYPO3 sites with Solr configured.
* Gets all available TYPO3 sites with Meilisearch configured.
*
* @param bool $stopOnInvalidSite
* @throws \Exception
@ -180,18 +180,18 @@ class SiteRepository
*/
protected function getAvailableTYPO3ManagedSites(bool $stopOnInvalidSite): array
{
$typo3ManagedSolrSites = [];
$typo3ManagedMeilisearchSites = [];
$typo3Sites = $this->siteFinder->getAllSites();
foreach ($typo3Sites as $typo3Site) {
try {
$rootPageId = $typo3Site->getRootPageId();
if (isset($typo3ManagedSolrSites[$rootPageId])) {
if (isset($typo3ManagedMeilisearchSites[$rootPageId])) {
//get each site only once
continue;
}
$typo3ManagedSolrSite = $this->buildSite($rootPageId);
if ($typo3ManagedSolrSite->isEnabled()) {
$typo3ManagedSolrSites[$rootPageId] = $typo3ManagedSolrSite;
$typo3ManagedMeilisearchSite = $this->buildSite($rootPageId);
if ($typo3ManagedMeilisearchSite->isEnabled()) {
$typo3ManagedMeilisearchSites[$rootPageId] = $typo3ManagedMeilisearchSite;
}
} catch (\Exception $e) {
@ -200,7 +200,7 @@ class SiteRepository
}
}
}
return $typo3ManagedSolrSites;
return $typo3ManagedMeilisearchSites;
}
/**
@ -262,7 +262,7 @@ class SiteRepository
*/
protected function buildTypo3ManagedSite(array $rootPageRecord): ?Typo3ManagedSite
{
$solrConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($rootPageRecord['uid']);
$meilisearchConfiguration = $this->frontendEnvironment->getMeilisearchConfigurationFromPageId($rootPageRecord['uid']);
/** @var \TYPO3\CMS\Core\Site\Entity\Site $typo3Site */
try {
$typo3Site = $this->siteFinder->getSiteByPageId($rootPageRecord['uid']);
@ -278,36 +278,26 @@ class SiteRepository
return $language->getLanguageId();
}, $typo3Site->getLanguages());
$solrConnectionConfigurations = [];
$meilisearchConnectionConfigurations = [];
foreach ($availableLanguageIds as $languageUid) {
$solrEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
if ($solrEnabled) {
$solrConnectionConfigurations[$languageUid] = [
$meilisearchEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
if ($meilisearchEnabled) {
$meilisearchConnectionConfigurations[$languageUid] = [
'connectionKey' => $rootPageRecord['uid'] . '|' . $languageUid,
'rootPageTitle' => $rootPageRecord['title'],
'rootPageUid' => $rootPageRecord['uid'],
'read' => [
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'read', 'http'),
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'read', 'localhost'),
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 8983),
// @todo: transform core to path
'path' =>
SiteUtility::getConnectionProperty($typo3Site, 'path', $languageUid, 'read', '/solr/') .
SiteUtility::getConnectionProperty($typo3Site, 'core', $languageUid, 'read', 'core_en') . '/' ,
'username' => SiteUtility::getConnectionProperty($typo3Site, 'username', $languageUid, 'read', ''),
'password' => SiteUtility::getConnectionProperty($typo3Site, 'password', $languageUid, 'read', '')
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 7700),
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'read', ''),
],
'write' => [
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'write', 'http'),
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'write', 'localhost'),
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 8983),
// @todo: transform core to path
'path' =>
SiteUtility::getConnectionProperty($typo3Site, 'path', $languageUid, 'read', '/solr/') .
SiteUtility::getConnectionProperty($typo3Site, 'core', $languageUid, 'read', 'core_en') . '/' ,
'username' => SiteUtility::getConnectionProperty($typo3Site, 'username', $languageUid, 'write', ''),
'password' => SiteUtility::getConnectionProperty($typo3Site, 'password', $languageUid, 'write', '')
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 7700),
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'write', ''),
],
'language' => $languageUid
@ -318,7 +308,7 @@ class SiteRepository
return GeneralUtility::makeInstance(
Typo3ManagedSite::class,
/** @scrutinizer ignore-type */
$solrConfiguration,
$meilisearchConfiguration,
/** @scrutinizer ignore-type */
$rootPageRecord,
/** @scrutinizer ignore-type */
@ -332,7 +322,7 @@ class SiteRepository
/** @scrutinizer ignore-type */
$availableLanguageIds,
/** @scrutinizer ignore-type */
$solrConnectionConfigurations,
$meilisearchConnectionConfigurations,
/** @scrutinizer ignore-type */
$typo3Site
);

View File

@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\Domain\Site;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository;
use TYPO3\CMS\Core\Context\LanguageAspectFactory;
@ -47,12 +47,12 @@ class Typo3ManagedSite extends Site
/**
* @var array
*/
protected $solrConnectionConfigurations;
protected $meilisearchConnectionConfigurations;
public function __construct(
TypoScriptConfiguration $configuration,
array $page, $domain, $siteHash, PagesRepository $pagesRepository = null, $defaultLanguageId = 0, $availableLanguageIds = [], array $solrConnectionConfigurations = [], Typo3Site $typo3SiteObject = null)
array $page, $domain, $siteHash, PagesRepository $pagesRepository = null, $defaultLanguageId = 0, $availableLanguageIds = [], array $meilisearchConnectionConfigurations = [], Typo3Site $typo3SiteObject = null)
{
$this->configuration = $configuration;
$this->rootPage = $page;
@ -61,31 +61,31 @@ class Typo3ManagedSite extends Site
$this->pagesRepository = $pagesRepository ?? GeneralUtility::makeInstance(PagesRepository::class);
$this->defaultLanguageId = $defaultLanguageId;
$this->availableLanguageIds = $availableLanguageIds;
$this->solrConnectionConfigurations = $solrConnectionConfigurations;
$this->meilisearchConnectionConfigurations = $meilisearchConnectionConfigurations;
$this->typo3SiteObject = $typo3SiteObject;
}
/**
* @param int $language
* @return array
* @throws NoSolrConnectionFoundException
* @throws NoMeilisearchConnectionFoundException
*/
public function getSolrConnectionConfiguration(int $language = 0): array
public function getMeilisearchConnectionConfiguration(int $language = 0): array
{
if (!is_array($this->solrConnectionConfigurations[$language])) {
/* @var $noSolrConnectionException NoSolrConnectionFoundException */
$noSolrConnectionException = GeneralUtility::makeInstance(
NoSolrConnectionFoundException::class,
/** @scrutinizer ignore-type */ 'Could not find a Solr connection for root page [' . $this->getRootPageId() . '] and language [' . $language . '].',
if (!is_array($this->meilisearchConnectionConfigurations[$language])) {
/* @var $noMeilisearchConnectionException NoMeilisearchConnectionFoundException */
$noMeilisearchConnectionException = GeneralUtility::makeInstance(
NoMeilisearchConnectionFoundException::class,
/** @scrutinizer ignore-type */ 'Could not find a Meilisearch connection for root page [' . $this->getRootPageId() . '] and language [' . $language . '].',
/** @scrutinizer ignore-type */ 1552491117
);
$noSolrConnectionException->setRootPageId($this->getRootPageId());
$noSolrConnectionException->setLanguageId($language);
$noMeilisearchConnectionException->setRootPageId($this->getRootPageId());
$noMeilisearchConnectionException->setLanguageId($language);
throw $noSolrConnectionException;
throw $noMeilisearchConnectionException;
}
return $this->solrConnectionConfigurations[$language];
return $this->meilisearchConnectionConfigurations[$language];
}
/**

View File

@ -67,11 +67,11 @@ class IdBuilder
*/
protected function applyHook($variantId, $systemHash, $type, $uid)
{
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifyVariantId'])) {
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['modifyVariantId'])) {
return $variantId;
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifyVariantId'] as $classReference) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['modifyVariantId'] as $classReference) {
$variantIdModifier = GeneralUtility::makeInstance($classReference);
if ($variantIdModifier instanceof IdModifier) {
$variantId = $variantIdModifier->modifyVariantId($variantId, $systemHash, $type, $uid);

View File

@ -30,11 +30,11 @@ use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\SearchResultBuilde
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetProcessor;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Builds the SearchResult objects from the solr response and assigns the created child SearchResult objects (the variants)
* Builds the SearchResult objects from the meilisearch response and assigns the created child SearchResult objects (the variants)
* to the parent search result object.
*/
class VariantsProcessor implements SearchResultSetProcessor
@ -114,7 +114,7 @@ class VariantsProcessor implements SearchResultSetProcessor
$fields = get_object_vars($variantDocumentArray);
$variantDocument = new SearchResult($fields);
$variantSearchResult = $this->resultBuilder->fromApacheSolrDocument($variantDocument);
$variantSearchResult = $this->resultBuilder->fromApacheMeilisearchDocument($variantDocument);
$variantSearchResult->setIsVariant(true);
$variantSearchResult->setVariantParent($resultDocument);

View File

@ -28,7 +28,7 @@
Provides the sitehash for a given domain, valid for the current TYPO3
installation.
Example: http://www.my-typo3-solr-installation.com/index.php?eID=tx_meilisearch_api&api=siteHash&apiKey=<API key>&domain=www.domain-to-index.com
Example: http://www.my-typo3-meilisearch-installation.com/index.php?eID=tx_meilisearch_api&api=siteHash&apiKey=<API key>&domain=www.domain-to-index.com
*/

View File

@ -33,13 +33,13 @@ abstract class AbstractHierarchyProcessor
{
/**
* Builds a Solr hierarchy from an array of uids that make up a rootline.
* Builds a Meilisearch hierarchy from an array of uids that make up a rootline.
*
* @param array $idRootline Array of Ids representing a rootline
* @return array Solr hierarchy
* @see http://wiki.apache.org/solr/HierarchicalFaceting
* @return array Meilisearch hierarchy
* @see http://wiki.apache.org/meilisearch/HierarchicalFaceting
*/
protected function buildSolrHierarchyFromIdRootline(array $idRootline)
protected function buildMeilisearchHierarchyFromIdRootline(array $idRootline)
{
$hierarchy = [];

View File

@ -27,9 +27,9 @@ use WapplerSystems\Meilisearch\System\Records\SystemCategory\SystemCategoryRepos
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* This Processor takes a UID of sys_category, and resolves its rootline in solr notation.
* This Processor takes a UID of sys_category, and resolves its rootline in meilisearch notation.
*
* Format of this field corresponds to http://wiki.apache.org/solr/HierarchicalFaceting
* Format of this field corresponds to http://wiki.apache.org/meilisearch/HierarchicalFaceting
*
* Let's say we have a category with uid 111 which is a sub category like shown in this tree:
*
@ -40,7 +40,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*
* then we get a rootline 1/10/100/111
*
* In Solr hierarchy notation, we get
* In Meilisearch hierarchy notation, we get
*
* 0-1
* 1-1/10
@ -69,7 +69,7 @@ class CategoryUidToHierarchy extends AbstractHierarchyProcessor implements Field
}
/**
* Expects a uid ID of a category. Returns a Solr hierarchy notation for the
* Expects a uid ID of a category. Returns a Meilisearch hierarchy notation for the
* rootline of the category ID.
*
* @param array $values Array of values, an array because of multivalued fields
@ -81,24 +81,24 @@ class CategoryUidToHierarchy extends AbstractHierarchyProcessor implements Field
foreach ($values as $value) {
$results = array_merge($results,
$this->getSolrRootlineForCategoryId($value));
$this->getMeilisearchRootlineForCategoryId($value));
}
return $results;
}
/**
* Returns a Solr hierarchy notation string for rootline of given category uid.
* Returns a Meilisearch hierarchy notation string for rootline of given category uid.
*
* @param int $categoryId Category ID to get a rootline as Solr hierarchy for
* @return array Rootline as Solr hierarchy array
* @param int $categoryId Category ID to get a rootline as Meilisearch hierarchy for
* @return array Rootline as Meilisearch hierarchy array
*/
protected function getSolrRootlineForCategoryId($categoryId)
protected function getMeilisearchRootlineForCategoryId($categoryId)
{
$categoryIdRootline = $this->buildCategoryIdRootline($categoryId);
$solrRootline = $this->buildSolrHierarchyFromIdRootline($categoryIdRootline);
$meilisearchRootline = $this->buildMeilisearchHierarchyFromIdRootline($categoryIdRootline);
return $solrRootline;
return $meilisearchRootline;
}
/**

View File

@ -29,9 +29,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\RootlineUtility;
/**
* This Processor takes a PID, and resolves its rootline in solr notation.
* This Processor takes a PID, and resolves its rootline in meilisearch notation.
*
* Format of this field corresponds to http://wiki.apache.org/solr/HierarchicalFaceting
* Format of this field corresponds to http://wiki.apache.org/meilisearch/HierarchicalFaceting
*
* Let's say we have a record indexed on page 111 which is a sub page like shown in this page tree:
*
@ -42,7 +42,7 @@ use TYPO3\CMS\Core\Utility\RootlineUtility;
*
* then we get a rootline 1/10/100/111
*
* In Solr hierarchy notation, we get
* In Meilisearch hierarchy notation, we get
*
* 0-1/
* 1-1/10/
@ -57,7 +57,7 @@ class PageUidToHierarchy extends AbstractHierarchyProcessor implements FieldProc
{
/**
* Expects a page ID of a page. Returns a Solr hierarchy notation for the
* Expects a page ID of a page. Returns a Meilisearch hierarchy notation for the
* rootline of the page ID.
*
* @param array $values Array of values, an array because of multivalued fields
@ -70,7 +70,7 @@ class PageUidToHierarchy extends AbstractHierarchyProcessor implements FieldProc
foreach ($values as $value) {
list($rootPageUid, $mountPoint) = GeneralUtility::trimExplode(',',
$value, true, 2);
$results[] = $this->getSolrRootlineForPageId($rootPageUid,
$results[] = $this->getMeilisearchRootlineForPageId($rootPageUid,
$mountPoint);
}
@ -78,18 +78,18 @@ class PageUidToHierarchy extends AbstractHierarchyProcessor implements FieldProc
}
/**
* Returns a Solr hierarchy notation string for rootline of given PID.
* Returns a Meilisearch hierarchy notation string for rootline of given PID.
*
* @param int $pageId Page ID to get a rootline as Solr hierarchy for
* @param int $pageId Page ID to get a rootline as Meilisearch hierarchy for
* @param string $mountPoint The mount point parameter that will be used for building the rootline.
* @return array Rootline as Solr hierarchy array
* @return array Rootline as Meilisearch hierarchy array
*/
protected function getSolrRootlineForPageId($pageId, $mountPoint = '')
protected function getMeilisearchRootlineForPageId($pageId, $mountPoint = '')
{
$pageIdRootline = $this->buildPageIdRootline($pageId, $mountPoint);
$solrRootline = $this->buildSolrHierarchyFromIdRootline($pageIdRootline);
$meilisearchRootline = $this->buildMeilisearchHierarchyFromIdRootline($pageIdRootline);
return $solrRootline;
return $meilisearchRootline;
}
/**

View File

@ -46,7 +46,7 @@ class PathToHierarchy implements FieldProcessor
$results = [];
foreach ($values as $value) {
$valueResults = $this->buildSolrHierarchyFromPath($value);
$valueResults = $this->buildMeilisearchHierarchyFromPath($value);
$results = array_merge($results, $valueResults);
}
@ -54,13 +54,13 @@ class PathToHierarchy implements FieldProcessor
}
/**
* Builds a Solr hierarchy from path string.
* Builds a Meilisearch hierarchy from path string.
*
* @param string $path path string
* @return array Solr hierarchy
* @see http://wiki.apache.org/solr/HierarchicalFaceting
* @return array Meilisearch hierarchy
* @see http://wiki.apache.org/meilisearch/HierarchicalFaceting
*/
protected function buildSolrHierarchyFromPath($path)
protected function buildMeilisearchHierarchyFromPath($path)
{
$hierarchy = [];
$path = HierarchyTool::substituteSlashes($path);

View File

@ -29,11 +29,11 @@ use WapplerSystems\Meilisearch\FieldProcessor\PageUidToHierarchy;
use WapplerSystems\Meilisearch\FieldProcessor\PathToHierarchy;
use WapplerSystems\Meilisearch\FieldProcessor\TimestampToIsoDate;
use WapplerSystems\Meilisearch\FieldProcessor\TimestampToUtcIsoDate;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Service class that modifies fields in a Apache Solr Document, used for
* Service class that modifies fields in a Meilisearch Document, used for
* common field processing during indexing or resolving
*
* @author Daniel Poetzinger <poetzinger@aoemedia.de>

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\System\DateTime\FormatService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* A field processor that converts timestamps to ISO dates as needed by Solr
* A field processor that converts timestamps to ISO dates as needed by Meilisearch
*
* @author Ingo Renner <ingo@typo3.org>
*/
@ -36,7 +36,7 @@ class TimestampToIsoDate implements FieldProcessor
{
/**
* Expects a timestamp and converts it to an ISO 8601 date as needed by Solr.
* Expects a timestamp and converts it to an ISO 8601 date as needed by Meilisearch.
*
* Example date output format: 1995-12-31T23:59:59Z
* The trailing "Z" designates UTC time and is mandatory

View File

@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\System\DateTime\FormatService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* A field processor that converts timestamps to ISO dates as needed by Solr
* A field processor that converts timestamps to ISO dates as needed by Meilisearch
*
* @author Andreas Allacher <andreas.allacher@cyberhouse.at>
*/
@ -36,7 +36,7 @@ class TimestampToUtcIsoDate implements FieldProcessor
{
/**
* Expects a timestamp and converts it to an ISO 8601 date in UTC as needed by Solr.
* Expects a timestamp and converts it to an ISO 8601 date in UTC as needed by Meilisearch.
*
* Example date output format: 1995-12-31T23:59:59Z
* The trailing "Z" designates UTC time and is mandatory

View File

@ -119,7 +119,7 @@ class FrontendEnvironment implements SingletonInterface
* @param ?int $language
* @return TypoScriptConfiguration
*/
public function getSolrConfigurationFromPageId($pageId, $language = 0): TypoScriptConfiguration
public function getMeilisearchConfigurationFromPageId($pageId, $language = 0): TypoScriptConfiguration
{
return $this->getConfigurationFromPageId($pageId, '', $language);
}

View File

@ -24,10 +24,10 @@ class TypoScript implements SingletonInterface
* Language usage may be disabled to get the default TypoScript
* configuration.
*
* @param int $pageId Id of the (root) page to get the Solr configuration from.
* @param int $pageId Id of the (root) page to get the Meilisearch configuration from.
* @param string $path The TypoScript configuration path to retrieve.
* @param int $language System language uid, optional, defaults to 0
* @return TypoScriptConfiguration The Solr configuration for the requested tree.
* @return TypoScriptConfiguration The Meilisearch configuration for the requested tree.
*/
public function getConfigurationFromPageId($pageId, $path, $language = 0)
{
@ -83,7 +83,7 @@ class TypoScript implements SingletonInterface
}
/**
* builds an configuration array, containing the solr configuration.
* builds an configuration array, containing the meilisearch configuration.
*
* @param integer $pageId
* @param string $path

View File

@ -164,7 +164,7 @@ class GarbageCollector extends AbstractDataHandlerListener implements SingletonI
// ...still needed?
// must be removed from index since the pid changes and
// is part of the Solr document ID
// is part of the Meilisearch document ID
$this->collectGarbage($table, $uid);
// now re-index with new properties

View File

@ -34,7 +34,7 @@ class HtmlContentExtractor
{
/**
* Unicode ranges which should get stripped before sending a document to solr.
* Unicode ranges which should get stripped before sending a document to meilisearch.
* This is necessary if a document (PDF, etc.) contains unicode characters which
* are valid in the font being used in the document but are not available in the
* font being used for displaying results.
@ -63,7 +63,7 @@ class HtmlContentExtractor
*/
protected $content;
/**
* Mapping of HTML tags to Solr document fields.
* Mapping of HTML tags to Meilisearch document fields.
*
* @var array
*/
@ -104,7 +104,7 @@ class HtmlContentExtractor
protected function getConfiguration()
{
if ($this->configuration == null) {
$this->configuration = Util::getSolrConfiguration();
$this->configuration = Util::getMeilisearchConfiguration();
}
return $this->configuration;
@ -121,7 +121,7 @@ class HtmlContentExtractor
/**
* Returns the cleaned indexable content from the page's HTML markup.
*
* The content is cleaned from HTML tags and control chars Solr could
* The content is cleaned from HTML tags and control chars Meilisearch could
* stumble on.
*
* @return string Indexable, cleaned content ready for indexing.
@ -165,7 +165,7 @@ class HtmlContentExtractor
}
/**
* Strips control characters that cause Jetty/Solr to fail.
* Strips control characters that cause Jetty/Meilisearch to fail.
*
* @param string $content the content to sanitize
* @return string the sanitized content
@ -220,7 +220,7 @@ class HtmlContentExtractor
/**
* Extracts HTML tag content from tags in the content marked for indexing.
*
* @return array A mapping of Solr document field names to content found in defined tags.
* @return array A mapping of Meilisearch document field names to content found in defined tags.
*/
public function getTagContent()
{

Some files were not shown because too many files have changed in this diff Show More