first commit
This commit is contained in:
parent
c93ec9492a
commit
cadcc8edb4
@ -30,11 +30,11 @@ use TYPO3\CMS\Core\Database\QueryGenerator;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* 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
|
* 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>
|
* @author Timo Schmidt <timo.schmidt@dkd.de>
|
||||||
*/
|
*/
|
||||||
@ -121,12 +121,12 @@ abstract class AbstractDataHandlerListener
|
|||||||
$isRecursiveUpdateRequired = $this->isRecursiveUpdateRequired($pageId, $changedFields);
|
$isRecursiveUpdateRequired = $this->isRecursiveUpdateRequired($pageId, $changedFields);
|
||||||
// If RecursiveUpdateTriggerConfiguration is false => check if changeFields are part of recursiveUpdateFields
|
// If RecursiveUpdateTriggerConfiguration is false => check if changeFields are part of recursiveUpdateFields
|
||||||
if ($isRecursiveUpdateRequired === false) {
|
if ($isRecursiveUpdateRequired === false) {
|
||||||
$solrConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($pageId);
|
$meilisearchConfiguration = $this->frontendEnvironment->getMeilisearchConfigurationFromPageId($pageId);
|
||||||
$indexQueueConfigurationName = $this->configurationAwareRecordService->getIndexingConfigurationName('pages', $pageId, $solrConfiguration);
|
$indexQueueConfigurationName = $this->configurationAwareRecordService->getIndexingConfigurationName('pages', $pageId, $meilisearchConfiguration);
|
||||||
if ($indexQueueConfigurationName === null) {
|
if ($indexQueueConfigurationName === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$updateFields = $solrConfiguration->getIndexQueueConfigurationRecursiveUpdateFields($indexQueueConfigurationName);
|
$updateFields = $meilisearchConfiguration->getIndexQueueConfigurationRecursiveUpdateFields($indexQueueConfigurationName);
|
||||||
|
|
||||||
// Check if no additional fields have been defined and then skip recursive update
|
// Check if no additional fields have been defined and then skip recursive update
|
||||||
if (empty($updateFields)) {
|
if (empty($updateFields)) {
|
||||||
|
@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\ContentObject\ContentObjectService;
|
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;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +67,7 @@ class AdditionalFieldsIndexer implements SubstitutePageIndexer
|
|||||||
*/
|
*/
|
||||||
public function __construct(TypoScriptConfiguration $configuration = null, ContentObjectService $contentObjectService = null)
|
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->additionalIndexingFields = $this->configuration->getIndexAdditionalFieldsConfiguration();
|
||||||
$this->additionalFieldNames = $this->configuration->getIndexMappedAdditionalFieldNames();
|
$this->additionalFieldNames = $this->configuration->getIndexMappedAdditionalFieldNames();
|
||||||
$this->contentObjectService = $contentObjectService === null ? GeneralUtility::makeInstance(ContentObjectService::class) : $contentObjectService;
|
$this->contentObjectService = $contentObjectService === null ? GeneralUtility::makeInstance(ContentObjectService::class) : $contentObjectService;
|
||||||
@ -80,7 +80,7 @@ class AdditionalFieldsIndexer implements SubstitutePageIndexer
|
|||||||
* plugin.tx_meilisearch.index.additionalFields.
|
* plugin.tx_meilisearch.index.additionalFields.
|
||||||
*
|
*
|
||||||
* @param Document $pageDocument The original page document.
|
* @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)
|
public function getPageDocument(Document $pageDocument)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* 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
|
* 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 Document $pageDocument The original page document.
|
||||||
* @param array $allDocuments An array containing all the documents collected until here, including the 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);
|
public function getAdditionalPageDocuments(Document $pageDocument, array $allDocuments);
|
||||||
}
|
}
|
||||||
|
@ -141,10 +141,10 @@ class IndexingConfigurationSelectorField
|
|||||||
{
|
{
|
||||||
$indexingTableMap = [];
|
$indexingTableMap = [];
|
||||||
|
|
||||||
$solrConfiguration = $this->site->getSolrConfiguration();
|
$meilisearchConfiguration = $this->site->getMeilisearchConfiguration();
|
||||||
$configurationNames = $solrConfiguration->getEnabledIndexQueueConfigurationNames();
|
$configurationNames = $meilisearchConfiguration->getEnabledIndexQueueConfigurationNames();
|
||||||
foreach ($configurationNames as $configurationName) {
|
foreach ($configurationNames as $configurationName) {
|
||||||
$indexingTableMap[$configurationName] = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($configurationName);
|
$indexingTableMap[$configurationName] = $meilisearchConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($configurationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $indexingTableMap;
|
return $indexingTableMap;
|
||||||
|
@ -39,7 +39,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|||||||
class SiteSelectorField
|
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 string $selectorName Name to be used in the select's name attribute
|
||||||
* @param Site $selectedSite Optional, currently selected site
|
* @param Site $selectedSite Optional, currently selected site
|
||||||
|
@ -24,20 +24,20 @@ namespace WapplerSystems\Meilisearch;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* 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\Site;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
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\Records\SystemLanguage\SystemLanguageRepository;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\Node;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use TYPO3\CMS\Core\Registry;
|
|
||||||
use TYPO3\CMS\Core\SingletonInterface;
|
use TYPO3\CMS\Core\SingletonInterface;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use function json_encode;
|
use function json_encode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ConnectionManager is responsible to create SolrConnection objects.
|
* ConnectionManager is responsible to create MeilisearchConnection objects.
|
||||||
*
|
*
|
||||||
* @author Ingo Renner <ingo@typo3.org>
|
* @author Ingo Renner <ingo@typo3.org>
|
||||||
*/
|
*/
|
||||||
@ -55,9 +55,9 @@ class ConnectionManager implements SingletonInterface
|
|||||||
protected $systemLanguageRepository;
|
protected $systemLanguageRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PagesRepositoryAtExtSolr
|
* @var PagesRepositoryAtExtMeilisearch
|
||||||
*/
|
*/
|
||||||
protected $pagesRepositoryAtExtSolr;
|
protected $pagesRepositoryAtExtMeilisearch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SiteRepository
|
* @var SiteRepository
|
||||||
@ -67,130 +67,130 @@ class ConnectionManager implements SingletonInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SystemLanguageRepository $systemLanguageRepository
|
* @param SystemLanguageRepository $systemLanguageRepository
|
||||||
* @param PagesRepositoryAtExtSolr|null $pagesRepositoryAtExtSolr
|
* @param PagesRepositoryAtExtMeilisearch|null $pagesRepositoryAtExtMeilisearch
|
||||||
* @param SiteRepository $siteRepository
|
* @param SiteRepository $siteRepository
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SystemLanguageRepository $systemLanguageRepository = null,
|
SystemLanguageRepository $systemLanguageRepository = null,
|
||||||
PagesRepositoryAtExtSolr $pagesRepositoryAtExtSolr = null,
|
PagesRepositoryAtExtMeilisearch $pagesRepositoryAtExtMeilisearch = null,
|
||||||
SiteRepository $siteRepository = null
|
SiteRepository $siteRepository = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->systemLanguageRepository = $systemLanguageRepository ?? GeneralUtility::makeInstance(SystemLanguageRepository::class);
|
$this->systemLanguageRepository = $systemLanguageRepository ?? GeneralUtility::makeInstance(SystemLanguageRepository::class);
|
||||||
$this->siteRepository = $siteRepository ?? GeneralUtility::makeInstance(SiteRepository::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 $readNodeConfiguration
|
||||||
* @param array $writeNodeConfiguration
|
* @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));
|
$connectionHash = md5(json_encode($readNodeConfiguration) . json_encode($writeNodeConfiguration));
|
||||||
if (!isset(self::$connections[$connectionHash])) {
|
if (!isset(self::$connections[$connectionHash])) {
|
||||||
$readNode = Node::fromArray($readNodeConfiguration);
|
$readNode = $this->createClientFromArray($readNodeConfiguration);
|
||||||
$writeNode = Node::fromArray($writeNodeConfiguration);
|
$writeNode = $this->createClientFromArray($writeNodeConfiguration);
|
||||||
self::$connections[$connectionHash] = GeneralUtility::makeInstance(SolrConnection::class, $readNode, $writeNode);
|
self::$connections[$connectionHash] = GeneralUtility::makeInstance(MeilisearchConnection::class, $readNode, $writeNode);
|
||||||
}
|
}
|
||||||
return self::$connections[$connectionHash];
|
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
|
* @param array $config The meilisearch configuration array
|
||||||
* @return SolrConnection
|
* @return MeilisearchConnection
|
||||||
*/
|
*/
|
||||||
public function getConnectionFromConfiguration(array $config)
|
public function getConnectionFromConfiguration(array $config)
|
||||||
{
|
{
|
||||||
if(empty($config['read']) && !empty($config['solrHost'])) {
|
if(empty($config['read']) && !empty($config['meilisearchHost'])) {
|
||||||
throw new InvalidArgumentException('Invalid registry data please re-initialize your solr connections');
|
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 $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 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
|
* @param string $mount Comma list of MountPoint parameters
|
||||||
* @return SolrConnection A solr connection.
|
* @return MeilisearchConnection A meilisearch connection.
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getConnectionByPageId($pageId, $language = 0, $mount = '')
|
public function getConnectionByPageId($pageId, $language = 0, $mount = '')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$site = $this->siteRepository->getSiteByPageId($pageId, $mount);
|
$site = $this->siteRepository->getSiteByPageId($pageId, $mount);
|
||||||
$this->throwExceptionOnInvalidSite($site, 'No site for pageId ' . $pageId);
|
$this->throwExceptionOnInvalidSite($site, 'No site for pageId ' . $pageId);
|
||||||
$config = $site->getSolrConnectionConfiguration($language);
|
$config = $site->getMeilisearchConnectionConfiguration($language);
|
||||||
$solrConnection = $this->getConnectionFromConfiguration($config);
|
$meilisearchConnection = $this->getConnectionFromConfiguration($config);
|
||||||
return $solrConnection;
|
return $meilisearchConnection;
|
||||||
} catch(InvalidArgumentException $e) {
|
} catch(InvalidArgumentException $e) {
|
||||||
$noSolrConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
|
$noMeilisearchConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
|
||||||
throw $noSolrConnectionException;
|
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 $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.
|
* @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.
|
* @return MeilisearchConnection A meilisearch connection.
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getConnectionByRootPageId($pageId, $language = 0)
|
public function getConnectionByRootPageId($pageId, $language = 0)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$site = $this->siteRepository->getSiteByRootPageId($pageId);
|
$site = $this->siteRepository->getSiteByRootPageId($pageId);
|
||||||
$this->throwExceptionOnInvalidSite($site, 'No site for pageId ' . $pageId);
|
$this->throwExceptionOnInvalidSite($site, 'No site for pageId ' . $pageId);
|
||||||
$config = $site->getSolrConnectionConfiguration($language);
|
$config = $site->getMeilisearchConnectionConfiguration($language);
|
||||||
$solrConnection = $this->getConnectionFromConfiguration($config);
|
$meilisearchConnection = $this->getConnectionFromConfiguration($config);
|
||||||
return $solrConnection;
|
return $meilisearchConnection;
|
||||||
} catch (InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
/* @var NoSolrConnectionFoundException $noSolrConnectionException */
|
/* @var NoMeilisearchConnectionFoundException $noMeilisearchConnectionException */
|
||||||
$noSolrConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
|
$noMeilisearchConnectionException = $this->buildNoConnectionExceptionForPageAndLanguage($pageId, $language);
|
||||||
throw $noSolrConnectionException;
|
throw $noMeilisearchConnectionException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all connections found.
|
* Gets all connections found.
|
||||||
*
|
*
|
||||||
* @return SolrConnection[] An array of initialized WapplerSystems\Meilisearch\System\Solr\SolrConnection connections
|
* @return MeilisearchConnection[] An array of initialized WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection connections
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getAllConnections()
|
public function getAllConnections()
|
||||||
{
|
{
|
||||||
$solrConnections = [];
|
$meilisearchConnections = [];
|
||||||
foreach ($this->siteRepository->getAvailableSites() as $site) {
|
foreach ($this->siteRepository->getAvailableSites() as $site) {
|
||||||
foreach ($site->getAllSolrConnectionConfigurations() as $solrConfiguration) {
|
foreach ($site->getAllMeilisearchConnectionConfigurations() as $meilisearchConfiguration) {
|
||||||
$solrConnections[] = $this->getConnectionFromConfiguration($solrConfiguration);
|
$meilisearchConnections[] = $this->getConnectionFromConfiguration($meilisearchConfiguration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $solrConnections;
|
return $meilisearchConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all connections configured for a given site.
|
* Gets all connections configured for a given site.
|
||||||
*
|
*
|
||||||
* @param Site $site A TYPO3 site
|
* @param Site $site A TYPO3 site
|
||||||
* @return SolrConnection[] An array of Solr connection objects (WapplerSystems\Meilisearch\System\Solr\SolrConnection)
|
* @return MeilisearchConnection[] An array of Meilisearch connection objects (WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection)
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getConnectionsBySite(Site $site)
|
public function getConnectionsBySite(Site $site)
|
||||||
{
|
{
|
||||||
$connections = [];
|
$connections = [];
|
||||||
|
|
||||||
foreach ($site->getAllSolrConnectionConfigurations() as $languageId => $solrConnectionConfiguration) {
|
foreach ($site->getAllMeilisearchConnectionConfigurations() as $languageId => $meilisearchConnectionConfiguration) {
|
||||||
$connections[$languageId] = $this->getConnectionFromConfiguration($solrConnectionConfiguration);
|
$connections[$languageId] = $this->getConnectionFromConfiguration($meilisearchConnectionConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $connections;
|
return $connections;
|
||||||
@ -220,15 +220,15 @@ class ConnectionManager implements SingletonInterface
|
|||||||
/**
|
/**
|
||||||
* @param $pageId
|
* @param $pageId
|
||||||
* @param $language
|
* @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 . '].';
|
$message = 'Could not find a Meilisearch connection for page [' . $pageId . '] and language [' . $language . '].';
|
||||||
$noSolrConnectionException = $this->buildNoConnectionException($message);
|
$noMeilisearchConnectionException = $this->buildNoConnectionException($message);
|
||||||
|
|
||||||
$noSolrConnectionException->setLanguageId($language);
|
$noMeilisearchConnectionException->setLanguageId($language);
|
||||||
return $noSolrConnectionException;
|
return $noMeilisearchConnectionException;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -236,7 +236,7 @@ class ConnectionManager implements SingletonInterface
|
|||||||
*
|
*
|
||||||
* @param Site|null $site
|
* @param Site|null $site
|
||||||
* @param $message
|
* @param $message
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
protected function throwExceptionOnInvalidSite(?Site $site, string $message)
|
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
|
* @param string $message
|
||||||
* @return NoSolrConnectionFoundException
|
* @return NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
protected function buildNoConnectionException(string $message): NoSolrConnectionFoundException
|
protected function buildNoConnectionException(string $message): NoMeilisearchConnectionFoundException
|
||||||
{
|
{
|
||||||
/* @var NoSolrConnectionFoundException $noSolrConnectionException */
|
/* @var NoMeilisearchConnectionFoundException $noMeilisearchConnectionException */
|
||||||
$noSolrConnectionException = GeneralUtility::makeInstance(
|
$noMeilisearchConnectionException = GeneralUtility::makeInstance(
|
||||||
NoSolrConnectionFoundException::class,
|
NoMeilisearchConnectionFoundException::class,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
$message,
|
$message,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
1575396474
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
|
|||||||
*
|
*
|
||||||
* keywords = SOLR_CLASSIFICATION # supports stdWrap
|
* keywords = SOLR_CLASSIFICATION # supports stdWrap
|
||||||
* keywords {
|
* 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 {
|
* classes {
|
||||||
* 1 {
|
* 1 {
|
||||||
* patterns = smartphone, mobile, mobilephone # list of patterns that need to match to assign that class
|
* patterns = smartphone, mobile, mobilephone # list of patterns that need to match to assign that class
|
||||||
|
@ -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
|
* 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>
|
* @author Ingo Renner <ingo@typo3.org>
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@ use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A content object (cObj) to turn comma separated strings into an array to be
|
* 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:
|
* Example usage:
|
||||||
*
|
*
|
||||||
@ -51,7 +51,7 @@ class Multivalue extends AbstractContentObject
|
|||||||
* Executes the SOLR_MULTIVALUE content object.
|
* Executes the SOLR_MULTIVALUE content object.
|
||||||
*
|
*
|
||||||
* Turns a list of values into an array that can then be used to fill
|
* 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.
|
* serialized form as content objects are expected to return strings.
|
||||||
*
|
*
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
@ -17,13 +17,13 @@ namespace WapplerSystems\Meilisearch\Controller;
|
|||||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetService;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetService;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\SearchRequestBuilder;
|
use WapplerSystems\Meilisearch\Domain\Search\SearchRequestBuilder;
|
||||||
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
|
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
|
||||||
use WapplerSystems\Meilisearch\Search;
|
use WapplerSystems\Meilisearch\Search;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\Mvc\Controller\SolrControllerContext;
|
use WapplerSystems\Meilisearch\Mvc\Controller\MeilisearchControllerContext;
|
||||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||||
use WapplerSystems\Meilisearch\System\Service\ConfigurationService;
|
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 WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
|
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
@ -56,9 +56,9 @@ abstract class AbstractBaseController extends ActionController
|
|||||||
protected $configurationManager;
|
protected $configurationManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SolrConfigurationManager
|
* @var MeilisearchConfigurationManager
|
||||||
*/
|
*/
|
||||||
private $solrConfigurationManager;
|
private $meilisearchConfigurationManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration is private if you need it please get it from the controllerContext.
|
* 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;
|
protected $typoScriptConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \WapplerSystems\Meilisearch\Mvc\Controller\SolrControllerContext
|
* @var \WapplerSystems\Meilisearch\Mvc\Controller\MeilisearchControllerContext
|
||||||
*/
|
*/
|
||||||
protected $controllerContext;
|
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()
|
protected function buildControllerContext()
|
||||||
{
|
{
|
||||||
/** @var $controllerContext \WapplerSystems\Meilisearch\Mvc\Controller\SolrControllerContext */
|
/** @var $controllerContext \WapplerSystems\Meilisearch\Mvc\Controller\MeilisearchControllerContext */
|
||||||
$controllerContext = $this->objectManager->get(SolrControllerContext::class);
|
$controllerContext = $this->objectManager->get(MeilisearchControllerContext::class);
|
||||||
$controllerContext->setRequest($this->request);
|
$controllerContext->setRequest($this->request);
|
||||||
$controllerContext->setResponse($this->response);
|
$controllerContext->setResponse($this->response);
|
||||||
if ($this->arguments !== null) {
|
if ($this->arguments !== null) {
|
||||||
@ -159,23 +159,23 @@ abstract class AbstractBaseController extends ActionController
|
|||||||
{
|
{
|
||||||
// Reset configuration (to reset flexform overrides) if resetting is enabled
|
// Reset configuration (to reset flexform overrides) if resetting is enabled
|
||||||
if ($this->resetConfigurationBeforeInitialize) {
|
if ($this->resetConfigurationBeforeInitialize) {
|
||||||
$this->solrConfigurationManager->reset();
|
$this->meilisearchConfigurationManager->reset();
|
||||||
}
|
}
|
||||||
/** @var TypoScriptService $typoScriptService */
|
/** @var TypoScriptService $typoScriptService */
|
||||||
$typoScriptService = $this->objectManager->get(TypoScriptService::class);
|
$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);
|
$frameWorkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
|
||||||
$pluginSettings = [];
|
$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])) {
|
if (isset($frameWorkConfiguration[$key])) {
|
||||||
$pluginSettings[$key] = $frameWorkConfiguration[$key];
|
$pluginSettings[$key] = $frameWorkConfiguration[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->typoScriptConfiguration = $this->solrConfigurationManager->getTypoScriptConfiguration();
|
$this->typoScriptConfiguration = $this->meilisearchConfigurationManager->getTypoScriptConfiguration();
|
||||||
if ($pluginSettings !== []) {
|
if ($pluginSettings !== []) {
|
||||||
$this->typoScriptConfiguration->mergeSolrConfiguration(
|
$this->typoScriptConfiguration->mergeMeilisearchConfiguration(
|
||||||
$typoScriptService->convertPlainArrayToTypoScriptArray($pluginSettings),
|
$typoScriptService->convertPlainArrayToTypoScriptArray($pluginSettings),
|
||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
@ -192,7 +192,7 @@ abstract class AbstractBaseController extends ActionController
|
|||||||
$this->typoScriptFrontendController = $GLOBALS['TSFE'];
|
$this->typoScriptFrontendController = $GLOBALS['TSFE'];
|
||||||
$this->initializeSettings();
|
$this->initializeSettings();
|
||||||
|
|
||||||
if ($this->actionMethodName !== 'solrNotAvailableAction') {
|
if ($this->actionMethodName !== 'meilisearchNotAvailableAction') {
|
||||||
$this->initializeSearch();
|
$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
|
* test the connection through a ping
|
||||||
*/
|
*/
|
||||||
protected function initializeSearch()
|
protected function initializeSearch()
|
||||||
{
|
{
|
||||||
/** @var \WapplerSystems\Meilisearch\ConnectionManager $solrConnection */
|
/** @var \WapplerSystems\Meilisearch\ConnectionManager $meilisearchConnection */
|
||||||
try {
|
try {
|
||||||
$solrConnection = $this->objectManager->get(ConnectionManager::class)->getConnectionByPageId($this->typoScriptFrontendController->id, Util::getLanguageUid(), $this->typoScriptFrontendController->MP);
|
$meilisearchConnection = $this->objectManager->get(ConnectionManager::class)->getConnectionByPageId($this->typoScriptFrontendController->id, Util::getLanguageUid(), $this->typoScriptFrontendController->MP);
|
||||||
$search = $this->objectManager->get(Search::class, $solrConnection);
|
$search = $this->objectManager->get(Search::class, $meilisearchConnection);
|
||||||
|
|
||||||
$this->searchService = $this->objectManager->get(
|
$this->searchService = $this->objectManager->get(
|
||||||
SearchResultSetService::class,
|
SearchResultSetService::class,
|
||||||
/** @scrutinizer ignore-type */ $this->typoScriptConfiguration,
|
/** @scrutinizer ignore-type */ $this->typoScriptConfiguration,
|
||||||
/** @scrutinizer ignore-type */ $search
|
/** @scrutinizer ignore-type */ $search
|
||||||
);
|
);
|
||||||
} catch (NoSolrConnectionFoundException $e) {
|
} catch (NoMeilisearchConnectionFoundException $e) {
|
||||||
$this->handleSolrUnavailable();
|
$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
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function handleSolrUnavailable()
|
protected function handleMeilisearchUnavailable()
|
||||||
{
|
{
|
||||||
if ($this->typoScriptConfiguration->getLoggingExceptions()) {
|
if ($this->typoScriptConfiguration->getLoggingExceptions()) {
|
||||||
/** @var SolrLogManager $logger */
|
/** @var MeilisearchLogManager $logger */
|
||||||
$logger = GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
$logger = GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
||||||
$logger->log(SolrLogManager::ERROR, 'Solr server is not available');
|
$logger->log(MeilisearchLogManager::ERROR, 'Meilisearch server is not available');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* 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\ConnectionManager;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
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\Component\Exception\InvalidViewObjectNameException;
|
||||||
use WapplerSystems\Meilisearch\System\Mvc\Backend\Service\ModuleDataStorageService;
|
use WapplerSystems\Meilisearch\System\Mvc\Backend\Service\ModuleDataStorageService;
|
||||||
use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
|
use TYPO3\CMS\Backend\Template\Components\Menu\Menu;
|
||||||
@ -81,9 +81,9 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
protected $siteRepository;
|
protected $siteRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SolrCoreConnection
|
* @var MeilisearchCoreConnection
|
||||||
*/
|
*/
|
||||||
protected $selectedSolrCoreConnection;
|
protected $selectedMeilisearchCoreConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Menu
|
* @var Menu
|
||||||
@ -93,7 +93,7 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
/**
|
/**
|
||||||
* @var ConnectionManager
|
* @var ConnectionManager
|
||||||
*/
|
*/
|
||||||
protected $solrConnectionManager = null;
|
protected $meilisearchConnectionManager = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ModuleDataStorageService
|
* @var ModuleDataStorageService
|
||||||
@ -122,7 +122,7 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
protected function initializeAction()
|
protected function initializeAction()
|
||||||
{
|
{
|
||||||
parent::initializeAction();
|
parent::initializeAction();
|
||||||
$this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
|
$this->meilisearchConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
|
||||||
$this->moduleDataStorageService = GeneralUtility::makeInstance(ModuleDataStorageService::class);
|
$this->moduleDataStorageService = GeneralUtility::makeInstance(ModuleDataStorageService::class);
|
||||||
|
|
||||||
$this->selectedPageUID = (int)GeneralUtility::_GP('id');
|
$this->selectedPageUID = (int)GeneralUtility::_GP('id');
|
||||||
@ -213,7 +213,7 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->view instanceof NotFoundView) {
|
if ($this->view instanceof NotFoundView) {
|
||||||
$this->initializeSelectedSolrCoreConnection();
|
$this->initializeSelectedMeilisearchCoreConnection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,8 +244,8 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
$uriToRedirectTo = $this->uriBuilder->reset()->uriFor();
|
$uriToRedirectTo = $this->uriBuilder->reset()->uriFor();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->initializeSelectedSolrCoreConnection();
|
$this->initializeSelectedMeilisearchCoreConnection();
|
||||||
$cores = $this->solrConnectionManager->getConnectionsBySite($site);
|
$cores = $this->meilisearchConnectionManager->getConnectionsBySite($site);
|
||||||
foreach ($cores as $core) {
|
foreach ($cores as $core) {
|
||||||
$coreAdmin = $core->getAdminService();
|
$coreAdmin = $core->getAdminService();
|
||||||
$menuItem = $this->coreSelectorMenu->makeMenuItem();
|
$menuItem = $this->coreSelectorMenu->makeMenuItem();
|
||||||
@ -258,7 +258,7 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
);
|
);
|
||||||
$menuItem->setHref($uri);
|
$menuItem->setHref($uri);
|
||||||
|
|
||||||
if ($coreAdmin->getCorePath() == $this->selectedSolrCoreConnection->getAdminService()->getCorePath()) {
|
if ($coreAdmin->getCorePath() == $this->selectedMeilisearchCoreConnection->getAdminService()->getCorePath()) {
|
||||||
$menuItem->setActive(true);
|
$menuItem->setActive(true);
|
||||||
}
|
}
|
||||||
$this->coreSelectorMenu->addMenuItem($menuItem);
|
$this->coreSelectorMenu->addMenuItem($menuItem);
|
||||||
@ -281,48 +281,48 @@ abstract class AbstractModuleController extends ActionController
|
|||||||
$moduleData->setCore($corePath);
|
$moduleData->setCore($corePath);
|
||||||
|
|
||||||
$this->moduleDataStorageService->persistModuleData($moduleData);
|
$this->moduleDataStorageService->persistModuleData($moduleData);
|
||||||
$message = LocalizationUtility::translate('coreselector_switched_successfully', 'solr', [$corePath]);
|
$message = LocalizationUtility::translate('coreselector_switched_successfully', 'meilisearch', [$corePath]);
|
||||||
$this->addFlashMessage($message);
|
$this->addFlashMessage($message);
|
||||||
$this->redirectToUri($uriToRedirectTo);
|
$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.
|
* Uses and persists default core connection if persisted core in Site does not exist.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function initializeSelectedSolrCoreConnection()
|
private function initializeSelectedMeilisearchCoreConnection()
|
||||||
{
|
{
|
||||||
$moduleData = $this->moduleDataStorageService->loadModuleData();
|
$moduleData = $this->moduleDataStorageService->loadModuleData();
|
||||||
|
|
||||||
$solrCoreConnections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
|
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||||
$currentSolrCorePath = $moduleData->getCore();
|
$currentMeilisearchCorePath = $moduleData->getCore();
|
||||||
if (empty($currentSolrCorePath)) {
|
if (empty($currentMeilisearchCorePath)) {
|
||||||
$this->initializeFirstAvailableSolrCoreConnection($solrCoreConnections, $moduleData);
|
$this->initializeFirstAvailableMeilisearchCoreConnection($meilisearchCoreConnections, $moduleData);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($solrCoreConnections as $solrCoreConnection) {
|
foreach ($meilisearchCoreConnections as $meilisearchCoreConnection) {
|
||||||
if ($solrCoreConnection->getAdminService()->getCorePath() == $currentSolrCorePath) {
|
if ($meilisearchCoreConnection->getAdminService()->getCorePath() == $currentMeilisearchCorePath) {
|
||||||
$this->selectedSolrCoreConnection = $solrCoreConnection;
|
$this->selectedMeilisearchCoreConnection = $meilisearchCoreConnection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->selectedSolrCoreConnection instanceof SolrCoreConnection && count($solrCoreConnections) > 0) {
|
if (!$this->selectedMeilisearchCoreConnection instanceof MeilisearchCoreConnection && count($meilisearchCoreConnections) > 0) {
|
||||||
$this->initializeFirstAvailableSolrCoreConnection($solrCoreConnections, $moduleData);
|
$this->initializeFirstAvailableMeilisearchCoreConnection($meilisearchCoreConnections, $moduleData);
|
||||||
$message = LocalizationUtility::translate('coreselector_switched_to_default_core', 'solr', [$currentSolrCorePath, $this->selectedSite->getLabel(), $this->selectedSolrCoreConnection->getAdminService()->getCorePath()]);
|
$message = LocalizationUtility::translate('coreselector_switched_to_default_core', 'meilisearch', [$currentMeilisearchCorePath, $this->selectedSite->getLabel(), $this->selectedMeilisearchCoreConnection->getAdminService()->getCorePath()]);
|
||||||
$this->addFlashMessage($message, '', AbstractMessage::NOTICE);
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
$this->selectedSolrCoreConnection = $solrCoreConnections[0];
|
$this->selectedMeilisearchCoreConnection = $meilisearchCoreConnections[0];
|
||||||
$moduleData->setCore($this->selectedSolrCoreConnection->getAdminService()->getCorePath());
|
$moduleData->setCore($this->selectedMeilisearchCoreConnection->getAdminService()->getCorePath());
|
||||||
$this->moduleDataStorageService->persistModuleData($moduleData);
|
$this->moduleDataStorageService->persistModuleData($moduleData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
@ -60,13 +60,13 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
if ($this->selectedSolrCoreConnection === null) {
|
if ($this->selectedMeilisearchCoreConnection === null) {
|
||||||
$this->view->assign('can_not_proceed', true);
|
$this->view->assign('can_not_proceed', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$synonyms = [];
|
$synonyms = [];
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$rawSynonyms = $coreAdmin->getSynonyms();
|
$rawSynonyms = $coreAdmin->getSynonyms();
|
||||||
foreach ($rawSynonyms as $baseWord => $synonymList) {
|
foreach ($rawSynonyms as $baseWord => $synonymList) {
|
||||||
$synonyms[$baseWord] = implode(', ', $synonymList);
|
$synonyms[$baseWord] = implode(', ', $synonymList);
|
||||||
@ -100,7 +100,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
$baseWord = mb_strtolower($baseWord);
|
$baseWord = mb_strtolower($baseWord);
|
||||||
$synonyms = mb_strtolower($synonyms);
|
$synonyms = mb_strtolower($synonyms);
|
||||||
|
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
if ($overrideExisting && $coreAdmin->getSynonyms($baseWord)) {
|
if ($overrideExisting && $coreAdmin->getSynonyms($baseWord)) {
|
||||||
$coreAdmin->deleteSynonym($baseWord);
|
$coreAdmin->deleteSynonym($baseWord);
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
public function exportStopWordsAction($fileFormat = 'txt')
|
public function exportStopWordsAction($fileFormat = 'txt')
|
||||||
{
|
{
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$this->exportFile(
|
$this->exportFile(
|
||||||
implode(PHP_EOL, $coreAdmin->getStopWords()),
|
implode(PHP_EOL, $coreAdmin->getStopWords()),
|
||||||
'stopwords',
|
'stopwords',
|
||||||
@ -137,7 +137,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
public function exportSynonymsAction($fileFormat = 'txt')
|
public function exportSynonymsAction($fileFormat = 'txt')
|
||||||
{
|
{
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$synonyms = $coreAdmin->getSynonyms();
|
$synonyms = $coreAdmin->getSynonyms();
|
||||||
return $this->exportFile(ManagedResourcesUtility::exportSynonymsToTxt($synonyms), 'synonyms', $fileFormat);
|
return $this->exportFile(ManagedResourcesUtility::exportSynonymsToTxt($synonyms), 'synonyms', $fileFormat);
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
$fileLines = ManagedResourcesUtility::importSynonymsFromPlainTextContents($synonymFileUpload);
|
$fileLines = ManagedResourcesUtility::importSynonymsFromPlainTextContents($synonymFileUpload);
|
||||||
$synonymCount = 0;
|
$synonymCount = 0;
|
||||||
|
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
foreach ($fileLines as $baseWord => $synonyms) {
|
foreach ($fileLines as $baseWord => $synonyms) {
|
||||||
if (!isset($baseWord) || empty($synonyms)) {
|
if (!isset($baseWord) || empty($synonyms)) {
|
||||||
continue;
|
continue;
|
||||||
@ -197,7 +197,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
{
|
{
|
||||||
$allSynonymsCouldBeDeleted = $this->deleteAllSynonyms();
|
$allSynonymsCouldBeDeleted = $this->deleteAllSynonyms();
|
||||||
|
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$reloadResponse = $coreAdmin->reloadCore();
|
$reloadResponse = $coreAdmin->reloadCore();
|
||||||
|
|
||||||
if ($allSynonymsCouldBeDeleted
|
if ($allSynonymsCouldBeDeleted
|
||||||
@ -223,7 +223,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
public function deleteSynonymsAction($baseWord)
|
public function deleteSynonymsAction($baseWord)
|
||||||
{
|
{
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$deleteResponse = $coreAdmin->deleteSynonym($baseWord);
|
$deleteResponse = $coreAdmin->deleteSynonym($baseWord);
|
||||||
$reloadResponse = $coreAdmin->reloadCore();
|
$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 string $stopWords
|
||||||
* @param bool $replaceStopwords
|
* @param bool $replaceStopwords
|
||||||
@ -257,7 +257,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
$newStopWords = mb_strtolower($stopWords);
|
$newStopWords = mb_strtolower($stopWords);
|
||||||
$newStopWords = GeneralUtility::trimExplode("\n", $newStopWords, true);
|
$newStopWords = GeneralUtility::trimExplode("\n", $newStopWords, true);
|
||||||
|
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$oldStopWords = $coreAdmin->getStopWords();
|
$oldStopWords = $coreAdmin->getStopWords();
|
||||||
|
|
||||||
if ($replaceStopwords) {
|
if ($replaceStopwords) {
|
||||||
@ -292,7 +292,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
protected function exportFile($content, $type = 'synonyms', $fileExtension = 'txt') : string
|
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('Content-type', 'text/plain', true);
|
||||||
$this->response->setHeader('Cache-control', 'public', 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
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function deleteAllSynonyms() : bool
|
protected function deleteAllSynonyms() : bool
|
||||||
{
|
{
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
$synonyms = $coreAdmin->getSynonyms();
|
$synonyms = $coreAdmin->getSynonyms();
|
||||||
$allSynonymsCouldBeDeleted = true;
|
$allSynonymsCouldBeDeleted = true;
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
protected function removeStopsWordsFromIndex($stopwordsToRemove) : bool
|
protected function removeStopsWordsFromIndex($stopwordsToRemove) : bool
|
||||||
{
|
{
|
||||||
$wordsRemoved = true;
|
$wordsRemoved = true;
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
|
|
||||||
foreach ($stopwordsToRemove as $word) {
|
foreach ($stopwordsToRemove as $word) {
|
||||||
$response = $coreAdmin->deleteStopWord($word);
|
$response = $coreAdmin->deleteStopWord($word);
|
||||||
@ -373,7 +373,7 @@ class CoreOptimizationModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
protected function deleteExistingSynonym($overrideExisting, $deleteSynonymsBefore, $baseWord)
|
protected function deleteExistingSynonym($overrideExisting, $deleteSynonymsBefore, $baseWord)
|
||||||
{
|
{
|
||||||
$coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
|
$coreAdmin = $this->selectedMeilisearchCoreConnection->getAdminService();
|
||||||
|
|
||||||
if (!$deleteSynonymsBefore &&
|
if (!$deleteSynonymsBefore &&
|
||||||
$overrideExisting &&
|
$overrideExisting &&
|
||||||
|
@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
|
|||||||
|
|
||||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||||
use WapplerSystems\Meilisearch\IndexQueue\Queue;
|
use WapplerSystems\Meilisearch\IndexQueue\Queue;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder;
|
use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder;
|
||||||
use TYPO3\CMS\Core\Messaging\FlashMessage;
|
use TYPO3\CMS\Core\Messaging\FlashMessage;
|
||||||
@ -50,14 +50,14 @@ class IndexAdministrationModuleController extends AbstractModuleController
|
|||||||
/**
|
/**
|
||||||
* @var ConnectionManager
|
* @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();
|
parent::initializeAction();
|
||||||
$this->indexQueue = GeneralUtility::makeInstance(Queue::class);
|
$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()
|
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);
|
$this->view->assign('can_not_proceed', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,18 +93,18 @@ class IndexAdministrationModuleController extends AbstractModuleController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$affectedCores = [];
|
$affectedCores = [];
|
||||||
$solrServers = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
|
$meilisearchServers = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||||
foreach ($solrServers as $solrServer) {
|
foreach ($meilisearchServers as $meilisearchServer) {
|
||||||
$writeService = $solrServer->getWriteService();
|
$writeService = $meilisearchServer->getWriteService();
|
||||||
/* @var $solrServer SolrConnection */
|
/* @var $meilisearchServer MeilisearchConnection */
|
||||||
$writeService->deleteByQuery('siteHash:' . $siteHash);
|
$writeService->deleteByQuery('siteHash:' . $siteHash);
|
||||||
$writeService->commit(false, false, false);
|
$writeService->commit(false, false, false);
|
||||||
$affectedCores[] = $writeService->getPrimaryEndpoint()->getCore();
|
$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);
|
$this->addFlashMessage($message);
|
||||||
} catch (\Exception $e) {
|
} 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');
|
$this->redirect('index');
|
||||||
@ -119,14 +119,14 @@ class IndexAdministrationModuleController extends AbstractModuleController
|
|||||||
{
|
{
|
||||||
$this->indexQueue->deleteItemsBySite($this->selectedSite);
|
$this->indexQueue->deleteItemsBySite($this->selectedSite);
|
||||||
$this->addFlashMessage(
|
$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->selectedSite->getLabel()])
|
||||||
);
|
);
|
||||||
$this->redirectToReferrerModule();
|
$this->redirectToReferrerModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads the site's Solr cores.
|
* Reloads the site's Meilisearch cores.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -134,11 +134,11 @@ class IndexAdministrationModuleController extends AbstractModuleController
|
|||||||
{
|
{
|
||||||
$coresReloaded = true;
|
$coresReloaded = true;
|
||||||
$reloadedCores = [];
|
$reloadedCores = [];
|
||||||
$solrServers = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
|
$meilisearchServers = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||||
|
|
||||||
foreach ($solrServers as $solrServer) {
|
foreach ($meilisearchServers as $meilisearchServer) {
|
||||||
/* @var $solrServer SolrConnection */
|
/* @var $meilisearchServer MeilisearchConnection */
|
||||||
$coreAdmin = $solrServer->getAdminService();
|
$coreAdmin = $meilisearchServer->getAdminService();
|
||||||
$coreReloaded = $coreAdmin->reloadCore()->getHttpStatus() === 200;
|
$coreReloaded = $coreAdmin->reloadCore()->getHttpStatus() === 200;
|
||||||
|
|
||||||
$coreName = $coreAdmin->getPrimaryEndpoint()->getCore();
|
$coreName = $coreAdmin->getPrimaryEndpoint()->getCore();
|
||||||
@ -188,7 +188,7 @@ class IndexAdministrationModuleController extends AbstractModuleController
|
|||||||
$backendUriBuilder = GeneralUtility::makeInstance(BackendUriBuilder::class);
|
$backendUriBuilder = GeneralUtility::makeInstance(BackendUriBuilder::class);
|
||||||
|
|
||||||
$parameters = ['id' => $this->selectedPageUID];
|
$parameters = ['id' => $this->selectedPageUID];
|
||||||
$referringUri = $backendUriBuilder->buildUriFromRoute('searchbackend_SolrIndexqueue', $parameters);
|
$referringUri = $backendUriBuilder->buildUriFromRoute('searchbackend_MeilisearchIndexqueue', $parameters);
|
||||||
|
|
||||||
$this->redirectToUri($referringUri);
|
$this->redirectToUri($referringUri);
|
||||||
}
|
}
|
||||||
|
@ -114,10 +114,10 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
protected function canQueueSelectedSite()
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
$enabledIndexQueueConfigurationNames = $this->selectedSite->getSolrConfiguration()->getEnabledIndexQueueConfigurationNames();
|
$enabledIndexQueueConfigurationNames = $this->selectedSite->getMeilisearchConfiguration()->getEnabledIndexQueueConfigurationNames();
|
||||||
if (empty($enabledIndexQueueConfigurationNames)) {
|
if (empty($enabledIndexQueueConfigurationNames)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -153,11 +153,11 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
// initialize selected indexing configuration
|
// initialize selected indexing configuration
|
||||||
$initializedIndexingConfigurations = $this->indexQueue->getInitializationService()->initializeBySiteAndIndexConfigurations($this->selectedSite, $indexingConfigurationsToInitialize);
|
$initializedIndexingConfigurations = $this->indexQueue->getInitializationService()->initializeBySiteAndIndexConfigurations($this->selectedSite, $indexingConfigurationsToInitialize);
|
||||||
} else {
|
} else {
|
||||||
$messageLabel = 'solr.backend.index_queue_module.flashmessage.initialize.no_selection';
|
$messageLabel = 'meilisearch.backend.index_queue_module.flashmessage.initialize.no_selection';
|
||||||
$titleLabel = 'solr.backend.index_queue_module.flashmessage.not_initialized.title';
|
$titleLabel = 'meilisearch.backend.index_queue_module.flashmessage.not_initialized.title';
|
||||||
$this->addFlashMessage(
|
$this->addFlashMessage(
|
||||||
LocalizationUtility::translate($messageLabel, 'Solr'),
|
LocalizationUtility::translate($messageLabel, 'Meilisearch'),
|
||||||
LocalizationUtility::translate($titleLabel, 'Solr'),
|
LocalizationUtility::translate($titleLabel, 'Meilisearch'),
|
||||||
FlashMessage::WARNING
|
FlashMessage::WARNING
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -168,11 +168,11 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($initializedIndexingConfigurations)) {
|
if (!empty($initializedIndexingConfigurations)) {
|
||||||
$messageLabel = 'solr.backend.index_queue_module.flashmessage.initialize.success';
|
$messageLabel = 'meilisearch.backend.index_queue_module.flashmessage.initialize.success';
|
||||||
$titleLabel = 'solr.backend.index_queue_module.flashmessage.initialize.title';
|
$titleLabel = 'meilisearch.backend.index_queue_module.flashmessage.initialize.title';
|
||||||
$this->addFlashMessage(
|
$this->addFlashMessage(
|
||||||
LocalizationUtility::translate($messageLabel, 'Solr', [implode(', ', $messagesForConfigurations)]),
|
LocalizationUtility::translate($messageLabel, 'Meilisearch', [implode(', ', $messagesForConfigurations)]),
|
||||||
LocalizationUtility::translate($titleLabel, 'Solr'),
|
LocalizationUtility::translate($titleLabel, 'Meilisearch'),
|
||||||
FlashMessage::OK
|
FlashMessage::OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -189,10 +189,10 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
{
|
{
|
||||||
$resetResult = $this->indexQueue->resetAllErrors();
|
$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;
|
$severity = FlashMessage::OK;
|
||||||
if (!$resetResult) {
|
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;
|
$severity = FlashMessage::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,12 +211,12 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
public function requeueDocumentAction(string $type, int $uid)
|
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;
|
$severity = FlashMessage::ERROR;
|
||||||
|
|
||||||
$updateCount = $this->indexQueue->updateItem($type, $uid, time());
|
$updateCount = $this->indexQueue->updateItem($type, $uid, time());
|
||||||
if ($updateCount > 0) {
|
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;
|
$severity = FlashMessage::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
{
|
{
|
||||||
if (is_null($indexQueueItemId)) {
|
if (is_null($indexQueueItemId)) {
|
||||||
// add a flash message and quit
|
// 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;
|
$severity = FlashMessage::ERROR;
|
||||||
$this->addIndexQueueFlashMessage($label, $severity);
|
$this->addIndexQueueFlashMessage($label, $severity);
|
||||||
|
|
||||||
@ -258,16 +258,16 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
$indexService = GeneralUtility::makeInstance(IndexService::class, /** @scrutinizer ignore-type */ $this->selectedSite);
|
$indexService = GeneralUtility::makeInstance(IndexService::class, /** @scrutinizer ignore-type */ $this->selectedSite);
|
||||||
$indexWithoutErrors = $indexService->indexItems(10);
|
$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;
|
$severity = FlashMessage::OK;
|
||||||
if (!$indexWithoutErrors) {
|
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;
|
$severity = FlashMessage::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addFlashMessage(
|
$this->addFlashMessage(
|
||||||
LocalizationUtility::translate($label, 'Solr'),
|
LocalizationUtility::translate($label, 'Meilisearch'),
|
||||||
LocalizationUtility::translate('solr.backend.index_queue_module.flashmessage.index_manual', 'Solr'),
|
LocalizationUtility::translate('meilisearch.backend.index_queue_module.flashmessage.index_manual', 'Meilisearch'),
|
||||||
$severity
|
$severity
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -282,6 +282,6 @@ class IndexQueueModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
protected function addIndexQueueFlashMessage($label, $severity)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Controller\Backend\Search;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* 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\Api;
|
||||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\Statistics\StatisticsRepository;
|
use WapplerSystems\Meilisearch\Domain\Search\Statistics\StatisticsRepository;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ApacheSolrDocument\Repository;
|
use WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument\Repository;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||||
use WapplerSystems\Meilisearch\System\Validator\Path;
|
use WapplerSystems\Meilisearch\System\Validator\Path;
|
||||||
use TYPO3\CMS\Backend\Template\ModuleTemplate;
|
use TYPO3\CMS\Backend\Template\ModuleTemplate;
|
||||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||||
@ -46,12 +46,12 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
/**
|
/**
|
||||||
* @var ConnectionManager
|
* @var ConnectionManager
|
||||||
*/
|
*/
|
||||||
protected $solrConnectionManager;
|
protected $meilisearchConnectionManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Repository
|
* @var Repository
|
||||||
*/
|
*/
|
||||||
protected $apacheSolrDocumentRepository;
|
protected $apacheMeilisearchDocumentRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the controller before invoking an action method.
|
* Initializes the controller before invoking an action method.
|
||||||
@ -59,8 +59,8 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
protected function initializeAction()
|
protected function initializeAction()
|
||||||
{
|
{
|
||||||
parent::initializeAction();
|
parent::initializeAction();
|
||||||
$this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
|
$this->meilisearchConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
|
||||||
$this->apacheSolrDocumentRepository = GeneralUtility::makeInstance(Repository::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
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -106,12 +106,12 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
public function documentsDetailsAction(string $type, int $uid, int $pageId, int $languageUid)
|
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);
|
$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.
|
* flash message according to the result of the check.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@ -124,7 +124,7 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
|
|
||||||
/* @var Path $path */
|
/* @var Path $path */
|
||||||
$path = GeneralUtility::makeInstance(Path::class);
|
$path = GeneralUtility::makeInstance(Path::class);
|
||||||
$connections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
|
$connections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||||
|
|
||||||
if (empty($connections)) {
|
if (empty($connections)) {
|
||||||
$this->view->assign('can_not_proceed', true);
|
$this->view->assign('can_not_proceed', true);
|
||||||
@ -141,7 +141,7 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
$missingHosts[] = $coreUrl;
|
$missingHosts[] = $coreUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$path->isValidSolrPath($coreAdmin->getCorePath())) {
|
if (!$path->isValidMeilisearchPath($coreAdmin->getCorePath())) {
|
||||||
$invalidPaths[] = $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
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -204,9 +204,9 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
{
|
{
|
||||||
$indexFieldsInfoByCorePaths = [];
|
$indexFieldsInfoByCorePaths = [];
|
||||||
|
|
||||||
$solrCoreConnections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
|
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||||
foreach ($solrCoreConnections as $solrCoreConnection) {
|
foreach ($meilisearchCoreConnections as $meilisearchCoreConnection) {
|
||||||
$coreAdmin = $solrCoreConnection->getAdminService();
|
$coreAdmin = $meilisearchCoreConnection->getAdminService();
|
||||||
|
|
||||||
$indexFieldsInfo = [
|
$indexFieldsInfo = [
|
||||||
'corePath' => $coreAdmin->getCorePath()
|
'corePath' => $coreAdmin->getCorePath()
|
||||||
@ -239,7 +239,7 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
|
|
||||||
$this->addFlashMessage(
|
$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
|
FlashMessage::ERROR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -255,11 +255,11 @@ class InfoModuleController extends AbstractModuleController
|
|||||||
*/
|
*/
|
||||||
protected function collectIndexInspectorInfo()
|
protected function collectIndexInspectorInfo()
|
||||||
{
|
{
|
||||||
$solrCoreConnections = $this->solrConnectionManager->getConnectionsBySite($this->selectedSite);
|
$meilisearchCoreConnections = $this->meilisearchConnectionManager->getConnectionsBySite($this->selectedSite);
|
||||||
$documentsByCoreAndType = [];
|
$documentsByCoreAndType = [];
|
||||||
foreach ($solrCoreConnections as $languageId => $solrCoreConnection) {
|
foreach ($meilisearchCoreConnections as $languageId => $meilisearchCoreConnection) {
|
||||||
$coreAdmin = $solrCoreConnection->getAdminService();
|
$coreAdmin = $meilisearchCoreConnection->getAdminService();
|
||||||
$documents = $this->apacheSolrDocumentRepository->findByPageIdAndByLanguageId($this->selectedPageUID, $languageId);
|
$documents = $this->apacheMeilisearchDocumentRepository->findByPageIdAndByLanguageId($this->selectedPageUID, $languageId);
|
||||||
|
|
||||||
$documentsByType = [];
|
$documentsByType = [];
|
||||||
foreach ($documents as $document) {
|
foreach ($documents as $document) {
|
||||||
|
@ -15,8 +15,8 @@ namespace WapplerSystems\Meilisearch\Controller;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
||||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrUnavailableException;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchUnavailableException;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
|
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
|
||||||
use TYPO3\CMS\Extbase\Mvc\Web\Response;
|
use TYPO3\CMS\Extbase\Mvc\Web\Response;
|
||||||
@ -115,8 +115,8 @@ class SearchController extends AbstractBaseController
|
|||||||
$values = $this->emitActionSignal(__CLASS__, __FUNCTION__, [$values]);
|
$values = $this->emitActionSignal(__CLASS__, __FUNCTION__, [$values]);
|
||||||
|
|
||||||
$this->view->assignMultiple($values);
|
$this->view->assignMultiple($values);
|
||||||
} catch (SolrUnavailableException $e) {
|
} catch (MeilisearchUnavailableException $e) {
|
||||||
$this->handleSolrUnavailable();
|
$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
|
* @param string $documentId
|
||||||
*/
|
*/
|
||||||
@ -170,8 +170,8 @@ class SearchController extends AbstractBaseController
|
|||||||
try {
|
try {
|
||||||
$document = $this->searchService->getDocumentById($documentId);
|
$document = $this->searchService->getDocumentById($documentId);
|
||||||
$this->view->assign('document', $document);
|
$this->view->assign('document', $document);
|
||||||
} catch (SolrUnavailableException $e) {
|
} catch (MeilisearchUnavailableException $e) {
|
||||||
$this->handleSolrUnavailable();
|
$this->handleMeilisearchUnavailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ class SearchController extends AbstractBaseController
|
|||||||
* Rendered when no search is available.
|
* Rendered when no search is available.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function solrNotAvailableAction()
|
public function meilisearchNotAvailableAction()
|
||||||
{
|
{
|
||||||
if ($this->response instanceof Response) {
|
if ($this->response instanceof Response) {
|
||||||
$this->response->setStatus(503);
|
$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
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function handleSolrUnavailable()
|
protected function handleMeilisearchUnavailable()
|
||||||
{
|
{
|
||||||
parent::handleSolrUnavailable();
|
parent::handleMeilisearchUnavailable();
|
||||||
$this->forward('solrNotAvailable');
|
$this->forward('meilisearchNotAvailable');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Controller;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\Suggest\SuggestService;
|
use WapplerSystems\Meilisearch\Domain\Search\Suggest\SuggestService;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrUnavailableException;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchUnavailableException;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
|
|
||||||
@ -66,16 +66,14 @@ class SuggestController extends AbstractBaseController
|
|||||||
|
|
||||||
$searchRequest = $this->getSearchRequestBuilder()->buildForSuggest($arguments, $rawQuery, $pageId, $languageId);
|
$searchRequest = $this->getSearchRequestBuilder()->buildForSuggest($arguments, $rawQuery, $pageId, $languageId);
|
||||||
$result = $suggestService->getSuggestions($searchRequest, $additionalFilters);
|
$result = $suggestService->getSuggestions($searchRequest, $additionalFilters);
|
||||||
} catch (SolrUnavailableException $e) {
|
} catch (MeilisearchUnavailableException $e) {
|
||||||
$this->handleSolrUnavailable();
|
$this->handleMeilisearchUnavailable();
|
||||||
$result = ['status' => false];
|
$result = ['status' => false];
|
||||||
}
|
}
|
||||||
if ($callback) {
|
if ($callback) {
|
||||||
return htmlspecialchars($callback) . '(' . json_encode($result) . ')';
|
return htmlspecialchars($callback) . '(' . json_encode($result) . ')';
|
||||||
}
|
}
|
||||||
else {
|
return json_encode($result);
|
||||||
return json_encode($result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Classification;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Classification;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
|
@ -31,7 +31,7 @@ use WapplerSystems\Meilisearch\IndexQueue\Item;
|
|||||||
use WapplerSystems\Meilisearch\IndexQueue\Queue;
|
use WapplerSystems\Meilisearch\IndexQueue\Queue;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||||
use WapplerSystems\Meilisearch\Task\IndexQueueWorkerTask;
|
use WapplerSystems\Meilisearch\Task\IndexQueueWorkerTask;
|
||||||
use Solarium\Exception\HttpException;
|
use Solarium\Exception\HttpException;
|
||||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||||
@ -71,7 +71,7 @@ class IndexService
|
|||||||
protected $signalSlotDispatcher;
|
protected $signalSlotDispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \WapplerSystems\Meilisearch\System\Logging\SolrLogManager
|
* @var \WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager
|
||||||
*/
|
*/
|
||||||
protected $logger = null;
|
protected $logger = null;
|
||||||
|
|
||||||
@ -80,14 +80,14 @@ class IndexService
|
|||||||
* @param Site $site
|
* @param Site $site
|
||||||
* @param Queue|null $queue
|
* @param Queue|null $queue
|
||||||
* @param Dispatcher|null $dispatcher
|
* @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->site = $site;
|
||||||
$this->indexQueue = $queue ?? GeneralUtility::makeInstance(Queue::class);
|
$this->indexQueue = $queue ?? GeneralUtility::makeInstance(Queue::class);
|
||||||
$this->signalSlotDispatcher = $dispatcher ?? GeneralUtility::makeInstance(Dispatcher::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;
|
$errors = 0;
|
||||||
$indexRunId = uniqid();
|
$indexRunId = uniqid();
|
||||||
$configurationToUse = $this->site->getSolrConfiguration();
|
$configurationToUse = $this->site->getMeilisearchConfiguration();
|
||||||
$enableCommitsSetting = $configurationToUse->getEnableCommits();
|
$enableCommitsSetting = $configurationToUse->getEnableCommits();
|
||||||
|
|
||||||
// get items to index
|
// get items to index
|
||||||
@ -140,10 +140,10 @@ class IndexService
|
|||||||
$this->emitSignal('afterIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);
|
$this->emitSignal('afterIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);
|
||||||
|
|
||||||
if ($enableCommitsSetting && count($itemsToIndex) > 0) {
|
if ($enableCommitsSetting && count($itemsToIndex) > 0) {
|
||||||
$solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
|
$meilisearchServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
|
||||||
foreach ($solrServers as $solrServer) {
|
foreach ($meilisearchServers as $meilisearchServer) {
|
||||||
try {
|
try {
|
||||||
$solrServer->getWriteService()->commit(false, false, false);
|
$meilisearchServer->getWriteService()->commit(false, false, false);
|
||||||
} catch (HttpException $e) {
|
} catch (HttpException $e) {
|
||||||
$errors++;
|
$errors++;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ class IndexService
|
|||||||
$data = ['code' => $e->getCode(), 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString(), 'item' => (array)$itemToIndex];
|
$data = ['code' => $e->getCode(), 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString(), 'item' => (array)$itemToIndex];
|
||||||
|
|
||||||
$this->logger->log(
|
$this->logger->log(
|
||||||
SolrLogManager::ERROR,
|
MeilisearchLogManager::ERROR,
|
||||||
$message,
|
$message,
|
||||||
$data
|
$data
|
||||||
);
|
);
|
||||||
|
@ -30,27 +30,27 @@ namespace WapplerSystems\Meilisearch\Domain\Index\PageIndexer\Helper\UriBuilder;
|
|||||||
|
|
||||||
use WapplerSystems\Meilisearch\IndexQueue\Item;
|
use WapplerSystems\Meilisearch\IndexQueue\Item;
|
||||||
use WapplerSystems\Meilisearch\IndexQueue\PageIndexerDataUrlModifier;
|
use WapplerSystems\Meilisearch\IndexQueue\PageIndexerDataUrlModifier;
|
||||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||||
use WapplerSystems\Meilisearch\System\Url\UrlHelper;
|
use WapplerSystems\Meilisearch\System\Url\UrlHelper;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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
|
abstract class AbstractUriStrategy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var SolrLogManager|null|object
|
* @var MeilisearchLogManager|null|object
|
||||||
*/
|
*/
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractUriStrategy constructor.
|
* 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)) {
|
if (!GeneralUtility::isValidUrl($dataUrl)) {
|
||||||
$this->logger->log(
|
$this->logger->log(
|
||||||
SolrLogManager::ERROR,
|
MeilisearchLogManager::ERROR,
|
||||||
'Could not create a valid URL to get frontend data while trying to index a page.',
|
'Could not create a valid URL to get frontend data while trying to index a page.',
|
||||||
[
|
[
|
||||||
'item' => (array)$item,
|
'item' => (array)$item,
|
||||||
@ -140,13 +140,13 @@ abstract class AbstractUriStrategy
|
|||||||
*/
|
*/
|
||||||
protected function applyDataUrlModifier(Item $item, int $language, $dataUrl, UrlHelper $urlHelper):string
|
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;
|
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) {
|
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,
|
return $dataUrlModifier->modifyDataUrl($dataUrl,
|
||||||
|
@ -29,7 +29,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\PageIndexer\Helper\UriBuilder;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\IndexQueue\Item;
|
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\Exception\SiteNotFoundException;
|
||||||
use TYPO3\CMS\Core\Routing\InvalidRouteArgumentsException;
|
use TYPO3\CMS\Core\Routing\InvalidRouteArgumentsException;
|
||||||
use TYPO3\CMS\Core\Site\SiteFinder;
|
use TYPO3\CMS\Core\Site\SiteFinder;
|
||||||
@ -49,10 +49,10 @@ class TYPO3SiteStrategy extends AbstractUriStrategy
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* TYPO3SiteStrategy constructor.
|
* TYPO3SiteStrategy constructor.
|
||||||
* @param SolrLogManager|null $logger
|
* @param MeilisearchLogManager|null $logger
|
||||||
* @param SiteFinder|null $siteFinder
|
* @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);
|
parent::__construct($logger);
|
||||||
$this->siteFinder = $siteFinder ?? GeneralUtility::makeInstance(SiteFinder::class);
|
$this->siteFinder = $siteFinder ?? GeneralUtility::makeInstance(SiteFinder::class);
|
||||||
|
@ -40,7 +40,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|||||||
* This can be:
|
* This can be:
|
||||||
* * A TYPO3 site managed with site management
|
* * 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
|
* * 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
|
class UriStrategyFactory
|
||||||
{
|
{
|
||||||
|
@ -28,12 +28,12 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue\GarbageRemover;
|
|||||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||||
use WapplerSystems\Meilisearch\GarbageCollectorPostProcessor;
|
use WapplerSystems\Meilisearch\GarbageCollectorPostProcessor;
|
||||||
use WapplerSystems\Meilisearch\IndexQueue\Queue;
|
use WapplerSystems\Meilisearch\IndexQueue\Queue;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation ob a garbage remover strategy is responsible to remove all garbage from the index queue and
|
* 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
|
abstract class AbstractStrategy
|
||||||
{
|
{
|
||||||
@ -74,7 +74,7 @@ abstract class AbstractStrategy
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A implementation of the GarbageCollection strategy is responsible to remove the garbage from
|
* 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 string $table
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
@ -83,24 +83,24 @@ abstract class AbstractStrategy
|
|||||||
abstract protected function removeGarbageOfByStrategy($table, $uid);
|
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 string $table
|
||||||
* @param integer $uid
|
* @param integer $uid
|
||||||
*/
|
*/
|
||||||
protected function deleteInSolrAndRemoveFromIndexQueue($table, $uid)
|
protected function deleteInMeilisearchAndRemoveFromIndexQueue($table, $uid)
|
||||||
{
|
{
|
||||||
$this->deleteIndexDocuments($table, $uid);
|
$this->deleteIndexDocuments($table, $uid);
|
||||||
$this->queue->deleteItem($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 string $table
|
||||||
* @param integer $uid
|
* @param integer $uid
|
||||||
*/
|
*/
|
||||||
protected function deleteInSolrAndUpdateIndexQueue($table, $uid)
|
protected function deleteInMeilisearchAndUpdateIndexQueue($table, $uid)
|
||||||
{
|
{
|
||||||
$this->deleteIndexDocuments($table, $uid);
|
$this->deleteIndexDocuments($table, $uid);
|
||||||
$this->queue->updateItem($table, $uid);
|
$this->queue->updateItem($table, $uid);
|
||||||
@ -118,32 +118,32 @@ abstract class AbstractStrategy
|
|||||||
$indexQueueItems = $this->queue->getItems($table, $uid);
|
$indexQueueItems = $this->queue->getItems($table, $uid);
|
||||||
foreach ($indexQueueItems as $indexQueueItem) {
|
foreach ($indexQueueItems as $indexQueueItem) {
|
||||||
$site = $indexQueueItem->getSite();
|
$site = $indexQueueItem->getSite();
|
||||||
$enableCommitsSetting = $site->getSolrConfiguration()->getEnableCommits();
|
$enableCommitsSetting = $site->getMeilisearchConfiguration()->getEnableCommits();
|
||||||
$siteHash = $site->getSiteHash();
|
$siteHash = $site->getSiteHash();
|
||||||
// a site can have multiple connections (cores / languages)
|
// a site can have multiple connections (cores / languages)
|
||||||
$solrConnections = $this->connectionManager->getConnectionsBySite($site);
|
$meilisearchConnections = $this->connectionManager->getConnectionsBySite($site);
|
||||||
if ($language > 0) {
|
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 string $table
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @param SolrConnection[] $solrConnections
|
* @param MeilisearchConnection[] $meilisearchConnections
|
||||||
* @param string $siteHash
|
* @param string $siteHash
|
||||||
* @param boolean $enableCommitsSetting
|
* @param boolean $enableCommitsSetting
|
||||||
*/
|
*/
|
||||||
protected function deleteRecordInAllSolrConnections($table, $uid, $solrConnections, $siteHash, $enableCommitsSetting)
|
protected function deleteRecordInAllMeilisearchConnections($table, $uid, $meilisearchConnections, $siteHash, $enableCommitsSetting)
|
||||||
{
|
{
|
||||||
foreach ($solrConnections as $solr) {
|
foreach ($meilisearchConnections as $meilisearch) {
|
||||||
$solr->getWriteService()->deleteByQuery('type:' . $table . ' AND uid:' . (int)$uid . ' AND siteHash:' . $siteHash);
|
$meilisearch->getWriteService()->deleteByQuery('type:' . $table . ' AND uid:' . (int)$uid . ' AND siteHash:' . $siteHash);
|
||||||
if ($enableCommitsSetting) {
|
if ($enableCommitsSetting) {
|
||||||
$solr->getWriteService()->commit(false, false);
|
$meilisearch->getWriteService()->commit(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,11 +156,11 @@ abstract class AbstractStrategy
|
|||||||
*/
|
*/
|
||||||
protected function callPostProcessGarbageCollectorHook($table, $uid)
|
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;
|
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);
|
$garbageCollectorPostProcessor = GeneralUtility::makeInstance($classReference);
|
||||||
|
|
||||||
if ($garbageCollectorPostProcessor instanceof GarbageCollectorPostProcessor) {
|
if ($garbageCollectorPostProcessor instanceof GarbageCollectorPostProcessor) {
|
||||||
|
@ -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.
|
* page for a reindex.
|
||||||
*
|
*
|
||||||
* @param int $ttContentUid
|
* @param int $ttContentUid
|
||||||
@ -60,7 +60,7 @@ class PageStrategy extends AbstractStrategy {
|
|||||||
protected function collectPageGarbageByContentChange($ttContentUid)
|
protected function collectPageGarbageByContentChange($ttContentUid)
|
||||||
{
|
{
|
||||||
$contentElement = BackendUtility::getRecord('tt_content', $ttContentUid, 'uid, pid', '', false);
|
$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) {
|
if (!empty($pageOverlay['l10n_parent']) && intval($pageOverlay['l10n_parent']) !== 0) {
|
||||||
$this->deleteIndexDocuments('pages', (int)$pageOverlay['l10n_parent'], (int)$pageOverlay['sys_language_uid']);
|
$this->deleteIndexDocuments('pages', (int)$pageOverlay['l10n_parent'], (int)$pageOverlay['sys_language_uid']);
|
||||||
} else {
|
} else {
|
||||||
$this->deleteInSolrAndRemoveFromIndexQueue('pages', $uid);
|
$this->deleteInMeilisearchAndRemoveFromIndexQueue('pages', $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,6 @@ class RecordStrategy extends AbstractStrategy {
|
|||||||
*/
|
*/
|
||||||
protected function removeGarbageOfByStrategy($table, $uid)
|
protected function removeGarbageOfByStrategy($table, $uid)
|
||||||
{
|
{
|
||||||
$this->deleteInSolrAndRemoveFromIndexQueue($table, $uid);
|
$this->deleteInMeilisearchAndRemoveFromIndexQueue($table, $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
@ -97,16 +97,16 @@ class QueueInitializationService {
|
|||||||
$initializationStatus = [];
|
$initializationStatus = [];
|
||||||
|
|
||||||
$hasWildcardConfiguration = in_array('*', $indexingConfigurationNames);
|
$hasWildcardConfiguration = in_array('*', $indexingConfigurationNames);
|
||||||
$indexingConfigurationNames = $hasWildcardConfiguration ? $site->getSolrConfiguration()->getEnabledIndexQueueConfigurationNames() : $indexingConfigurationNames;
|
$indexingConfigurationNames = $hasWildcardConfiguration ? $site->getMeilisearchConfiguration()->getEnabledIndexQueueConfigurationNames() : $indexingConfigurationNames;
|
||||||
foreach ($indexingConfigurationNames as $indexingConfigurationName) {
|
foreach ($indexingConfigurationNames as $indexingConfigurationName) {
|
||||||
$initializationStatus[$indexingConfigurationName] = $this->applyInitialization($site, (string)$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;
|
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);
|
$indexQueueInitializationPostProcessor = GeneralUtility::makeInstance($classReference);
|
||||||
if ($indexQueueInitializationPostProcessor instanceof InitializationPostProcessor) {
|
if ($indexQueueInitializationPostProcessor instanceof InitializationPostProcessor) {
|
||||||
$indexQueueInitializationPostProcessor->postProcessIndexQueueInitialization($site, $indexingConfigurationNames, $initializationStatus);
|
$indexQueueInitializationPostProcessor->postProcessIndexQueueInitialization($site, $indexingConfigurationNames, $initializationStatus);
|
||||||
@ -131,10 +131,10 @@ class QueueInitializationService {
|
|||||||
// clear queue
|
// clear queue
|
||||||
$this->queue->deleteItemsBySite($site, $indexingConfigurationName);
|
$this->queue->deleteItemsBySite($site, $indexingConfigurationName);
|
||||||
|
|
||||||
$solrConfiguration = $site->getSolrConfiguration();
|
$meilisearchConfiguration = $site->getMeilisearchConfiguration();
|
||||||
$tableToIndex = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
|
$tableToIndex = $meilisearchConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
|
||||||
$initializerClass = $solrConfiguration->getIndexQueueInitializerClassByConfigurationName($indexingConfigurationName);
|
$initializerClass = $meilisearchConfiguration->getIndexQueueInitializerClassByConfigurationName($indexingConfigurationName);
|
||||||
$indexConfiguration = $solrConfiguration->getIndexQueueConfigurationByName($indexingConfigurationName);
|
$indexConfiguration = $meilisearchConfiguration->getIndexQueueConfigurationByName($indexingConfigurationName);
|
||||||
|
|
||||||
return $this->executeInitializer($site, $indexingConfigurationName, $initializerClass, $tableToIndex, $indexConfiguration);
|
return $this->executeInitializer($site, $indexingConfigurationName, $initializerClass, $tableToIndex, $indexConfiguration);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* 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\IndexQueue\Item;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
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 WapplerSystems\Meilisearch\System\Records\AbstractRepository;
|
||||||
use Doctrine\DBAL\DBALException;
|
use Doctrine\DBAL\DBALException;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
@ -47,18 +47,18 @@ class QueueItemRepository extends AbstractRepository
|
|||||||
protected $table = 'tx_meilisearch_indexqueue_item';
|
protected $table = 'tx_meilisearch_indexqueue_item';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SolrLogManager
|
* @var MeilisearchLogManager
|
||||||
*/
|
*/
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QueueItemRepository constructor.
|
* 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 Site $site TYPO3 site
|
||||||
* @param int $limit Number of items to get from the queue
|
* @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
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
$params = ['table' => $table, 'uids' => $uids, 'tableRecords' => &$tableRecords];
|
$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);
|
GeneralUtility::callUserFunction($reference, $params, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -745,7 +745,7 @@ class QueueItemRepository extends AbstractRepository
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->logger->log(
|
$this->logger->log(
|
||||||
SolrLogManager::ERROR,
|
MeilisearchLogManager::ERROR,
|
||||||
'Record missing for Index Queue item. Item removed.',
|
'Record missing for Index Queue item. Item removed.',
|
||||||
[
|
[
|
||||||
$indexQueueItemRecord
|
$indexQueueItemRecord
|
||||||
|
@ -43,21 +43,21 @@ class ConfigurationAwareRecordService
|
|||||||
*
|
*
|
||||||
* @param string $recordTable Table to read from
|
* @param string $recordTable Table to read from
|
||||||
* @param int $recordUid Id of the record
|
* @param int $recordUid Id of the record
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return string|null Name of indexing configuration
|
* @return string|null Name of indexing configuration
|
||||||
*/
|
*/
|
||||||
public function getIndexingConfigurationName($recordTable, $recordUid, TypoScriptConfiguration $solrConfiguration)
|
public function getIndexingConfigurationName($recordTable, $recordUid, TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$name = null;
|
$name = null;
|
||||||
$indexingConfigurations = $solrConfiguration->getEnabledIndexQueueConfigurationNames();
|
$indexingConfigurations = $meilisearchConfiguration->getEnabledIndexQueueConfigurationNames();
|
||||||
foreach ($indexingConfigurations as $indexingConfigurationName) {
|
foreach ($indexingConfigurations as $indexingConfigurationName) {
|
||||||
if (!$solrConfiguration->getIndexQueueConfigurationIsEnabled($indexingConfigurationName)) {
|
if (!$meilisearchConfiguration->getIndexQueueConfigurationIsEnabled($indexingConfigurationName)) {
|
||||||
// ignore disabled indexing configurations
|
// ignore disabled indexing configurations
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$record = $this->getRecordIfIndexConfigurationIsValid($recordTable, $recordUid,
|
$record = $this->getRecordIfIndexConfigurationIsValid($recordTable, $recordUid,
|
||||||
$indexingConfigurationName, $solrConfiguration);
|
$indexingConfigurationName, $meilisearchConfiguration);
|
||||||
if (!empty($record)) {
|
if (!empty($record)) {
|
||||||
$name = $indexingConfigurationName;
|
$name = $indexingConfigurationName;
|
||||||
// FIXME currently returns after the first configuration match
|
// FIXME currently returns after the first configuration match
|
||||||
@ -74,16 +74,16 @@ class ConfigurationAwareRecordService
|
|||||||
*
|
*
|
||||||
* @param string $recordTable Table to read from
|
* @param string $recordTable Table to read from
|
||||||
* @param int $recordUid Id of the record
|
* @param int $recordUid Id of the record
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return array Record if found, otherwise empty array
|
* @return array Record if found, otherwise empty array
|
||||||
*/
|
*/
|
||||||
public function getRecord($recordTable, $recordUid, TypoScriptConfiguration $solrConfiguration)
|
public function getRecord($recordTable, $recordUid, TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$record = [];
|
$record = [];
|
||||||
$indexingConfigurations = $solrConfiguration->getEnabledIndexQueueConfigurationNames();
|
$indexingConfigurations = $meilisearchConfiguration->getEnabledIndexQueueConfigurationNames();
|
||||||
foreach ($indexingConfigurations as $indexingConfigurationName) {
|
foreach ($indexingConfigurations as $indexingConfigurationName) {
|
||||||
$record = $this->getRecordIfIndexConfigurationIsValid($recordTable, $recordUid,
|
$record = $this->getRecordIfIndexConfigurationIsValid($recordTable, $recordUid,
|
||||||
$indexingConfigurationName, $solrConfiguration);
|
$indexingConfigurationName, $meilisearchConfiguration);
|
||||||
if (!empty($record)) {
|
if (!empty($record)) {
|
||||||
// if we found a record which matches the conditions, we can continue
|
// if we found a record which matches the conditions, we can continue
|
||||||
break;
|
break;
|
||||||
@ -99,16 +99,16 @@ class ConfigurationAwareRecordService
|
|||||||
* @param string $recordTable
|
* @param string $recordTable
|
||||||
* @param integer $recordUid
|
* @param integer $recordUid
|
||||||
* @param string $indexingConfigurationName
|
* @param string $indexingConfigurationName
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return array
|
* @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 [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$recordWhereClause = $solrConfiguration->getIndexQueueAdditionalWhereClauseByConfigurationName($indexingConfigurationName);
|
$recordWhereClause = $meilisearchConfiguration->getIndexQueueAdditionalWhereClauseByConfigurationName($indexingConfigurationName);
|
||||||
|
|
||||||
$row = $this->getRecordForIndexConfigurationIsValid($recordTable, $recordUid, $recordWhereClause);
|
$row = $this->getRecordForIndexConfigurationIsValid($recordTable, $recordUid, $recordWhereClause);
|
||||||
|
|
||||||
@ -146,12 +146,12 @@ class ConfigurationAwareRecordService
|
|||||||
*
|
*
|
||||||
* @param string $recordTable
|
* @param string $recordTable
|
||||||
* @param string $indexingConfigurationName
|
* @param string $indexingConfigurationName
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return boolean
|
* @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);
|
$isMatchingTable = ($tableToIndex === $recordTable);
|
||||||
|
|
||||||
|
@ -299,12 +299,12 @@ class RootPageResolver implements SingletonInterface
|
|||||||
$allSites = $siteRepository->getAvailableSites();
|
$allSites = $siteRepository->getAvailableSites();
|
||||||
|
|
||||||
foreach ($allSites as $site) {
|
foreach ($allSites as $site) {
|
||||||
$solrConfiguration = $site->getSolrConfiguration();
|
$meilisearchConfiguration = $site->getMeilisearchConfiguration();
|
||||||
$indexingConfigurationName = $this->recordService->getIndexingConfigurationName($table, $uid, $solrConfiguration);
|
$indexingConfigurationName = $this->recordService->getIndexingConfigurationName($table, $uid, $meilisearchConfiguration);
|
||||||
if ($indexingConfigurationName === null) {
|
if ($indexingConfigurationName === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$observedPageIdsOfSiteRoot = $solrConfiguration->getIndexQueueAdditionalPageIdsByConfigurationName($indexingConfigurationName);
|
$observedPageIdsOfSiteRoot = $meilisearchConfiguration->getIndexQueueAdditionalPageIdsByConfigurationName($indexingConfigurationName);
|
||||||
foreach ($observedPageIdsOfSiteRoot as $observedPageIdOfSiteRoot) {
|
foreach ($observedPageIdsOfSiteRoot as $observedPageIdOfSiteRoot) {
|
||||||
$siteRootByObservedPageIds[$observedPageIdOfSiteRoot][] = $site->getRootPageId();
|
$siteRootByObservedPageIds[$observedPageIdOfSiteRoot][] = $site->getRootPageId();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Index\Queue\Statistic;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheSolrDocument;
|
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument;
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* Copyright notice
|
||||||
@ -28,16 +28,16 @@ use WapplerSystems\Meilisearch\Access\Rootline;
|
|||||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
||||||
use WapplerSystems\Meilisearch\Domain\Variants\IdBuilder;
|
use WapplerSystems\Meilisearch\Domain\Variants\IdBuilder;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
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\Typo3PageContentExtractor;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
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>
|
* @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 array $itemRecord
|
||||||
* @param string $type
|
* @param string $type
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheSolrDocument;
|
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument;
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* Copyright notice
|
||||||
@ -28,12 +28,12 @@ use WapplerSystems\Meilisearch\ConnectionManager;
|
|||||||
use WapplerSystems\Meilisearch\Domain\Search\Query\QueryBuilder;
|
use WapplerSystems\Meilisearch\Domain\Search\Query\QueryBuilder;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\Parser\DocumentEscapeService;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\Parser\DocumentEscapeService;
|
||||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
||||||
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
|
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
|
||||||
use WapplerSystems\Meilisearch\Search;
|
use WapplerSystems\Meilisearch\Search;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
|
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrCommunicationException;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchCommunicationException;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Core\SingletonInterface;
|
use TYPO3\CMS\Core\SingletonInterface;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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)
|
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->documentEscapeService = $documentEscapeService ?? GeneralUtility::makeInstance(DocumentEscapeService::class, /** @scrutinizer ignore-type */ $typoScriptConfiguration);
|
||||||
$this->queryBuilder = $queryBuilder ?? GeneralUtility::makeInstance(QueryBuilder::class, /** @scrutinizer ignore-type */ $this->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
|
* @param $languageId
|
||||||
* @return Document|false
|
* @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.
|
* Returns empty array if nothing found, e.g. if no language or no page(or no index for page) is present.
|
||||||
*
|
*
|
||||||
* @param int $pageId
|
* @param int $pageId
|
||||||
@ -104,9 +104,9 @@ class Repository implements SingletonInterface
|
|||||||
$this->initializeSearch($pageId, $languageId);
|
$this->initializeSearch($pageId, $languageId);
|
||||||
$pageQuery = $this->queryBuilder->buildPageQuery($pageId);
|
$pageQuery = $this->queryBuilder->buildPageQuery($pageId);
|
||||||
$response = $this->search->search($pageQuery, 0, 10000);
|
$response = $this->search->search($pageQuery, 0, 10000);
|
||||||
} catch (NoSolrConnectionFoundException $exception) {
|
} catch (NoMeilisearchConnectionFoundException $exception) {
|
||||||
return [];
|
return [];
|
||||||
} catch (SolrCommunicationException $exception) {
|
} catch (MeilisearchCommunicationException $exception) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$data = $response->getParsedData();
|
$data = $response->getParsedData();
|
||||||
@ -127,9 +127,9 @@ class Repository implements SingletonInterface
|
|||||||
$this->initializeSearch($pageId, $languageId);
|
$this->initializeSearch($pageId, $languageId);
|
||||||
$recordQuery = $this->queryBuilder->buildRecordQuery($type, $uid, $pageId);
|
$recordQuery = $this->queryBuilder->buildRecordQuery($type, $uid, $pageId);
|
||||||
$response = $this->search->search($recordQuery, 0, 10000);
|
$response = $this->search->search($recordQuery, 0, 10000);
|
||||||
} catch (NoSolrConnectionFoundException $exception) {
|
} catch (NoMeilisearchConnectionFoundException $exception) {
|
||||||
return [];
|
return [];
|
||||||
} catch (SolrCommunicationException $exception) {
|
} catch (MeilisearchCommunicationException $exception) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$data = $response->getParsedData();
|
$data = $response->getParsedData();
|
||||||
@ -152,19 +152,19 @@ class Repository implements SingletonInterface
|
|||||||
}
|
}
|
||||||
/* @var $connectionManager ConnectionManager */
|
/* @var $connectionManager ConnectionManager */
|
||||||
$connectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
|
$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.
|
* Retrieves an instance of the Search object.
|
||||||
*
|
*
|
||||||
* @param SolrConnection $solrConnection
|
* @param MeilisearchConnection $meilisearchConnection
|
||||||
* @return Search
|
* @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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\LastSearches;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
|
@ -44,7 +44,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|||||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
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 {
|
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 $filterString
|
||||||
* @param string $filterName
|
* @param string $filterName
|
||||||
|
@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query;
|
|||||||
use Solarium\QueryType\Extract\Query as SolariumExtractQuery;
|
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
|
class ExtractingQuery extends SolariumExtractQuery
|
||||||
|
@ -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
|
* This class should have no dependencies since it only contains static functions
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||||
@ -37,7 +37,7 @@ abstract class AbstractFieldList extends AbstractDeactivatable
|
|||||||
protected $fieldList = [];
|
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
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* 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
|
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
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -52,17 +52,17 @@ class BigramPhraseFields extends AbstractFieldList implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return BigramPhraseFields
|
* @return BigramPhraseFields
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getBigramPhraseSearchIsEnabled();
|
$isEnabled = $meilisearchConfiguration->getBigramPhraseSearchIsEnabled();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new BigramPhraseFields(false);
|
return new BigramPhraseFields(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::fromString((string)$solrConfiguration->getSearchQueryBigramPhraseFields());
|
return self::fromString((string)$meilisearchConfiguration->getSearchQueryBigramPhraseFields());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
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.
|
* that are needed for the elevation.
|
||||||
*/
|
*/
|
||||||
class Elevation extends AbstractDeactivatable implements ParameterBuilder
|
class Elevation extends AbstractDeactivatable implements ParameterBuilder
|
||||||
@ -89,18 +89,18 @@ class Elevation extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Elevation
|
* @return Elevation
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getSearchElevation();
|
$isEnabled = $meilisearchConfiguration->getSearchElevation();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new Elevation(false);
|
return new Elevation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$force = $solrConfiguration->getSearchElevationForceElevation();
|
$force = $meilisearchConfiguration->getSearchElevationForceElevation();
|
||||||
$markResults = $solrConfiguration->getSearchElevationMarkElevatedResults();
|
$markResults = $meilisearchConfiguration->getSearchElevationMarkElevatedResults();
|
||||||
return new Elevation(true, $force, $markResults);
|
return new Elevation(true, $force, $markResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\SortingExpression;
|
|||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
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.
|
* that are needed for the highlighting.
|
||||||
*/
|
*/
|
||||||
class Faceting extends AbstractDeactivatable implements ParameterBuilder
|
class Faceting extends AbstractDeactivatable implements ParameterBuilder
|
||||||
@ -196,19 +196,19 @@ class Faceting extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Faceting
|
* @return Faceting
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getSearchFaceting();
|
$isEnabled = $meilisearchConfiguration->getSearchFaceting();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new Faceting(false);
|
return new Faceting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$minCount = $solrConfiguration->getSearchFacetingMinimumCount();
|
$minCount = $meilisearchConfiguration->getSearchFacetingMinimumCount();
|
||||||
$limit = $solrConfiguration->getSearchFacetingFacetLimit();
|
$limit = $meilisearchConfiguration->getSearchFacetingFacetLimit();
|
||||||
$sorting = $solrConfiguration->getSearchFacetingSortBy();
|
$sorting = $meilisearchConfiguration->getSearchFacetingSortBy();
|
||||||
|
|
||||||
return new Faceting($isEnabled, $sorting, $minCount, $limit);
|
return new Faceting($isEnabled, $sorting, $minCount, $limit);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
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.
|
* that are needed for the field collapsing.
|
||||||
*/
|
*/
|
||||||
class FieldCollapsing extends AbstractDeactivatable implements ParameterBuilder
|
class FieldCollapsing extends AbstractDeactivatable implements ParameterBuilder
|
||||||
@ -112,19 +112,19 @@ class FieldCollapsing extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return FieldCollapsing
|
* @return FieldCollapsing
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getSearchVariants();
|
$isEnabled = $meilisearchConfiguration->getSearchVariants();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new FieldCollapsing(false);
|
return new FieldCollapsing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$collapseField = $solrConfiguration->getSearchVariantsField();
|
$collapseField = $meilisearchConfiguration->getSearchVariantsField();
|
||||||
$expand = (bool)$solrConfiguration->getSearchVariantsExpand();
|
$expand = (bool)$meilisearchConfiguration->getSearchVariantsExpand();
|
||||||
$expandRows = $solrConfiguration->getSearchVariantsLimit();
|
$expandRows = $meilisearchConfiguration->getSearchVariantsLimit();
|
||||||
|
|
||||||
return new FieldCollapsing(true, $collapseField, $expand, $expandRows);
|
return new FieldCollapsing(true, $collapseField, $expand, $expandRows);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* that are needed for the filtering.
|
||||||
*/
|
*/
|
||||||
class Filters
|
class Filters
|
||||||
@ -140,10 +140,10 @@ class Filters
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Filters
|
* @return Filters
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
return new Filters();
|
return new Filters();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
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.
|
* that are needed for the grouping.
|
||||||
*/
|
*/
|
||||||
class Grouping extends AbstractDeactivatable implements ParameterBuilder
|
class Grouping extends AbstractDeactivatable implements ParameterBuilder
|
||||||
@ -185,12 +185,12 @@ class Grouping extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Grouping
|
* @return Grouping
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getSearchGrouping();
|
$isEnabled = $meilisearchConfiguration->getSearchGrouping();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new Grouping(false);
|
return new Grouping(false);
|
||||||
}
|
}
|
||||||
@ -199,10 +199,10 @@ class Grouping extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
$queries = [];
|
$queries = [];
|
||||||
$sortings = [];
|
$sortings = [];
|
||||||
|
|
||||||
$resultsPerGroup = $solrConfiguration->getSearchGroupingHighestGroupResultsLimit();
|
$resultsPerGroup = $meilisearchConfiguration->getSearchGroupingHighestGroupResultsLimit();
|
||||||
$configuredGroups = $solrConfiguration->getSearchGroupingGroupsConfiguration();
|
$configuredGroups = $meilisearchConfiguration->getSearchGroupingGroupsConfiguration();
|
||||||
$numberOfGroups = $solrConfiguration->getSearchGroupingNumberOfGroups();
|
$numberOfGroups = $meilisearchConfiguration->getSearchGroupingNumberOfGroups();
|
||||||
$sortBy = $solrConfiguration->getSearchGroupingSortBy();
|
$sortBy = $meilisearchConfiguration->getSearchGroupingSortBy();
|
||||||
|
|
||||||
foreach ($configuredGroups as $groupName => $groupConfiguration) {
|
foreach ($configuredGroups as $groupName => $groupConfiguration) {
|
||||||
if (isset($groupConfiguration['field'])) {
|
if (isset($groupConfiguration['field'])) {
|
||||||
|
@ -30,7 +30,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* that are needed for the highlighting.
|
||||||
*/
|
*/
|
||||||
class Highlighting extends AbstractDeactivatable implements ParameterBuilder
|
class Highlighting extends AbstractDeactivatable implements ParameterBuilder
|
||||||
@ -147,19 +147,19 @@ class Highlighting extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Highlighting
|
* @return Highlighting
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getSearchResultsHighlighting();
|
$isEnabled = $meilisearchConfiguration->getSearchResultsHighlighting();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new Highlighting(false);
|
return new Highlighting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fragmentSize = $solrConfiguration->getSearchResultsHighlightingFragmentSize();
|
$fragmentSize = $meilisearchConfiguration->getSearchResultsHighlightingFragmentSize();
|
||||||
$highlightingFields = $solrConfiguration->getSearchResultsHighlightingFields();
|
$highlightingFields = $meilisearchConfiguration->getSearchResultsHighlightingFields();
|
||||||
$wrap = explode('|', $solrConfiguration->getSearchResultsHighlightingWrap());
|
$wrap = explode('|', $meilisearchConfiguration->getSearchResultsHighlightingWrap());
|
||||||
$prefix = isset($wrap[0]) ? $wrap[0] : '';
|
$prefix = isset($wrap[0]) ? $wrap[0] : '';
|
||||||
$postfix = isset($wrap[1]) ? $wrap[1] : '';
|
$postfix = isset($wrap[1]) ? $wrap[1] : '';
|
||||||
|
|
||||||
|
@ -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.
|
* that are needed for the operator q.op.
|
||||||
*/
|
*/
|
||||||
class Operator extends AbstractDeactivatable
|
class Operator extends AbstractDeactivatable
|
||||||
|
@ -29,7 +29,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The implementation of ParameterBuilder is responsible to build an array with
|
* 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
|
* Interface ParameterProvider
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* 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
|
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
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -52,17 +52,17 @@ class PhraseFields extends AbstractFieldList implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return PhraseFields
|
* @return PhraseFields
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getPhraseSearchIsEnabled();
|
$isEnabled = $meilisearchConfiguration->getPhraseSearchIsEnabled();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new PhraseFields(false);
|
return new PhraseFields(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::fromString((string)$solrConfiguration->getSearchQueryPhraseFields());
|
return self::fromString((string)$meilisearchConfiguration->getSearchQueryPhraseFields());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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
|
class QueryFields implements ParameterBuilder
|
||||||
{
|
{
|
||||||
|
@ -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
|
* The ReturnFields class is responsible to hold a list of field names that should be returned from
|
||||||
* solr.
|
* meilisearch.
|
||||||
*/
|
*/
|
||||||
class ReturnFields implements ParameterBuilder
|
class ReturnFields implements ParameterBuilder
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
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.
|
* that are needed for the several slop arguments.
|
||||||
*/
|
*/
|
||||||
class Slops implements ParameterBuilder
|
class Slops implements ParameterBuilder
|
||||||
@ -171,12 +171,12 @@ class Slops implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Slops
|
* @return Slops
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$searchConfiguration = $solrConfiguration->getSearchConfiguration();
|
$searchConfiguration = $meilisearchConfiguration->getSearchConfiguration();
|
||||||
$querySlop = static::getQuerySlopFromConfiguration($searchConfiguration);
|
$querySlop = static::getQuerySlopFromConfiguration($searchConfiguration);
|
||||||
$phraseSlop = static::getPhraseSlopFromConfiguration($searchConfiguration);
|
$phraseSlop = static::getPhraseSlopFromConfiguration($searchConfiguration);
|
||||||
$bigramPhraseSlop = static::getBigramPhraseSlopFromConfiguration($searchConfiguration);
|
$bigramPhraseSlop = static::getBigramPhraseSlopFromConfiguration($searchConfiguration);
|
||||||
|
@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* that are needed for the sorting.
|
||||||
*/
|
*/
|
||||||
class Sorting extends AbstractDeactivatable
|
class Sorting extends AbstractDeactivatable
|
||||||
|
@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* that are needed for the sorting.
|
||||||
*/
|
*/
|
||||||
class Sortings extends AbstractDeactivatable
|
class Sortings extends AbstractDeactivatable
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\Domain\Search\Query\AbstractQueryBuilder;
|
|||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
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.
|
* that are needed for the spellchecking.
|
||||||
*/
|
*/
|
||||||
class Spellchecking extends AbstractDeactivatable implements ParameterBuilder
|
class Spellchecking extends AbstractDeactivatable implements ParameterBuilder
|
||||||
@ -60,17 +60,17 @@ class Spellchecking extends AbstractDeactivatable implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return Spellchecking
|
* @return Spellchecking
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getSearchSpellchecking();
|
$isEnabled = $meilisearchConfiguration->getSearchSpellchecking();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new Spellchecking(false);
|
return new Spellchecking(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$maxCollationTries = $solrConfiguration->getSearchSpellcheckingNumberOfSuggestionsToTry();
|
$maxCollationTries = $meilisearchConfiguration->getSearchSpellcheckingNumberOfSuggestionsToTry();
|
||||||
|
|
||||||
return new Spellchecking($isEnabled, $maxCollationTries);
|
return new Spellchecking($isEnabled, $maxCollationTries);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\Query\ParameterBuilder;
|
|||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Copyright notice
|
* 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
|
* All rights reserved
|
||||||
*
|
*
|
||||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
* 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
|
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
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -52,17 +52,17 @@ class TrigramPhraseFields extends AbstractFieldList implements ParameterBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
* @return TrigramPhraseFields
|
* @return TrigramPhraseFields
|
||||||
*/
|
*/
|
||||||
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration)
|
public static function fromTypoScriptConfiguration(TypoScriptConfiguration $meilisearchConfiguration)
|
||||||
{
|
{
|
||||||
$isEnabled = $solrConfiguration->getTrigramPhraseSearchIsEnabled();
|
$isEnabled = $meilisearchConfiguration->getTrigramPhraseSearchIsEnabled();
|
||||||
if (!$isEnabled) {
|
if (!$isEnabled) {
|
||||||
return new TrigramPhraseFields(false);
|
return new TrigramPhraseFields(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::fromString((string)$solrConfiguration->getSearchQueryTrigramPhraseFields());
|
return self::fromString((string)$meilisearchConfiguration->getSearchQueryTrigramPhraseFields());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,13 +43,13 @@ use WapplerSystems\Meilisearch\Domain\Site\SiteHashService;
|
|||||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
||||||
use WapplerSystems\Meilisearch\FieldProcessor\PageUidToHierarchy;
|
use WapplerSystems\Meilisearch\FieldProcessor\PageUidToHierarchy;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
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 {
|
class QueryBuilder extends AbstractQueryBuilder {
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class QueryBuilder extends AbstractQueryBuilder {
|
|||||||
protected $typoScriptConfiguration = null;
|
protected $typoScriptConfiguration = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SolrLogManager;
|
* @var MeilisearchLogManager;
|
||||||
*/
|
*/
|
||||||
protected $logger = null;
|
protected $logger = null;
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ class QueryBuilder extends AbstractQueryBuilder {
|
|||||||
/**
|
/**
|
||||||
* QueryBuilder constructor.
|
* QueryBuilder constructor.
|
||||||
* @param TypoScriptConfiguration|null $configuration
|
* @param TypoScriptConfiguration|null $configuration
|
||||||
* @param SolrLogManager|null $solrLogManager
|
* @param MeilisearchLogManager|null $meilisearchLogManager
|
||||||
* @param SiteHashService|null $siteHashService
|
* @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->typoScriptConfiguration = $configuration ?? Util::getMeilisearchConfiguration();
|
||||||
$this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
$this->logger = $meilisearchLogManager ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
||||||
$this->siteHashService = $siteHashService ?? GeneralUtility::makeInstance(SiteHashService::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
|
public function buildSearchQuery($rawQuery, $resultsPerPage = 10, array $additionalFiltersFromRequest = []) : SearchQuery
|
||||||
{
|
{
|
||||||
if ($this->typoScriptConfiguration->getLoggingQuerySearchWords()) {
|
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 */
|
/* @var $query SearchQuery */
|
||||||
@ -170,7 +170,7 @@ class QueryBuilder extends AbstractQueryBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Query for Search which finds document for given page.
|
* 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
|
* @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
|
* @return QueryBuilder
|
||||||
*/
|
*/
|
||||||
|
@ -50,17 +50,17 @@ class SuggestQuery extends Query
|
|||||||
* SuggestQuery constructor.
|
* SuggestQuery constructor.
|
||||||
*
|
*
|
||||||
* @param string $keywords
|
* @param string $keywords
|
||||||
* @param TypoScriptConfiguration $solrConfiguration
|
* @param TypoScriptConfiguration $meilisearchConfiguration
|
||||||
*/
|
*/
|
||||||
public function __construct($keywords, $solrConfiguration = null)
|
public function __construct($keywords, $meilisearchConfiguration = null)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$keywords = (string)$keywords;
|
$keywords = (string)$keywords;
|
||||||
|
|
||||||
$solrConfiguration = $solrConfiguration ?? Util::getSolrConfiguration();
|
$meilisearchConfiguration = $meilisearchConfiguration ?? Util::getMeilisearchConfiguration();
|
||||||
|
|
||||||
$this->setQuery($keywords);
|
$this->setQuery($keywords);
|
||||||
$this->configuration = $solrConfiguration->getObjectByPathOrDefault('plugin.tx_meilisearch.suggest.', []);
|
$this->configuration = $meilisearchConfiguration->getObjectByPathOrDefault('plugin.tx_meilisearch.suggest.', []);
|
||||||
|
|
||||||
if (!empty($this->configuration['treatMultipleTermsAsSingleTerm'])) {
|
if (!empty($this->configuration['treatMultipleTermsAsSingleTerm'])) {
|
||||||
$this->prefix = EscapeService::escape($keywords);
|
$this->prefix = EscapeService::escape($keywords);
|
||||||
|
@ -117,7 +117,7 @@ abstract class AbstractFacet
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get solr field name
|
* Get meilisearch field name
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -118,13 +118,13 @@ abstract class AbstractFacetParser implements FacetParserInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $facetValuesFromSolrResponse
|
* @param array $facetValuesFromMeilisearchResponse
|
||||||
* @param array $facetValuesFromSearchRequest
|
* @param array $facetValuesFromSearchRequest
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function getMergedFacetValueFromSearchRequestAndSolrResponse($facetValuesFromSolrResponse, $facetValuesFromSearchRequest)
|
protected function getMergedFacetValueFromSearchRequestAndMeilisearchResponse($facetValuesFromMeilisearchResponse, $facetValuesFromSearchRequest)
|
||||||
{
|
{
|
||||||
$facetValueItemsToCreate = $facetValuesFromSolrResponse;
|
$facetValueItemsToCreate = $facetValuesFromMeilisearchResponse;
|
||||||
|
|
||||||
foreach ($facetValuesFromSearchRequest as $valueFromRequest) {
|
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
|
// if we have options in the request that have not been in the response we add them with a count of 0
|
||||||
|
@ -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\Facets\AbstractFacetParser;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ParsingUtil;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ParsingUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class HierarchyFacetParser
|
* Class HierarchyFacetParser
|
||||||
@ -34,9 +34,9 @@ class HierarchyFacetParser extends AbstractFacetParser
|
|||||||
$response = $resultSet->getResponse();
|
$response = $resultSet->getResponse();
|
||||||
$fieldName = $facetConfiguration['field'];
|
$fieldName = $facetConfiguration['field'];
|
||||||
$label = $this->getPlainLabelOrApplyCObject($facetConfiguration);
|
$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);
|
$optionsFromRequest = $this->getActiveFacetValuesFromRequest($resultSet, $facetName);
|
||||||
$hasOptionsInResponse = !empty($optionsFromSolrResponse);
|
$hasOptionsInResponse = !empty($optionsFromMeilisearchResponse);
|
||||||
$hasSelectedOptionsInRequest = count($optionsFromRequest) > 0;
|
$hasSelectedOptionsInRequest = count($optionsFromRequest) > 0;
|
||||||
$hasNoOptionsToShow = !$hasOptionsInResponse && !$hasSelectedOptionsInRequest;
|
$hasNoOptionsToShow = !$hasOptionsInResponse && !$hasSelectedOptionsInRequest;
|
||||||
$hideEmpty = !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingShowEmptyFacetsByName($facetName);
|
$hideEmpty = !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingShowEmptyFacetsByName($facetName);
|
||||||
@ -53,7 +53,7 @@ class HierarchyFacetParser extends AbstractFacetParser
|
|||||||
|
|
||||||
$facet->setIsAvailable($hasOptionsInResponse);
|
$facet->setIsAvailable($hasOptionsInResponse);
|
||||||
|
|
||||||
$nodesToCreate = $this->getMergedFacetValueFromSearchRequestAndSolrResponse($optionsFromSolrResponse, $optionsFromRequest);
|
$nodesToCreate = $this->getMergedFacetValueFromSearchRequestAndMeilisearchResponse($optionsFromMeilisearchResponse, $optionsFromRequest);
|
||||||
|
|
||||||
if ($this->facetOptionsMustBeResorted($facetConfiguration)) {
|
if ($this->facetOptionsMustBeResorted($facetConfiguration)) {
|
||||||
$nodesToCreate = $this->sortFacetOptionsInNaturalOrder($nodesToCreate);
|
$nodesToCreate = $this->sortFacetOptionsInNaturalOrder($nodesToCreate);
|
||||||
@ -96,13 +96,13 @@ class HierarchyFacetParser extends AbstractFacetParser
|
|||||||
/**
|
/**
|
||||||
* Checks if options must be resorted.
|
* 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:
|
* 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
|
* 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://lucene.apache.org/meilisearch/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://wiki.apache.org/meilisearch/SimpleFacetParameters#facet.sort : "This parameter can be specified on a per field basis."
|
||||||
*
|
*
|
||||||
* @param array $facetConfiguration
|
* @param array $facetConfiguration
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -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
|
* @param string $pathWithReplacedContentSlashes
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\OptionBased\
|
|||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\FacetUrlDecoderInterface;
|
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>
|
* @author Ingo Renner <ingo@typo3.org>
|
||||||
*/
|
*/
|
||||||
@ -42,11 +42,11 @@ class HierarchyUrlDecoder implements FacetUrlDecoderInterface
|
|||||||
const DELIMITER = '/';
|
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 string $hierarchy The hierarchy filter query.
|
||||||
* @param array $configuration Facet configuration
|
* @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 = [])
|
public function decode($hierarchy, array $configuration = [])
|
||||||
{
|
{
|
||||||
|
@ -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\Facets\AbstractFacetParser;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
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\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
|
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
|
||||||
|
|
||||||
@ -49,10 +49,10 @@ class OptionsFacetParser extends AbstractFacetParser
|
|||||||
$response = $resultSet->getResponse();
|
$response = $resultSet->getResponse();
|
||||||
$fieldName = $facetConfiguration['field'];
|
$fieldName = $facetConfiguration['field'];
|
||||||
$label = $this->getPlainLabelOrApplyCObject($facetConfiguration);
|
$label = $this->getPlainLabelOrApplyCObject($facetConfiguration);
|
||||||
$optionsFromSolrResponse = $this->getOptionsFromSolrResponse($facetName, $response);
|
$optionsFromMeilisearchResponse = $this->getOptionsFromMeilisearchResponse($facetName, $response);
|
||||||
$metricsFromSolrResponse = $this->getMetricsFromSolrResponse($facetName, $response);
|
$metricsFromMeilisearchResponse = $this->getMetricsFromMeilisearchResponse($facetName, $response);
|
||||||
$optionsFromRequest = $this->getActiveFacetValuesFromRequest($resultSet, $facetName);
|
$optionsFromRequest = $this->getActiveFacetValuesFromRequest($resultSet, $facetName);
|
||||||
$hasOptionsInResponse = !empty($optionsFromSolrResponse);
|
$hasOptionsInResponse = !empty($optionsFromMeilisearchResponse);
|
||||||
$hasSelectedOptionsInRequest = count($optionsFromRequest) > 0;
|
$hasSelectedOptionsInRequest = count($optionsFromRequest) > 0;
|
||||||
$hasNoOptionsToShow = !$hasOptionsInResponse && !$hasSelectedOptionsInRequest;
|
$hasNoOptionsToShow = !$hasOptionsInResponse && !$hasSelectedOptionsInRequest;
|
||||||
$hideEmpty = !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingShowEmptyFacetsByName($facetName);
|
$hideEmpty = !$resultSet->getUsedSearchRequest()->getContextTypoScriptConfiguration()->getSearchFacetingShowEmptyFacetsByName($facetName);
|
||||||
@ -75,7 +75,7 @@ class OptionsFacetParser extends AbstractFacetParser
|
|||||||
$facet->setIsUsed($hasActiveOptions);
|
$facet->setIsUsed($hasActiveOptions);
|
||||||
$facet->setIsAvailable($hasOptionsInResponse);
|
$facet->setIsAvailable($hasOptionsInResponse);
|
||||||
|
|
||||||
$optionsToCreate = $this->getMergedFacetValueFromSearchRequestAndSolrResponse($optionsFromSolrResponse, $optionsFromRequest);
|
$optionsToCreate = $this->getMergedFacetValueFromSearchRequestAndMeilisearchResponse($optionsFromMeilisearchResponse, $optionsFromRequest);
|
||||||
foreach ($optionsToCreate as $optionsValue => $count) {
|
foreach ($optionsToCreate as $optionsValue => $count) {
|
||||||
if ($this->getIsExcludedFacetValue($optionsValue, $facetConfiguration)) {
|
if ($this->getIsExcludedFacetValue($optionsValue, $facetConfiguration)) {
|
||||||
continue;
|
continue;
|
||||||
@ -83,11 +83,11 @@ class OptionsFacetParser extends AbstractFacetParser
|
|||||||
|
|
||||||
$isOptionsActive = in_array($optionsValue, $optionsFromRequest);
|
$isOptionsActive = in_array($optionsValue, $optionsFromRequest);
|
||||||
$label = $this->getLabelFromRenderingInstructions($optionsValue, $count, $facetName, $facetConfiguration);
|
$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
|
// 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.
|
// need to be handled in the frontend.
|
||||||
$this->applyManualSortOrder($facet, $facetConfiguration);
|
$this->applyManualSortOrder($facet, $facetConfiguration);
|
||||||
$this->applyReverseOrder($facet, $facetConfiguration);
|
$this->applyReverseOrder($facet, $facetConfiguration);
|
||||||
@ -104,20 +104,20 @@ class OptionsFacetParser extends AbstractFacetParser
|
|||||||
* @param ResponseAdapter $response
|
* @param ResponseAdapter $response
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getOptionsFromSolrResponse($facetName, ResponseAdapter $response)
|
protected function getOptionsFromMeilisearchResponse($facetName, ResponseAdapter $response)
|
||||||
{
|
{
|
||||||
$optionsFromSolrResponse = [];
|
$optionsFromMeilisearchResponse = [];
|
||||||
if (!isset($response->facets->{$facetName})) {
|
if (!isset($response->facets->{$facetName})) {
|
||||||
return $optionsFromSolrResponse;
|
return $optionsFromMeilisearchResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($response->facets->{$facetName}->buckets as $bucket) {
|
foreach ($response->facets->{$facetName}->buckets as $bucket) {
|
||||||
$optionValue = $bucket->val;
|
$optionValue = $bucket->val;
|
||||||
$optionCount = $bucket->count;
|
$optionCount = $bucket->count;
|
||||||
$optionsFromSolrResponse[$optionValue] = $optionCount;
|
$optionsFromMeilisearchResponse[$optionValue] = $optionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $optionsFromSolrResponse;
|
return $optionsFromMeilisearchResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,9 +125,9 @@ class OptionsFacetParser extends AbstractFacetParser
|
|||||||
* @param ResponseAdapter $response
|
* @param ResponseAdapter $response
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getMetricsFromSolrResponse($facetName, ResponseAdapter $response)
|
protected function getMetricsFromMeilisearchResponse($facetName, ResponseAdapter $response)
|
||||||
{
|
{
|
||||||
$metricsFromSolrResponse = [];
|
$metricsFromMeilisearchResponse = [];
|
||||||
|
|
||||||
if (!isset($response->facets->{$facetName}->buckets)) {
|
if (!isset($response->facets->{$facetName}->buckets)) {
|
||||||
return [];
|
return [];
|
||||||
@ -138,11 +138,11 @@ class OptionsFacetParser extends AbstractFacetParser
|
|||||||
foreach ($bucketVariables as $key => $value) {
|
foreach ($bucketVariables as $key => $value) {
|
||||||
if (strpos($key, 'metrics_') === 0) {
|
if (strpos($key, 'metrics_') === 0) {
|
||||||
$metricsKey = str_replace('metrics_', '', $key);
|
$metricsKey = str_replace('metrics_', '', $key);
|
||||||
$metricsFromSolrResponse[$bucket->val][$metricsKey] = $value;
|
$metricsFromMeilisearchResponse[$bucket->val][$metricsKey] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $metricsFromSolrResponse;
|
return $metricsFromMeilisearchResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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\Facets\AbstractFacetParser;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class QueryGroupFacetParser
|
* Class QueryGroupFacetParser
|
||||||
@ -86,7 +86,7 @@ class QueryGroupFacetParser extends AbstractFacetParser
|
|||||||
|
|
||||||
|
|
||||||
// after all options have been created we apply a manualSortOrder if configured
|
// 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.
|
// need to be handled in the frontend.
|
||||||
$this->applyManualSortOrder($facet, $facetConfiguration);
|
$this->applyManualSortOrder($facet, $facetConfiguration);
|
||||||
$this->applyReverseOrder($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
|
// 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
|
// 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);
|
$rawValue = preg_replace('/^\{!ex=[^\}]*\}(.*)/', '\\1', $rawValue);
|
||||||
|
|
||||||
list($field, $query) = explode(':', $rawValue, 2);
|
list($field, $query) = explode(':', $rawValue, 2);
|
||||||
|
@ -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\Facets\AbstractFacetParser;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSet;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ParsingUtil;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ParsingUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AbstractRangeFacetParser
|
* Class AbstractRangeFacetParser
|
||||||
|
@ -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
|
* @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
|
* @return \DateTime
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +30,7 @@ use WapplerSystems\Meilisearch\System\DateTime\FormatService;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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>
|
* @author Markus Goldbach <markus.goldbach@dkd.de>
|
||||||
*/
|
*/
|
||||||
@ -45,12 +45,12 @@ class DateRangeUrlDecoder implements FacetUrlDecoderInterface
|
|||||||
const DELIMITER = '-';
|
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.
|
* date range filter.
|
||||||
*
|
*
|
||||||
* @param string $dateRange The range filter query string from the query URL
|
* @param string $dateRange The range filter query string from the query URL
|
||||||
* @param array $configuration Facet configuration
|
* @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 = [])
|
public function decode($dateRange, array $configuration = [])
|
||||||
{
|
{
|
||||||
|
@ -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
|
* @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
|
* @return float
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\RangeBased\N
|
|||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Facets\FacetUrlDecoderInterface;
|
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 Markus Goldbach <markus.goldbach@dkd.de>
|
||||||
* @author Ingo Renner <ingo@typo3.org>
|
* @author Ingo Renner <ingo@typo3.org>
|
||||||
@ -46,12 +46,12 @@ class NumericRangeUrlDecoder implements FacetUrlDecoderInterface
|
|||||||
const DELIMITER = '-';
|
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.
|
* filter.
|
||||||
*
|
*
|
||||||
* @param string $range The range filter from the URL.
|
* @param string $range The range filter from the URL.
|
||||||
* @param array $configuration Facet configuration
|
* @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
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function decode($range, array $configuration = [])
|
public function decode($range, array $configuration = [])
|
||||||
|
@ -32,7 +32,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* and assign it to the SearchResultSet.
|
||||||
*/
|
*/
|
||||||
abstract class AbstractResultParser {
|
abstract class AbstractResultParser {
|
||||||
|
@ -62,7 +62,7 @@ class DefaultResultParser extends AbstractResultParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($documents as $searchResult) {
|
foreach ($documents as $searchResult) {
|
||||||
$searchResultObject = $this->searchResultBuilder->fromApacheSolrDocument($searchResult);
|
$searchResultObject = $this->searchResultBuilder->fromApacheMeilisearchDocument($searchResult);
|
||||||
$searchResults[] = $searchResultObject;
|
$searchResults[] = $searchResultObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\Parser;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
|
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies htmlspecialschars on documents of a solr response.
|
* Applies htmlspecialschars on documents of a meilisearch response.
|
||||||
*/
|
*/
|
||||||
class DocumentEscapeService {
|
class DocumentEscapeService {
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class DocumentEscapeService {
|
|||||||
* @param TypoScriptConfiguration|null $typoScriptConfiguration
|
* @param TypoScriptConfiguration|null $typoScriptConfiguration
|
||||||
*/
|
*/
|
||||||
public function __construct(TypoScriptConfiguration $typoScriptConfiguration = null) {
|
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)
|
public function applyHtmlSpecialCharsOnAllFields(array $documents)
|
||||||
{
|
{
|
||||||
$trustedSolrFields = $this->typoScriptConfiguration->getSearchTrustedFieldsArray();
|
$trustedMeilisearchFields = $this->typoScriptConfiguration->getSearchTrustedFieldsArray();
|
||||||
|
|
||||||
foreach ($documents as $key => $document) {
|
foreach ($documents as $key => $document) {
|
||||||
$fieldNames = array_keys($document->getFields() ?? []);
|
$fieldNames = array_keys($document->getFields() ?? []);
|
||||||
|
|
||||||
foreach ($fieldNames as $fieldName) {
|
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
|
// we skip this field, since it was marked as secure
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Grouping\GroupItem;
|
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>
|
* @author Timo Schmidt <timo.schmidt@dkd.de>
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ class SearchResult extends Document
|
|||||||
/**
|
/**
|
||||||
* The variant field value
|
* 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"
|
* TypoScript variable "variants.variantField"
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -25,24 +25,24 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* 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;
|
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.
|
* and should use a different class as SearchResult if configured.
|
||||||
*/
|
*/
|
||||||
class SearchResultBuilder {
|
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.
|
* class.
|
||||||
*
|
*
|
||||||
* @param Document $originalDocument
|
* @param Document $originalDocument
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return SearchResult
|
* @return SearchResult
|
||||||
*/
|
*/
|
||||||
public function fromApacheSolrDocument(Document $originalDocument)
|
public function fromApacheMeilisearchDocument(Document $originalDocument)
|
||||||
{
|
{
|
||||||
|
|
||||||
$searchResultClassName = $this->getResultClassName();
|
$searchResultClassName = $this->getResultClassName();
|
||||||
@ -60,7 +60,7 @@ class SearchResultBuilder {
|
|||||||
*/
|
*/
|
||||||
protected function getResultClassName()
|
protected function getResultClassName()
|
||||||
{
|
{
|
||||||
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName ']) ?
|
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultClassName ']) ?
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultClassName '] : SearchResult::class;
|
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultClassName '] : SearchResult::class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
|||||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
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).
|
* domain object hierarchy that can be used in the application (controller and view).
|
||||||
*
|
*
|
||||||
* @author Frans Saris <frans@beech.it>
|
* @author Frans Saris <frans@beech.it>
|
||||||
@ -83,7 +83,7 @@ class ResultSetReconstitutionProcessor implements SearchResultSetProcessor
|
|||||||
$resultSet = $this->parseSpellCheckingResponseIntoObjects($resultSet);
|
$resultSet = $this->parseSpellCheckingResponseIntoObjects($resultSet);
|
||||||
$resultSet = $this->parseSortingIntoObjects($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);
|
$resultSet = $this->parseFacetsIntoObjects($resultSet);
|
||||||
|
|
||||||
return $resultSet;
|
return $resultSet;
|
||||||
|
@ -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\ResultSet\Spellchecking\Suggestion;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\SearchRequest;
|
use WapplerSystems\Meilisearch\Domain\Search\SearchRequest;
|
||||||
use WapplerSystems\Meilisearch\Search;
|
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.
|
* other relevant information, like the used Query and Request objects.
|
||||||
*
|
*
|
||||||
* @author Timo Schmidt <timo.schmidt@dkd.de>
|
* @author Timo Schmidt <timo.schmidt@dkd.de>
|
||||||
|
@ -41,10 +41,10 @@ use WapplerSystems\Meilisearch\Search\QueryAware;
|
|||||||
use WapplerSystems\Meilisearch\Search\SearchAware;
|
use WapplerSystems\Meilisearch\Search\SearchAware;
|
||||||
use WapplerSystems\Meilisearch\Search\SearchComponentManager;
|
use WapplerSystems\Meilisearch\Search\SearchComponentManager;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
|
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\SolrIncompleteResponseException;
|
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchIncompleteResponseException;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\SearchResultBuilder;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\SearchResultBuilder;
|
||||||
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
use TYPO3\CMS\Extbase\Object\ObjectManager;
|
||||||
@ -79,7 +79,7 @@ class SearchResultSetService
|
|||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $isSolrAvailable = false;
|
protected $isMeilisearchAvailable = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TypoScriptConfiguration
|
* @var TypoScriptConfiguration
|
||||||
@ -87,7 +87,7 @@ class SearchResultSetService
|
|||||||
protected $typoScriptConfiguration;
|
protected $typoScriptConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SolrLogManager
|
* @var MeilisearchLogManager
|
||||||
*/
|
*/
|
||||||
protected $logger = null;
|
protected $logger = null;
|
||||||
|
|
||||||
@ -109,17 +109,17 @@ class SearchResultSetService
|
|||||||
/**
|
/**
|
||||||
* @param TypoScriptConfiguration $configuration
|
* @param TypoScriptConfiguration $configuration
|
||||||
* @param Search $search
|
* @param Search $search
|
||||||
* @param SolrLogManager $solrLogManager
|
* @param MeilisearchLogManager $meilisearchLogManager
|
||||||
* @param SearchResultBuilder $resultBuilder
|
* @param SearchResultBuilder $resultBuilder
|
||||||
* @param QueryBuilder $queryBuilder
|
* @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->search = $search;
|
||||||
$this->typoScriptConfiguration = $configuration;
|
$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->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
|
* @param bool $useCache
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getIsSolrAvailable($useCache = true)
|
public function getIsMeilisearchAvailable($useCache = true)
|
||||||
{
|
{
|
||||||
$this->isSolrAvailable = $this->search->ping($useCache);
|
$this->isMeilisearchAvailable = $this->search->ping($useCache);
|
||||||
return $this->isSolrAvailable;
|
return $this->isMeilisearchAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -179,8 +179,8 @@ class SearchResultSetService
|
|||||||
*/
|
*/
|
||||||
protected function getResultSetClassName()
|
protected function getResultSetClassName()
|
||||||
{
|
{
|
||||||
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName ']) ?
|
return isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultSetClassName ']) ?
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['searchResultSetClassName '] : SearchResultSet::class;
|
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['searchResultSetClassName '] : SearchResultSet::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ class SearchResultSetService
|
|||||||
$this->initializeRegisteredSearchComponents($query, $searchRequest);
|
$this->initializeRegisteredSearchComponents($query, $searchRequest);
|
||||||
$resultSet->setUsedQuery($query);
|
$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);
|
$query = $this->modifyQuery($query, $searchRequest, $this->search);
|
||||||
$response = $this->doASearch($query, $searchRequest);
|
$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 Query $query
|
||||||
* @param SearchRequest $searchRequest
|
* @param SearchRequest $searchRequest
|
||||||
@ -308,7 +308,7 @@ class SearchResultSetService
|
|||||||
|
|
||||||
$response = $this->search->search($query, $offSet, null);
|
$response = $this->search->search($query, $offSet, null);
|
||||||
if($response === 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;
|
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 SearchRequest $searchRequest The searchRequest, relevant in the current context
|
||||||
* @param Search $search The search, relevant in the current context
|
* @param Search $search The search, relevant in the current context
|
||||||
* @throws \UnexpectedValueException
|
* @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)
|
protected function modifyQuery(Query $query, SearchRequest $searchRequest, Search $search)
|
||||||
{
|
{
|
||||||
// hook to modify the search query
|
// hook to modify the search query
|
||||||
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchQuery'])) {
|
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['modifySearchQuery'])) {
|
||||||
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchQuery'] as $classReference) {
|
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['meilisearch']['modifySearchQuery'] as $classReference) {
|
||||||
$queryModifier = $this->objectManager->get($classReference);
|
$queryModifier = $this->objectManager->get($classReference);
|
||||||
|
|
||||||
if ($queryModifier instanceof Modifier) {
|
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
|
* @param string $documentId
|
||||||
* @return SearchResult
|
* @return SearchResult
|
||||||
@ -431,7 +431,7 @@ class SearchResultSetService
|
|||||||
throw new \UnexpectedValueException("Response did not contain a valid Document object");
|
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)
|
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;
|
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);
|
$afterSearchProcessor = $this->objectManager->get($classReference);
|
||||||
if ($afterSearchProcessor instanceof SearchResultSetProcessor) {
|
if ($afterSearchProcessor instanceof SearchResultSetProcessor) {
|
||||||
$afterSearchProcessor->process($resultSet);
|
$afterSearchProcessor->process($resultSet);
|
||||||
|
@ -38,13 +38,13 @@ class ScoreCalculationService
|
|||||||
* Renders an overview of how the score for a certain document has been
|
* Renders an overview of how the score for a certain document has been
|
||||||
* calculated.
|
* calculated.
|
||||||
*
|
*
|
||||||
* @param string $solrDebugData debug data from the solr response
|
* @param string $meilisearchDebugData debug data from the meilisearch response
|
||||||
* @param string $queryFields
|
* @param string $queryFields
|
||||||
* @return string The HTML showing the score analysis
|
* @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);
|
return $this->render($highScores);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ class SearchRequestBuilder
|
|||||||
|
|
||||||
if ($this->shouldHideResultsFromInitialSearch($searchRequest)) {
|
if ($this->shouldHideResultsFromInitialSearch($searchRequest)) {
|
||||||
// initialize search with an empty query, which would by default return all documents
|
// initialize search with an empty query, which would by default return all documents
|
||||||
// anyway, tell Solr to not return any result documents
|
// anyway, tell Meilisearch to not return any result documents
|
||||||
// Solr will still return facets though
|
// Meilisearch will still return facets though
|
||||||
$currentNumberOfResultsShown = 0;
|
$currentNumberOfResultsShown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetService;
|
|||||||
use WapplerSystems\Meilisearch\Domain\Search\SearchRequest;
|
use WapplerSystems\Meilisearch\Domain\Search\SearchRequest;
|
||||||
use WapplerSystems\Meilisearch\Search;
|
use WapplerSystems\Meilisearch\Search;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ParsingUtil;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ParsingUtil;
|
||||||
use WapplerSystems\Meilisearch\Util;
|
use WapplerSystems\Meilisearch\Util;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
||||||
@ -95,15 +95,15 @@ class SuggestService {
|
|||||||
$groupList = Util::getFrontendUserGroupsList();
|
$groupList = Util::getFrontendUserGroupsList();
|
||||||
|
|
||||||
$suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
|
$suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
|
||||||
$solrSuggestions = $this->getSolrSuggestions($suggestQuery);
|
$meilisearchSuggestions = $this->getMeilisearchSuggestions($suggestQuery);
|
||||||
|
|
||||||
if ($solrSuggestions === []) {
|
if ($meilisearchSuggestions === []) {
|
||||||
return ['status' => false];
|
return ['status' => false];
|
||||||
}
|
}
|
||||||
|
|
||||||
$maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
|
$maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
|
||||||
$showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
|
$showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
|
||||||
$suggestions = $this->getSuggestionArray($suggestQuery, $solrSuggestions, $maxSuggestions);
|
$suggestions = $this->getSuggestionArray($suggestQuery, $meilisearchSuggestions, $maxSuggestions);
|
||||||
|
|
||||||
if (!$showTopResults) {
|
if (!$showTopResults) {
|
||||||
return $this->getResultArray($searchRequest, $suggestions, [], false);
|
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
|
* @param SuggestQuery $suggestQuery
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getSolrSuggestions(SuggestQuery $suggestQuery) : array
|
protected function getMeilisearchSuggestions(SuggestQuery $suggestQuery) : array
|
||||||
{
|
{
|
||||||
$pageId = $this->tsfe->getRequestedId();
|
$pageId = $this->tsfe->getRequestedId();
|
||||||
$languageId = Util::getLanguageUid();
|
$languageId = Util::getLanguageUid();
|
||||||
$solr = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionByPageId($pageId, $languageId);
|
$meilisearch = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionByPageId($pageId, $languageId);
|
||||||
$search = GeneralUtility::makeInstance(Search::class, /** @scrutinizer ignore-type */ $solr);
|
$search = GeneralUtility::makeInstance(Search::class, /** @scrutinizer ignore-type */ $meilisearch);
|
||||||
$response = $search->search($suggestQuery, 0, 0);
|
$response = $search->search($suggestQuery, 0, 0);
|
||||||
|
|
||||||
$rawResponse = $response->getRawResponse();
|
$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 SuggestQuery $suggestQuery
|
||||||
* @param array $solrSuggestions
|
* @param array $meilisearchSuggestions
|
||||||
* @param integer $maxSuggestions
|
* @param integer $maxSuggestions
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getSuggestionArray(SuggestQuery $suggestQuery, $solrSuggestions, $maxSuggestions) : array
|
protected function getSuggestionArray(SuggestQuery $suggestQuery, $meilisearchSuggestions, $maxSuggestions) : array
|
||||||
{
|
{
|
||||||
$queryString = $suggestQuery->getQuery();
|
$queryString = $suggestQuery->getQuery();
|
||||||
$suggestionCount = 0;
|
$suggestionCount = 0;
|
||||||
$suggestions = [];
|
$suggestions = [];
|
||||||
foreach ($solrSuggestions as $string => $count) {
|
foreach ($meilisearchSuggestions as $string => $count) {
|
||||||
$suggestion = trim($queryString . ' ' . $string);
|
$suggestion = trim($queryString . ' ' . $string);
|
||||||
$suggestions[$suggestion] = $count;
|
$suggestions[$suggestion] = $count;
|
||||||
$suggestionCount++;
|
$suggestionCount++;
|
||||||
|
@ -26,7 +26,7 @@ namespace WapplerSystems\Meilisearch\Domain\Site;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\Domain\Index\Queue\RecordMonitor\Helper\ConfigurationAwareRecordService;
|
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\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository;
|
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository;
|
||||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
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;
|
return $this->configuration;
|
||||||
}
|
}
|
||||||
@ -167,12 +167,12 @@ abstract class Site implements SiteInterface
|
|||||||
|
|
||||||
$configurationAwareRecordService = GeneralUtility::makeInstance(ConfigurationAwareRecordService::class);
|
$configurationAwareRecordService = GeneralUtility::makeInstance(ConfigurationAwareRecordService::class);
|
||||||
// Fetch configuration in order to be able to read initialPagesAdditionalWhereClause
|
// Fetch configuration in order to be able to read initialPagesAdditionalWhereClause
|
||||||
$solrConfiguration = $this->getSolrConfiguration();
|
$meilisearchConfiguration = $this->getMeilisearchConfiguration();
|
||||||
$indexQueueConfigurationName = $configurationAwareRecordService->getIndexingConfigurationName('pages', $this->rootPage['uid'], $solrConfiguration);
|
$indexQueueConfigurationName = $configurationAwareRecordService->getIndexingConfigurationName('pages', $this->rootPage['uid'], $meilisearchConfiguration);
|
||||||
if ($indexQueueConfigurationName === null) {
|
if ($indexQueueConfigurationName === null) {
|
||||||
return $pageIds;
|
return $pageIds;
|
||||||
}
|
}
|
||||||
$initialPagesAdditionalWhereClause = $solrConfiguration->getInitialPagesAdditionalWhereClause($indexQueueConfigurationName);
|
$initialPagesAdditionalWhereClause = $meilisearchConfiguration->getInitialPagesAdditionalWhereClause($indexQueueConfigurationName);
|
||||||
return array_merge($pageIds, $this->pagesRepository->findAllSubPageIdsByRootPage($rootPageId, $maxDepth, $initialPagesAdditionalWhereClause));
|
return array_merge($pageIds, $this->pagesRepository->findAllSubPageIdsByRootPage($rootPageId, $maxDepth, $initialPagesAdditionalWhereClause));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,26 +241,26 @@ abstract class Site implements SiteInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getAllSolrConnectionConfigurations(): array {
|
public function getAllMeilisearchConnectionConfigurations(): array {
|
||||||
$configs = [];
|
$configs = [];
|
||||||
foreach ($this->getAvailableLanguageIds() as $languageId) {
|
foreach ($this->getAvailableLanguageIds() as $languageId) {
|
||||||
try {
|
try {
|
||||||
$configs[$languageId] = $this->getSolrConnectionConfiguration($languageId);
|
$configs[$languageId] = $this->getMeilisearchConnectionConfiguration($languageId);
|
||||||
} catch (NoSolrConnectionFoundException $e) {}
|
} catch (NoMeilisearchConnectionFoundException $e) {}
|
||||||
}
|
}
|
||||||
return $configs;
|
return $configs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isEnabled(): bool
|
public function isEnabled(): bool
|
||||||
{
|
{
|
||||||
return !empty($this->getAllSolrConnectionConfigurations());
|
return !empty($this->getAllMeilisearchConnectionConfigurations());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $languageId
|
* @param int $languageId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
abstract function getSolrConnectionConfiguration(int $language = 0): array;
|
abstract function getMeilisearchConnectionConfiguration(int $language = 0): array;
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ class SiteHashService
|
|||||||
/**
|
/**
|
||||||
* Resolves magic keywords in allowed sites configuration.
|
* Resolves magic keywords in allowed sites configuration.
|
||||||
* Supported keywords:
|
* Supported keywords:
|
||||||
* __solr_current_site - The domain of the site the query has been started from
|
* __meilisearch_current_site - The domain of the site the query has been started from
|
||||||
* __current_site - Same as __solr_current_site
|
* __current_site - Same as __meilisearch_current_site
|
||||||
* __all - Adds all domains as allowed sites
|
* __all - Adds all domains as allowed sites
|
||||||
* * - Means all sites are allowed, same as no siteHash
|
* * - Means all sites are allowed, same as no siteHash
|
||||||
*
|
*
|
||||||
@ -56,8 +56,8 @@ class SiteHashService
|
|||||||
} elseif ($allowedSitesConfiguration === '*') {
|
} elseif ($allowedSitesConfiguration === '*') {
|
||||||
return '*';
|
return '*';
|
||||||
} else {
|
} else {
|
||||||
// we thread empty allowed site configurations as __solr_current_site since this is the default behaviour
|
// we thread empty allowed site configurations as __meilisearch_current_site since this is the default behaviour
|
||||||
$allowedSitesConfiguration = empty($allowedSitesConfiguration) ? '__solr_current_site' : $allowedSitesConfiguration;
|
$allowedSitesConfiguration = empty($allowedSitesConfiguration) ? '__meilisearch_current_site' : $allowedSitesConfiguration;
|
||||||
return $this->getDomainByPageIdAndReplaceMarkers($pageId, $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.
|
* and __current_site.
|
||||||
*
|
*
|
||||||
* @param integer $pageId
|
* @param integer $pageId
|
||||||
@ -108,7 +108,7 @@ class SiteHashService
|
|||||||
protected function getDomainByPageIdAndReplaceMarkers($pageId, $allowedSitesConfiguration)
|
protected function getDomainByPageIdAndReplaceMarkers($pageId, $allowedSitesConfiguration)
|
||||||
{
|
{
|
||||||
$domainOfPage = $this->getSiteByPageId($pageId)->getDomain();
|
$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;
|
return (string)$allowedSites;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\Domain\Site;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* This copyright notice MUST APPEAR in all copies of the script!
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use WapplerSystems\Meilisearch\NoSolrConnectionFoundException;
|
use WapplerSystems\Meilisearch\NoMeilisearchConnectionFoundException;
|
||||||
|
|
||||||
interface SiteInterface
|
interface SiteInterface
|
||||||
{
|
{
|
||||||
@ -52,11 +52,11 @@ interface SiteInterface
|
|||||||
public function getLabel();
|
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
|
* Gets the site's default language as configured in
|
||||||
@ -114,15 +114,15 @@ interface SiteInterface
|
|||||||
/**
|
/**
|
||||||
* @param int $language
|
* @param int $language
|
||||||
* @return array
|
* @return array
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getSolrConnectionConfiguration(int $language = 0): array;
|
public function getMeilisearchConnectionConfiguration(int $language = 0): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws NoSolrConnectionFoundException
|
* @throws NoMeilisearchConnectionFoundException
|
||||||
*/
|
*/
|
||||||
public function getAllSolrConnectionConfigurations(): array;
|
public function getAllMeilisearchConnectionConfigurations(): array;
|
||||||
|
|
||||||
public function isEnabled(): bool;
|
public function isEnabled(): bool;
|
||||||
}
|
}
|
||||||
|
@ -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
|
* @param bool $stopOnInvalidSite
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@ -180,18 +180,18 @@ class SiteRepository
|
|||||||
*/
|
*/
|
||||||
protected function getAvailableTYPO3ManagedSites(bool $stopOnInvalidSite): array
|
protected function getAvailableTYPO3ManagedSites(bool $stopOnInvalidSite): array
|
||||||
{
|
{
|
||||||
$typo3ManagedSolrSites = [];
|
$typo3ManagedMeilisearchSites = [];
|
||||||
$typo3Sites = $this->siteFinder->getAllSites();
|
$typo3Sites = $this->siteFinder->getAllSites();
|
||||||
foreach ($typo3Sites as $typo3Site) {
|
foreach ($typo3Sites as $typo3Site) {
|
||||||
try {
|
try {
|
||||||
$rootPageId = $typo3Site->getRootPageId();
|
$rootPageId = $typo3Site->getRootPageId();
|
||||||
if (isset($typo3ManagedSolrSites[$rootPageId])) {
|
if (isset($typo3ManagedMeilisearchSites[$rootPageId])) {
|
||||||
//get each site only once
|
//get each site only once
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$typo3ManagedSolrSite = $this->buildSite($rootPageId);
|
$typo3ManagedMeilisearchSite = $this->buildSite($rootPageId);
|
||||||
if ($typo3ManagedSolrSite->isEnabled()) {
|
if ($typo3ManagedMeilisearchSite->isEnabled()) {
|
||||||
$typo3ManagedSolrSites[$rootPageId] = $typo3ManagedSolrSite;
|
$typo3ManagedMeilisearchSites[$rootPageId] = $typo3ManagedMeilisearchSite;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} 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
|
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 */
|
/** @var \TYPO3\CMS\Core\Site\Entity\Site $typo3Site */
|
||||||
try {
|
try {
|
||||||
$typo3Site = $this->siteFinder->getSiteByPageId($rootPageRecord['uid']);
|
$typo3Site = $this->siteFinder->getSiteByPageId($rootPageRecord['uid']);
|
||||||
@ -278,36 +278,26 @@ class SiteRepository
|
|||||||
return $language->getLanguageId();
|
return $language->getLanguageId();
|
||||||
}, $typo3Site->getLanguages());
|
}, $typo3Site->getLanguages());
|
||||||
|
|
||||||
$solrConnectionConfigurations = [];
|
$meilisearchConnectionConfigurations = [];
|
||||||
|
|
||||||
foreach ($availableLanguageIds as $languageUid) {
|
foreach ($availableLanguageIds as $languageUid) {
|
||||||
$solrEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
|
$meilisearchEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
|
||||||
if ($solrEnabled) {
|
if ($meilisearchEnabled) {
|
||||||
$solrConnectionConfigurations[$languageUid] = [
|
$meilisearchConnectionConfigurations[$languageUid] = [
|
||||||
'connectionKey' => $rootPageRecord['uid'] . '|' . $languageUid,
|
'connectionKey' => $rootPageRecord['uid'] . '|' . $languageUid,
|
||||||
'rootPageTitle' => $rootPageRecord['title'],
|
'rootPageTitle' => $rootPageRecord['title'],
|
||||||
'rootPageUid' => $rootPageRecord['uid'],
|
'rootPageUid' => $rootPageRecord['uid'],
|
||||||
'read' => [
|
'read' => [
|
||||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'read', 'http'),
|
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'read', 'http'),
|
||||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'read', 'localhost'),
|
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'read', 'localhost'),
|
||||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 8983),
|
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 7700),
|
||||||
// @todo: transform core to path
|
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'read', ''),
|
||||||
'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', '')
|
|
||||||
],
|
],
|
||||||
'write' => [
|
'write' => [
|
||||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'write', 'http'),
|
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'write', 'http'),
|
||||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'write', 'localhost'),
|
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'write', 'localhost'),
|
||||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 8983),
|
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 7700),
|
||||||
// @todo: transform core to path
|
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'write', ''),
|
||||||
'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', '')
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'language' => $languageUid
|
'language' => $languageUid
|
||||||
@ -318,7 +308,7 @@ class SiteRepository
|
|||||||
return GeneralUtility::makeInstance(
|
return GeneralUtility::makeInstance(
|
||||||
Typo3ManagedSite::class,
|
Typo3ManagedSite::class,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
$solrConfiguration,
|
$meilisearchConfiguration,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
$rootPageRecord,
|
$rootPageRecord,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
@ -332,7 +322,7 @@ class SiteRepository
|
|||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
$availableLanguageIds,
|
$availableLanguageIds,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
$solrConnectionConfigurations,
|
$meilisearchConnectionConfigurations,
|
||||||
/** @scrutinizer ignore-type */
|
/** @scrutinizer ignore-type */
|
||||||
$typo3Site
|
$typo3Site
|
||||||
);
|
);
|
||||||
|
@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\Domain\Site;
|
|||||||
* This copyright notice MUST APPEAR in all copies of the script!
|
* 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\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository;
|
use WapplerSystems\Meilisearch\System\Records\Pages\PagesRepository;
|
||||||
use TYPO3\CMS\Core\Context\LanguageAspectFactory;
|
use TYPO3\CMS\Core\Context\LanguageAspectFactory;
|
||||||
@ -47,12 +47,12 @@ class Typo3ManagedSite extends Site
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $solrConnectionConfigurations;
|
protected $meilisearchConnectionConfigurations;
|
||||||
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TypoScriptConfiguration $configuration,
|
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->configuration = $configuration;
|
||||||
$this->rootPage = $page;
|
$this->rootPage = $page;
|
||||||
@ -61,31 +61,31 @@ class Typo3ManagedSite extends Site
|
|||||||
$this->pagesRepository = $pagesRepository ?? GeneralUtility::makeInstance(PagesRepository::class);
|
$this->pagesRepository = $pagesRepository ?? GeneralUtility::makeInstance(PagesRepository::class);
|
||||||
$this->defaultLanguageId = $defaultLanguageId;
|
$this->defaultLanguageId = $defaultLanguageId;
|
||||||
$this->availableLanguageIds = $availableLanguageIds;
|
$this->availableLanguageIds = $availableLanguageIds;
|
||||||
$this->solrConnectionConfigurations = $solrConnectionConfigurations;
|
$this->meilisearchConnectionConfigurations = $meilisearchConnectionConfigurations;
|
||||||
$this->typo3SiteObject = $typo3SiteObject;
|
$this->typo3SiteObject = $typo3SiteObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $language
|
* @param int $language
|
||||||
* @return array
|
* @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])) {
|
if (!is_array($this->meilisearchConnectionConfigurations[$language])) {
|
||||||
/* @var $noSolrConnectionException NoSolrConnectionFoundException */
|
/* @var $noMeilisearchConnectionException NoMeilisearchConnectionFoundException */
|
||||||
$noSolrConnectionException = GeneralUtility::makeInstance(
|
$noMeilisearchConnectionException = GeneralUtility::makeInstance(
|
||||||
NoSolrConnectionFoundException::class,
|
NoMeilisearchConnectionFoundException::class,
|
||||||
/** @scrutinizer ignore-type */ 'Could not find a Solr connection for root page [' . $this->getRootPageId() . '] and language [' . $language . '].',
|
/** @scrutinizer ignore-type */ 'Could not find a Meilisearch connection for root page [' . $this->getRootPageId() . '] and language [' . $language . '].',
|
||||||
/** @scrutinizer ignore-type */ 1552491117
|
/** @scrutinizer ignore-type */ 1552491117
|
||||||
);
|
);
|
||||||
$noSolrConnectionException->setRootPageId($this->getRootPageId());
|
$noMeilisearchConnectionException->setRootPageId($this->getRootPageId());
|
||||||
$noSolrConnectionException->setLanguageId($language);
|
$noMeilisearchConnectionException->setLanguageId($language);
|
||||||
|
|
||||||
throw $noSolrConnectionException;
|
throw $noMeilisearchConnectionException;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->solrConnectionConfigurations[$language];
|
return $this->meilisearchConnectionConfigurations[$language];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,11 +67,11 @@ class IdBuilder
|
|||||||
*/
|
*/
|
||||||
protected function applyHook($variantId, $systemHash, $type, $uid)
|
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;
|
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);
|
$variantIdModifier = GeneralUtility::makeInstance($classReference);
|
||||||
if ($variantIdModifier instanceof IdModifier) {
|
if ($variantIdModifier instanceof IdModifier) {
|
||||||
$variantId = $variantIdModifier->modifyVariantId($variantId, $systemHash, $type, $uid);
|
$variantId = $variantIdModifier->modifyVariantId($variantId, $systemHash, $type, $uid);
|
||||||
|
@ -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\SearchResultSet;
|
||||||
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetProcessor;
|
use WapplerSystems\Meilisearch\Domain\Search\ResultSet\SearchResultSetProcessor;
|
||||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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.
|
* to the parent search result object.
|
||||||
*/
|
*/
|
||||||
class VariantsProcessor implements SearchResultSetProcessor
|
class VariantsProcessor implements SearchResultSetProcessor
|
||||||
@ -114,7 +114,7 @@ class VariantsProcessor implements SearchResultSetProcessor
|
|||||||
$fields = get_object_vars($variantDocumentArray);
|
$fields = get_object_vars($variantDocumentArray);
|
||||||
$variantDocument = new SearchResult($fields);
|
$variantDocument = new SearchResult($fields);
|
||||||
|
|
||||||
$variantSearchResult = $this->resultBuilder->fromApacheSolrDocument($variantDocument);
|
$variantSearchResult = $this->resultBuilder->fromApacheMeilisearchDocument($variantDocument);
|
||||||
$variantSearchResult->setIsVariant(true);
|
$variantSearchResult->setIsVariant(true);
|
||||||
$variantSearchResult->setVariantParent($resultDocument);
|
$variantSearchResult->setVariantParent($resultDocument);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
Provides the sitehash for a given domain, valid for the current TYPO3
|
Provides the sitehash for a given domain, valid for the current TYPO3
|
||||||
installation.
|
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
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -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
|
* @param array $idRootline Array of Ids representing a rootline
|
||||||
* @return array Solr hierarchy
|
* @return array Meilisearch hierarchy
|
||||||
* @see http://wiki.apache.org/solr/HierarchicalFaceting
|
* @see http://wiki.apache.org/meilisearch/HierarchicalFaceting
|
||||||
*/
|
*/
|
||||||
protected function buildSolrHierarchyFromIdRootline(array $idRootline)
|
protected function buildMeilisearchHierarchyFromIdRootline(array $idRootline)
|
||||||
{
|
{
|
||||||
$hierarchy = [];
|
$hierarchy = [];
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ use WapplerSystems\Meilisearch\System\Records\SystemCategory\SystemCategoryRepos
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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:
|
* 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
|
* then we get a rootline 1/10/100/111
|
||||||
*
|
*
|
||||||
* In Solr hierarchy notation, we get
|
* In Meilisearch hierarchy notation, we get
|
||||||
*
|
*
|
||||||
* 0-1
|
* 0-1
|
||||||
* 1-1/10
|
* 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.
|
* rootline of the category ID.
|
||||||
*
|
*
|
||||||
* @param array $values Array of values, an array because of multivalued fields
|
* @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) {
|
foreach ($values as $value) {
|
||||||
$results = array_merge($results,
|
$results = array_merge($results,
|
||||||
$this->getSolrRootlineForCategoryId($value));
|
$this->getMeilisearchRootlineForCategoryId($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
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
|
* @param int $categoryId Category ID to get a rootline as Meilisearch hierarchy for
|
||||||
* @return array Rootline as Solr hierarchy array
|
* @return array Rootline as Meilisearch hierarchy array
|
||||||
*/
|
*/
|
||||||
protected function getSolrRootlineForCategoryId($categoryId)
|
protected function getMeilisearchRootlineForCategoryId($categoryId)
|
||||||
{
|
{
|
||||||
$categoryIdRootline = $this->buildCategoryIdRootline($categoryId);
|
$categoryIdRootline = $this->buildCategoryIdRootline($categoryId);
|
||||||
$solrRootline = $this->buildSolrHierarchyFromIdRootline($categoryIdRootline);
|
$meilisearchRootline = $this->buildMeilisearchHierarchyFromIdRootline($categoryIdRootline);
|
||||||
|
|
||||||
return $solrRootline;
|
return $meilisearchRootline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,9 +29,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|||||||
use TYPO3\CMS\Core\Utility\RootlineUtility;
|
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:
|
* 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
|
* then we get a rootline 1/10/100/111
|
||||||
*
|
*
|
||||||
* In Solr hierarchy notation, we get
|
* In Meilisearch hierarchy notation, we get
|
||||||
*
|
*
|
||||||
* 0-1/
|
* 0-1/
|
||||||
* 1-1/10/
|
* 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.
|
* rootline of the page ID.
|
||||||
*
|
*
|
||||||
* @param array $values Array of values, an array because of multivalued fields
|
* @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) {
|
foreach ($values as $value) {
|
||||||
list($rootPageUid, $mountPoint) = GeneralUtility::trimExplode(',',
|
list($rootPageUid, $mountPoint) = GeneralUtility::trimExplode(',',
|
||||||
$value, true, 2);
|
$value, true, 2);
|
||||||
$results[] = $this->getSolrRootlineForPageId($rootPageUid,
|
$results[] = $this->getMeilisearchRootlineForPageId($rootPageUid,
|
||||||
$mountPoint);
|
$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.
|
* @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);
|
$pageIdRootline = $this->buildPageIdRootline($pageId, $mountPoint);
|
||||||
$solrRootline = $this->buildSolrHierarchyFromIdRootline($pageIdRootline);
|
$meilisearchRootline = $this->buildMeilisearchHierarchyFromIdRootline($pageIdRootline);
|
||||||
|
|
||||||
return $solrRootline;
|
return $meilisearchRootline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@ class PathToHierarchy implements FieldProcessor
|
|||||||
$results = [];
|
$results = [];
|
||||||
|
|
||||||
foreach ($values as $value) {
|
foreach ($values as $value) {
|
||||||
$valueResults = $this->buildSolrHierarchyFromPath($value);
|
$valueResults = $this->buildMeilisearchHierarchyFromPath($value);
|
||||||
$results = array_merge($results, $valueResults);
|
$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
|
* @param string $path path string
|
||||||
* @return array Solr hierarchy
|
* @return array Meilisearch hierarchy
|
||||||
* @see http://wiki.apache.org/solr/HierarchicalFaceting
|
* @see http://wiki.apache.org/meilisearch/HierarchicalFaceting
|
||||||
*/
|
*/
|
||||||
protected function buildSolrHierarchyFromPath($path)
|
protected function buildMeilisearchHierarchyFromPath($path)
|
||||||
{
|
{
|
||||||
$hierarchy = [];
|
$hierarchy = [];
|
||||||
$path = HierarchyTool::substituteSlashes($path);
|
$path = HierarchyTool::substituteSlashes($path);
|
||||||
|
@ -29,11 +29,11 @@ use WapplerSystems\Meilisearch\FieldProcessor\PageUidToHierarchy;
|
|||||||
use WapplerSystems\Meilisearch\FieldProcessor\PathToHierarchy;
|
use WapplerSystems\Meilisearch\FieldProcessor\PathToHierarchy;
|
||||||
use WapplerSystems\Meilisearch\FieldProcessor\TimestampToIsoDate;
|
use WapplerSystems\Meilisearch\FieldProcessor\TimestampToIsoDate;
|
||||||
use WapplerSystems\Meilisearch\FieldProcessor\TimestampToUtcIsoDate;
|
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;
|
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
|
* common field processing during indexing or resolving
|
||||||
*
|
*
|
||||||
* @author Daniel Poetzinger <poetzinger@aoemedia.de>
|
* @author Daniel Poetzinger <poetzinger@aoemedia.de>
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\System\DateTime\FormatService;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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>
|
* @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
|
* Example date output format: 1995-12-31T23:59:59Z
|
||||||
* The trailing "Z" designates UTC time and is mandatory
|
* The trailing "Z" designates UTC time and is mandatory
|
||||||
|
@ -28,7 +28,7 @@ use WapplerSystems\Meilisearch\System\DateTime\FormatService;
|
|||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
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>
|
* @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
|
* Example date output format: 1995-12-31T23:59:59Z
|
||||||
* The trailing "Z" designates UTC time and is mandatory
|
* The trailing "Z" designates UTC time and is mandatory
|
||||||
|
@ -119,7 +119,7 @@ class FrontendEnvironment implements SingletonInterface
|
|||||||
* @param ?int $language
|
* @param ?int $language
|
||||||
* @return TypoScriptConfiguration
|
* @return TypoScriptConfiguration
|
||||||
*/
|
*/
|
||||||
public function getSolrConfigurationFromPageId($pageId, $language = 0): TypoScriptConfiguration
|
public function getMeilisearchConfigurationFromPageId($pageId, $language = 0): TypoScriptConfiguration
|
||||||
{
|
{
|
||||||
return $this->getConfigurationFromPageId($pageId, '', $language);
|
return $this->getConfigurationFromPageId($pageId, '', $language);
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,10 @@ class TypoScript implements SingletonInterface
|
|||||||
* Language usage may be disabled to get the default TypoScript
|
* Language usage may be disabled to get the default TypoScript
|
||||||
* configuration.
|
* 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 string $path The TypoScript configuration path to retrieve.
|
||||||
* @param int $language System language uid, optional, defaults to 0
|
* @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)
|
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 integer $pageId
|
||||||
* @param string $path
|
* @param string $path
|
||||||
|
@ -164,7 +164,7 @@ class GarbageCollector extends AbstractDataHandlerListener implements SingletonI
|
|||||||
// ...still needed?
|
// ...still needed?
|
||||||
|
|
||||||
// must be removed from index since the pid changes and
|
// 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);
|
$this->collectGarbage($table, $uid);
|
||||||
|
|
||||||
// now re-index with new properties
|
// now re-index with new properties
|
||||||
|
@ -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
|
* 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
|
* are valid in the font being used in the document but are not available in the
|
||||||
* font being used for displaying results.
|
* font being used for displaying results.
|
||||||
@ -63,7 +63,7 @@ class HtmlContentExtractor
|
|||||||
*/
|
*/
|
||||||
protected $content;
|
protected $content;
|
||||||
/**
|
/**
|
||||||
* Mapping of HTML tags to Solr document fields.
|
* Mapping of HTML tags to Meilisearch document fields.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
@ -104,7 +104,7 @@ class HtmlContentExtractor
|
|||||||
protected function getConfiguration()
|
protected function getConfiguration()
|
||||||
{
|
{
|
||||||
if ($this->configuration == null) {
|
if ($this->configuration == null) {
|
||||||
$this->configuration = Util::getSolrConfiguration();
|
$this->configuration = Util::getMeilisearchConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->configuration;
|
return $this->configuration;
|
||||||
@ -121,7 +121,7 @@ class HtmlContentExtractor
|
|||||||
/**
|
/**
|
||||||
* Returns the cleaned indexable content from the page's HTML markup.
|
* 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.
|
* stumble on.
|
||||||
*
|
*
|
||||||
* @return string Indexable, cleaned content ready for indexing.
|
* @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
|
* @param string $content the content to sanitize
|
||||||
* @return string the sanitized content
|
* @return string the sanitized content
|
||||||
@ -220,7 +220,7 @@ class HtmlContentExtractor
|
|||||||
/**
|
/**
|
||||||
* Extracts HTML tag content from tags in the content marked for indexing.
|
* 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()
|
public function getTagContent()
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user