first commit
This commit is contained in:
@@ -107,7 +107,7 @@ class ExtensionConfiguration
|
||||
*/
|
||||
public function getIsAllowLegacySiteModeEnabled(): bool
|
||||
{
|
||||
trigger_error('solr:deprecation: Method getIsAllowLegacySiteModeEnabled is deprecated since EXT:meilisearch 11 and will be removed in 12. Since EXT:meilisearch 10 legacy site handling is deprecated and was removed in EXT:meilisearch 11.', E_USER_DEPRECATED);
|
||||
trigger_error('meilisearch:deprecation: Method getIsAllowLegacySiteModeEnabled is deprecated since EXT:meilisearch 11 and will be removed in 12. Since EXT:meilisearch 10 legacy site handling is deprecated and was removed in EXT:meilisearch 11.', E_USER_DEPRECATED);
|
||||
|
||||
//@todo throw exception if set to true and log deprecation
|
||||
$legacyModeIsActive = $this->getConfigurationOrDefaultValue('allowLegacySiteMode', false);
|
||||
|
@@ -119,7 +119,7 @@ class TypoScriptConfiguration
|
||||
* In the context of an frontend content element the path plugin.tx_meilisearch is
|
||||
* merged recursive with overrule with the content element specific typoscript
|
||||
* settings, like plugin.tx_meilisearch_PiResults_Results, and possible flex form settings
|
||||
* (depends on the solr plugin).
|
||||
* (depends on the meilisearch plugin).
|
||||
*
|
||||
* Example: plugin.tx_meilisearch.search.targetPage
|
||||
* returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_meilisearch.']['search.']['targetPage']
|
||||
@@ -161,7 +161,7 @@ class TypoScriptConfiguration
|
||||
* In the context of an frontend content element the path plugin.tx_meilisearch is
|
||||
* merged recursive with overrule with the content element specific typoscript
|
||||
* settings, like plugin.tx_meilisearch_PiResults_Results, and possible flex form settings
|
||||
* (depends on the solr plugin).
|
||||
* (depends on the meilisearch plugin).
|
||||
*
|
||||
* Example: plugin.tx_meilisearch.index.queue.tt_news.fields.content
|
||||
* returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_meilisearch.']['index.']['queue.']['tt_news.']['fields.']['content.']
|
||||
@@ -236,7 +236,7 @@ class TypoScriptConfiguration
|
||||
* @param bool $enableUnsetFeature If set, special values "__UNSET" can be used in the overrule array in order to unset array keys in the original array.
|
||||
* @return TypoScriptConfiguration
|
||||
*/
|
||||
public function mergeSolrConfiguration(array $configurationToMerge, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
|
||||
public function mergeMeilisearchConfiguration(array $configurationToMerge, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
|
||||
{
|
||||
$data = $this->configurationAccess->getData();
|
||||
ArrayUtility::mergeRecursiveWithOverrule(
|
||||
@@ -253,7 +253,7 @@ class TypoScriptConfiguration
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when ext_solr is enabled
|
||||
* Returns true when ext_meilisearch is enabled
|
||||
*
|
||||
* @param boolean $defaultIfEmpty
|
||||
* @return boolean
|
||||
@@ -280,7 +280,7 @@ class TypoScriptConfiguration
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all solr fields names where a mapping is configured in index.additionalFields
|
||||
* Returns all meilisearch fields names where a mapping is configured in index.additionalFields
|
||||
*
|
||||
* Returns all keys from
|
||||
* plugin.tx_meilisearch.index.additionalFields.
|
||||
@@ -483,7 +483,7 @@ class TypoScriptConfiguration
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all solr fields names where a mapping configuration is set for a certain index configuration
|
||||
* Returns all meilisearch fields names where a mapping configuration is set for a certain index configuration
|
||||
*
|
||||
* Returns all keys from
|
||||
* plugin.tx_meilisearch.index.queue.<configurationName>.fields.
|
||||
@@ -2046,11 +2046,11 @@ class TypoScriptConfiguration
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls whether ext-solr will send commits to solr.
|
||||
* Controls whether ext-meilisearch will send commits to meilisearch.
|
||||
* Beware: If you disable this, you need to ensure
|
||||
* that some other mechanism will commit your changes
|
||||
* otherwise they will never be searchable.
|
||||
* A good way to achieve this is enabling the solr
|
||||
* A good way to achieve this is enabling the meilisearch
|
||||
* daemons autoCommit feature.
|
||||
*
|
||||
* plugin.tx_meilisearch.index.enableCommits
|
||||
|
@@ -59,7 +59,7 @@ class ClearCacheActionsHook implements ClearCacheActionsHookInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a menu entry to the clear cache menu to detect Solr connections.
|
||||
* Adds a menu entry to the clear cache menu to detect Meilisearch connections.
|
||||
*
|
||||
* @param array $cacheActions Array of CacheMenuItems
|
||||
* @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier)
|
||||
@@ -70,13 +70,13 @@ class ClearCacheActionsHook implements ClearCacheActionsHookInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$href = $this->uriBuilder->buildUriFromRoute('ajax_solr_updateConnections');
|
||||
$optionValues[] = 'clearSolrConnectionCache';
|
||||
$href = $this->uriBuilder->buildUriFromRoute('ajax_meilisearch_updateConnections');
|
||||
$optionValues[] = 'clearMeilisearchConnectionCache';
|
||||
$cacheActions[] = [
|
||||
'id' => 'clearSolrConnectionCache',
|
||||
'title' => 'LLL:EXT:meilisearch/Resources/Private/Language/locallang.xlf:cache_initialize_solr_connections',
|
||||
'id' => 'clearMeilisearchConnectionCache',
|
||||
'title' => 'LLL:EXT:meilisearch/Resources/Private/Language/locallang.xlf:cache_initialize_meilisearch_connections',
|
||||
'href' => $href,
|
||||
'iconIdentifier' => 'extensions-solr-module-initsolrconnections'
|
||||
'iconIdentifier' => 'extensions-meilisearch-module-initmeilisearchconnections'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ class DebugWriter
|
||||
*/
|
||||
protected function getIsDebugOutputEnabled()
|
||||
{
|
||||
return Util::getSolrConfiguration()->getLoggingDebugOutput();
|
||||
return Util::getMeilisearchConfiguration()->getLoggingDebugOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ class DebugWriter
|
||||
$parameters = ['extKey' => 'meilisearch', 'msg' => $message, 'level' => $level, 'data' => $data];
|
||||
$message = isset($parameters['msg']) ? $parameters['msg'] : '';
|
||||
if (TYPO3_MODE === 'BE') {
|
||||
DebugUtility::debug($parameters, $parameters['extKey'], 'DevLog ext:solr: ' . $message);
|
||||
DebugUtility::debug($parameters, $parameters['extKey'], 'DevLog ext:meilisearch: ' . $message);
|
||||
} else {
|
||||
echo $message . ':<br/>';
|
||||
DebuggerUtility::var_dump($parameters);
|
||||
|
@@ -35,7 +35,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
*
|
||||
* @author Thomas Hohn <tho@systime.dk>
|
||||
*/
|
||||
class SolrLogManager
|
||||
class MeilisearchLogManager
|
||||
{
|
||||
const WARNING = LogLevel::WARNING;
|
||||
const ERROR = LogLevel::ERROR;
|
||||
@@ -58,7 +58,7 @@ class SolrLogManager
|
||||
protected $className = '';
|
||||
|
||||
/**
|
||||
* SolrLogManager constructor.
|
||||
* MeilisearchLogManager constructor.
|
||||
*
|
||||
* @param string $className
|
||||
* @param DebugWriter $debugWriter
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Document;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Document;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -25,28 +25,28 @@ namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
* This exception or a more specific one should be thrown when the is an error in the communication with the solr server.
|
||||
* This exception or a more specific one should be thrown when the is an error in the communication with the meilisearch server.
|
||||
*/
|
||||
class SolrCommunicationException extends \RuntimeException {
|
||||
class MeilisearchCommunicationException extends \RuntimeException {
|
||||
|
||||
/**
|
||||
* @var ResponseAdapter
|
||||
*/
|
||||
protected $solrResponse;
|
||||
protected $meilisearchResponse;
|
||||
|
||||
/**
|
||||
* @return ResponseAdapter
|
||||
*/
|
||||
public function getSolrResponse(): ResponseAdapter
|
||||
public function getMeilisearchResponse(): ResponseAdapter
|
||||
{
|
||||
return $this->solrResponse;
|
||||
return $this->meilisearchResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseAdapter $solrResponse
|
||||
* @param ResponseAdapter $meilisearchResponse
|
||||
*/
|
||||
public function setSolrResponse(ResponseAdapter $solrResponse)
|
||||
public function setMeilisearchResponse(ResponseAdapter $meilisearchResponse)
|
||||
{
|
||||
$this->solrResponse = $solrResponse;
|
||||
$this->meilisearchResponse = $meilisearchResponse;
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -24,14 +24,15 @@ namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use MeiliSearch\Client;
|
||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Parser\SchemaParser;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Parser\StopWordParser;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Parser\SynonymParser;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Service\SolrAdminService;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Service\SolrReadService;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Service\SolrWriteService;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Parser\SchemaParser;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Parser\StopWordParser;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Parser\SynonymParser;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Service\MeilisearchAdminService;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Service\MeilisearchReadService;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Service\MeilisearchWriteService;
|
||||
use WapplerSystems\Meilisearch\Util;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -39,29 +40,27 @@ use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Solarium\Client;
|
||||
use Solarium\Core\Client\Adapter\Psr18Adapter;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Solr Service Access
|
||||
* Meilisearch Service Access
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class SolrConnection
|
||||
class MeilisearchConnection
|
||||
{
|
||||
/**
|
||||
* @var SolrAdminService
|
||||
* @var MeilisearchAdminService
|
||||
*/
|
||||
protected $adminService;
|
||||
|
||||
/**
|
||||
* @var SolrReadService
|
||||
* @var MeilisearchReadService
|
||||
*/
|
||||
protected $readService;
|
||||
|
||||
/**
|
||||
* @var SolrWriteService
|
||||
* @var MeilisearchWriteService
|
||||
*/
|
||||
protected $writeService;
|
||||
|
||||
@@ -86,12 +85,12 @@ class SolrConnection
|
||||
protected $schemaParser = null;
|
||||
|
||||
/**
|
||||
* @var Node[]
|
||||
* @var Client[]
|
||||
*/
|
||||
protected $nodes = [];
|
||||
|
||||
/**
|
||||
* @var SolrLogManager
|
||||
* @var MeilisearchLogManager
|
||||
*/
|
||||
protected $logger = null;
|
||||
|
||||
@@ -123,13 +122,13 @@ class SolrConnection
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Node $readNode
|
||||
* @param Node $writeNode
|
||||
* @param Client $readNode
|
||||
* @param Client $writeNode
|
||||
* @param ?TypoScriptConfiguration $configuration
|
||||
* @param ?SynonymParser $synonymParser
|
||||
* @param ?StopWordParser $stopWordParser
|
||||
* @param ?SchemaParser $schemaParser
|
||||
* @param ?SolrLogManager $logManager
|
||||
* @param ?MeilisearchLogManager $logManager
|
||||
* @param ?ClientInterface $psr7Client
|
||||
* @param ?RequestFactoryInterface $requestFactory
|
||||
* @param ?StreamFactoryInterface $streamFactory
|
||||
@@ -139,45 +138,41 @@ class SolrConnection
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function __construct(
|
||||
Node $readNode,
|
||||
Node $writeNode,
|
||||
Client $readNode,
|
||||
Client $writeNode,
|
||||
TypoScriptConfiguration $configuration = null,
|
||||
SynonymParser $synonymParser = null,
|
||||
StopWordParser $stopWordParser = null,
|
||||
SchemaParser $schemaParser = null,
|
||||
SolrLogManager $logManager = null,
|
||||
MeilisearchLogManager $logManager = null,
|
||||
ClientInterface $psr7Client = null,
|
||||
RequestFactoryInterface $requestFactory = null,
|
||||
StreamFactoryInterface $streamFactory = null,
|
||||
EventDispatcherInterface $eventDispatcher = null
|
||||
) {
|
||||
$this->nodes['read'] = $readNode;
|
||||
$this->nodes['write'] = $writeNode;
|
||||
$this->nodes['admin'] = $writeNode;
|
||||
$this->configuration = $configuration ?? Util::getSolrConfiguration();
|
||||
$this->configuration = $configuration ?? Util::getMeilisearchConfiguration();
|
||||
$this->synonymParser = $synonymParser;
|
||||
$this->stopWordParser = $stopWordParser;
|
||||
$this->schemaParser = $schemaParser;
|
||||
$this->logger = $logManager;
|
||||
$this->psr7Client = $psr7Client ?? GeneralUtility::getContainer()->get(ClientInterface::class);
|
||||
$this->requestFactory = $requestFactory ?? GeneralUtility::getContainer()->get(RequestFactoryInterface::class);
|
||||
$this->streamFactory = $streamFactory ?? GeneralUtility::getContainer()->get(StreamFactoryInterface::class);
|
||||
$this->eventDispatcher = $eventDispatcher ?? GeneralUtility::getContainer()->get(EventDispatcherInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return Node
|
||||
* @return Client
|
||||
*/
|
||||
public function getNode(string $key): Node
|
||||
public function getNode(string $key): Client
|
||||
{
|
||||
return $this->nodes[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SolrAdminService
|
||||
* @return MeilisearchAdminService
|
||||
*/
|
||||
public function getAdminService(): SolrAdminService
|
||||
public function getAdminService(): MeilisearchAdminService
|
||||
{
|
||||
if ($this->adminService === null) {
|
||||
$this->adminService = $this->buildAdminService();
|
||||
@@ -187,21 +182,20 @@ class SolrConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SolrAdminService
|
||||
* @return MeilisearchAdminService
|
||||
* @noinspection PhpIncompatibleReturnTypeInspection
|
||||
*/
|
||||
protected function buildAdminService(): SolrAdminService
|
||||
protected function buildAdminService(): MeilisearchAdminService
|
||||
{
|
||||
$endpointKey = 'admin';
|
||||
$client = $this->getClient($endpointKey);
|
||||
$this->initializeClient($client, $endpointKey);
|
||||
return GeneralUtility::makeInstance(SolrAdminService::class, $client, $this->configuration, $this->logger, $this->synonymParser, $this->stopWordParser, $this->schemaParser);
|
||||
return GeneralUtility::makeInstance(MeilisearchAdminService::class, $client, $this->configuration, $this->logger, $this->synonymParser, $this->stopWordParser, $this->schemaParser);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SolrReadService
|
||||
* @return MeilisearchReadService
|
||||
*/
|
||||
public function getReadService(): SolrReadService
|
||||
public function getReadService(): MeilisearchReadService
|
||||
{
|
||||
if ($this->readService === null) {
|
||||
$this->readService = $this->buildReadService();
|
||||
@@ -211,21 +205,20 @@ class SolrConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SolrReadService
|
||||
* @return MeilisearchReadService
|
||||
* @noinspection PhpIncompatibleReturnTypeInspection
|
||||
*/
|
||||
protected function buildReadService(): SolrReadService
|
||||
protected function buildReadService(): MeilisearchReadService
|
||||
{
|
||||
$endpointKey = 'read';
|
||||
$client = $this->getClient($endpointKey);
|
||||
$this->initializeClient($client, $endpointKey);
|
||||
return GeneralUtility::makeInstance(SolrReadService::class, $client);
|
||||
return GeneralUtility::makeInstance(MeilisearchReadService::class, $client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SolrWriteService
|
||||
* @return MeilisearchWriteService
|
||||
*/
|
||||
public function getWriteService(): SolrWriteService
|
||||
public function getWriteService(): MeilisearchWriteService
|
||||
{
|
||||
if ($this->writeService === null) {
|
||||
$this->writeService = $this->buildWriteService();
|
||||
@@ -235,70 +228,16 @@ class SolrConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SolrWriteService
|
||||
* @return MeilisearchWriteService
|
||||
* @noinspection PhpIncompatibleReturnTypeInspection
|
||||
*/
|
||||
protected function buildWriteService(): SolrWriteService
|
||||
protected function buildWriteService(): MeilisearchWriteService
|
||||
{
|
||||
$endpointKey = 'write';
|
||||
$client = $this->getClient($endpointKey);
|
||||
$this->initializeClient($client, $endpointKey);
|
||||
return GeneralUtility::makeInstance(SolrWriteService::class, $client);
|
||||
return GeneralUtility::makeInstance(MeilisearchWriteService::class, $client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @param string $endpointKey
|
||||
* @return Client
|
||||
*/
|
||||
protected function initializeClient(Client $client, string $endpointKey): Client
|
||||
{
|
||||
if (trim($this->getNode($endpointKey)->getUsername()) === '') {
|
||||
return $client;
|
||||
}
|
||||
|
||||
$username = $this->getNode($endpointKey)->getUsername();
|
||||
$password = $this->getNode($endpointKey)->getPassword();
|
||||
$this->setAuthenticationOnAllEndpoints($client, $username, $password);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*/
|
||||
protected function setAuthenticationOnAllEndpoints(Client $client, string $username, string $password)
|
||||
{
|
||||
foreach ($client->getEndpoints() as $endpoint) {
|
||||
$endpoint->setAuthentication($username, $password);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $endpointKey
|
||||
* @return Client
|
||||
*/
|
||||
protected function getClient(string $endpointKey): Client
|
||||
{
|
||||
if ($this->clients[$endpointKey]) {
|
||||
return $this->clients[$endpointKey];
|
||||
}
|
||||
|
||||
$adapter = new Psr18Adapter($this->psr7Client, $this->requestFactory, $this->streamFactory);
|
||||
|
||||
$client = new Client($adapter, $this->eventDispatcher);
|
||||
$client->getPlugin('postbigrequest');
|
||||
$client->clearEndpoints();
|
||||
|
||||
$newEndpointOptions = $this->getNode($endpointKey)->getSolariumClientOptions();
|
||||
$newEndpointOptions['key'] = $endpointKey;
|
||||
$client->createEndpoint($newEndpointOptions, true);
|
||||
|
||||
$this->clients[$endpointKey] = $client;
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -26,6 +26,6 @@ namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
* This exception is used when the solr an 500 internal server error is thrown by the solr server
|
||||
* This exception should be thrown when the response from meilisearch was incomplete
|
||||
*/
|
||||
class SolrInternalServerErrorException extends SolrCommunicationException {}
|
||||
class MeilisearchIncompleteResponseException extends MeilisearchCommunicationException {}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -26,6 +26,6 @@ namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
* This exception is used when the solr server is unavailable.
|
||||
* This exception is used when the meilisearch an 500 internal server error is thrown by the meilisearch server
|
||||
*/
|
||||
class SolrUnavailableException extends SolrCommunicationException {}
|
||||
class MeilisearchInternalServerErrorException extends MeilisearchCommunicationException {}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -26,6 +26,6 @@ namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
* This exception should be thrown when the response from solr was incomplete
|
||||
* This exception is used when the meilisearch server is unavailable.
|
||||
*/
|
||||
class SolrIncompleteResponseException extends SolrCommunicationException {}
|
||||
class MeilisearchUnavailableException extends MeilisearchCommunicationException {}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Parser;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Parser;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -25,11 +25,11 @@ namespace WapplerSystems\Meilisearch\System\Solr\Parser;
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\System\Solr\Schema\Schema;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Schema\Schema;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Class to parse the schema from a solr response.
|
||||
* Class to parse the schema from a meilisearch response.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ class SchemaParser
|
||||
{
|
||||
|
||||
/**
|
||||
* Parse the solr stopwords response from an json string to an array.
|
||||
* Parse the meilisearch stopwords response from an json string to an array.
|
||||
*
|
||||
* @param string $jsonString
|
||||
* @return Schema
|
||||
@@ -63,7 +63,7 @@ class SchemaParser
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the language from a solr schema response.
|
||||
* Extracts the language from a meilisearch schema response.
|
||||
*
|
||||
* @param \stdClass $schema
|
||||
* @return string
|
||||
@@ -81,7 +81,7 @@ class SchemaParser
|
||||
}
|
||||
// we have a text field
|
||||
foreach ($fieldType->queryAnalyzer->filters as $filter) {
|
||||
if ($filter->class === 'solr.ManagedSynonymGraphFilterFactory') {
|
||||
if ($filter->class === 'meilisearch.ManagedSynonymGraphFilterFactory') {
|
||||
$language = $filter->managed;
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Parser;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Parser;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\System\Solr\Parser;
|
||||
|
||||
|
||||
/**
|
||||
* Class to parse the stopwords from a solr response.
|
||||
* Class to parse the stopwords from a meilisearch response.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ class StopWordParser
|
||||
{
|
||||
|
||||
/**
|
||||
* Parse the solr stopwords response from an json string to an array.
|
||||
* Parse the meilisearch stopwords response from an json string to an array.
|
||||
*
|
||||
* @param string $jsonString
|
||||
* @return array
|
||||
@@ -56,12 +56,12 @@ class StopWordParser
|
||||
/**
|
||||
* @param string|array $stopWords
|
||||
* @return string
|
||||
* @throws \Apache_Solr_InvalidArgumentException
|
||||
* @throws \Apache_Meilisearch_InvalidArgumentException
|
||||
*/
|
||||
public function toJson($stopWords)
|
||||
{
|
||||
if (empty($stopWords)) {
|
||||
throw new \Apache_Solr_InvalidArgumentException('Must provide stop word.');
|
||||
throw new \Apache_Meilisearch_InvalidArgumentException('Must provide stop word.');
|
||||
}
|
||||
|
||||
if (is_string($stopWords)) {
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Parser;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Parser;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\System\Solr\Parser;
|
||||
|
||||
|
||||
/**
|
||||
* Class to parse the synonyms from a solr response.
|
||||
* Class to parse the synonyms from a meilisearch response.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ class SynonymParser
|
||||
{
|
||||
|
||||
/**
|
||||
* Parse the solr synonyms response from an json string to an array.
|
||||
* Parse the meilisearch synonyms response from an json string to an array.
|
||||
*
|
||||
* @param string $baseWord
|
||||
* @param string $jsonString
|
||||
@@ -62,12 +62,12 @@ class SynonymParser
|
||||
* @param string $baseWord
|
||||
* @param array $synonyms
|
||||
* @return string
|
||||
* @throws \Apache_Solr_InvalidArgumentException
|
||||
* @throws \Apache_Meilisearch_InvalidArgumentException
|
||||
*/
|
||||
public function toJson($baseWord, $synonyms)
|
||||
{
|
||||
if (empty($baseWord) || empty($synonyms)) {
|
||||
throw new \Apache_Solr_InvalidArgumentException('Must provide base word and synonyms.');
|
||||
throw new \Apache_Meilisearch_InvalidArgumentException('Must provide base word and synonyms.');
|
||||
}
|
||||
|
||||
return json_encode([$baseWord => $synonyms]);
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
/**
|
||||
* This class provides static helper functions that are helpful during the result parsing for solr.
|
||||
* This class provides static helper functions that are helpful during the result parsing for meilisearch.
|
||||
*/
|
||||
class ParsingUtil
|
||||
{
|
@@ -15,7 +15,7 @@ declare(strict_types=1);
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
|
||||
use GuzzleHttp\Client as GuzzleClient;
|
||||
use Psr\Http\Message\ResponseInterface;
|
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
|
||||
use Countable;
|
||||
|
||||
/**
|
||||
* In EXT:meilisearch 9 we have switched from the SolrPhpClient to the solarium api.
|
||||
* In EXT:meilisearch 9 we have switched from the MeilisearchPhpClient to the solarium api.
|
||||
*
|
||||
* In many places of the code the class Apache_Solr_Response and the property Apache_Solr_Response::reponse is used.
|
||||
* To be able to refactor this we need to have a replacement for Apache_Solr_Response that behaves like the original class,
|
||||
* to keep the old code working. This allows us to drop the old code of SolrPhpClient and refactore the other parts step by step.
|
||||
* In many places of the code the class Apache_Meilisearch_Response and the property Apache_Meilisearch_Response::reponse is used.
|
||||
* To be able to refactor this we need to have a replacement for Apache_Meilisearch_Response that behaves like the original class,
|
||||
* to keep the old code working. This allows us to drop the old code of MeilisearchPhpClient and refactore the other parts step by step.
|
||||
*
|
||||
* Class ResponseAdapter
|
||||
*
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Schema;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Schema;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -27,7 +27,7 @@ namespace WapplerSystems\Meilisearch\System\Solr\Schema;
|
||||
|
||||
|
||||
/**
|
||||
* Object representation of the solr schema.
|
||||
* Object representation of the meilisearch schema.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
*/
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Service;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -26,8 +26,8 @@ namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
|
||||
use WapplerSystems\Meilisearch\PingFailedException;
|
||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\Util;
|
||||
use Solarium\Client;
|
||||
use Solarium\Core\Client\Endpoint;
|
||||
@@ -37,7 +37,7 @@ use Solarium\Exception\HttpException;
|
||||
use TYPO3\CMS\Core\Http\Uri;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
abstract class AbstractSolrService
|
||||
abstract class AbstractMeilisearchService
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ abstract class AbstractSolrService
|
||||
protected $configuration;
|
||||
|
||||
/**
|
||||
* @var \WapplerSystems\Meilisearch\System\Logging\SolrLogManager
|
||||
* @var \WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager
|
||||
*/
|
||||
protected $logger = null;
|
||||
|
||||
@@ -61,17 +61,17 @@ abstract class AbstractSolrService
|
||||
protected $client = null;
|
||||
|
||||
/**
|
||||
* SolrReadService constructor.
|
||||
* MeilisearchReadService constructor.
|
||||
*/
|
||||
public function __construct(Client $client, $typoScriptConfiguration = null, $logManager = null)
|
||||
{
|
||||
$this->client = $client;
|
||||
$this->configuration = $typoScriptConfiguration ?? Util::getSolrConfiguration();
|
||||
$this->logger = $logManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
||||
$this->configuration = $typoScriptConfiguration ?? Util::getMeilisearchConfiguration();
|
||||
$this->logger = $logManager ?? GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the core solr path + core path.
|
||||
* Returns the path to the core meilisearch path + core path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -105,10 +105,10 @@ abstract class AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string representation of the Solr connection. Specifically
|
||||
* will return the Solr URL.
|
||||
* Creates a string representation of the Meilisearch connection. Specifically
|
||||
* will return the Meilisearch URL.
|
||||
*
|
||||
* @return string The Solr URL.
|
||||
* @return string The Meilisearch URL.
|
||||
* @TODO: Add support for API version 2
|
||||
*/
|
||||
public function __toString()
|
||||
@@ -134,7 +134,7 @@ abstract class AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Central method for making a get operation against this Solr Server
|
||||
* Central method for making a get operation against this Meilisearch Server
|
||||
*
|
||||
* @param string $url
|
||||
* @return ResponseAdapter
|
||||
@@ -145,7 +145,7 @@ abstract class AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Central method for making a HTTP DELETE operation against the Solr server
|
||||
* Central method for making a HTTP DELETE operation against the Meilisearch server
|
||||
*
|
||||
* @param string $url
|
||||
* @return ResponseAdapter
|
||||
@@ -156,7 +156,7 @@ abstract class AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Central method for making a post operation against this Solr Server
|
||||
* Central method for making a post operation against this Meilisearch Server
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $rawPost
|
||||
@@ -189,7 +189,7 @@ abstract class AbstractSolrService
|
||||
$body = '',
|
||||
\Closure $initializeRequest = null
|
||||
) {
|
||||
$logSeverity = SolrLogManager::INFO;
|
||||
$logSeverity = MeilisearchLogManager::INFO;
|
||||
$exception = null;
|
||||
$url = $this->reviseUrl($url);
|
||||
try {
|
||||
@@ -199,12 +199,12 @@ abstract class AbstractSolrService
|
||||
}
|
||||
$response = $this->executeRequest($request);
|
||||
} catch (HttpException $exception) {
|
||||
$logSeverity = SolrLogManager::ERROR;
|
||||
$logSeverity = MeilisearchLogManager::ERROR;
|
||||
$response = new ResponseAdapter($exception->getBody(), $exception->getCode(), $exception->getMessage());
|
||||
}
|
||||
|
||||
if ($this->configuration->getLoggingQueryRawPost() || $response->getHttpStatus() != 200) {
|
||||
$message = 'Querying Solr using '.$method;
|
||||
$message = 'Querying Meilisearch using '.$method;
|
||||
$this->writeLog($logSeverity, $message, $url, $response, $exception, $body);
|
||||
}
|
||||
|
||||
@@ -251,28 +251,28 @@ abstract class AbstractSolrService
|
||||
* @param integer $logSeverity
|
||||
* @param string $message
|
||||
* @param string $url
|
||||
* @param ResponseAdapter $solrResponse
|
||||
* @param ResponseAdapter $meilisearchResponse
|
||||
* @param ?\Exception $exception
|
||||
* @param string $contentSend
|
||||
*/
|
||||
protected function writeLog($logSeverity, $message, $url, $solrResponse, $exception = null, $contentSend = '')
|
||||
protected function writeLog($logSeverity, $message, $url, $meilisearchResponse, $exception = null, $contentSend = '')
|
||||
{
|
||||
$logData = $this->buildLogDataFromResponse($solrResponse, $exception, $url, $contentSend);
|
||||
$logData = $this->buildLogDataFromResponse($meilisearchResponse, $exception, $url, $contentSend);
|
||||
$this->logger->log($logSeverity, $message, $logData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the solr information to build data for the logger.
|
||||
* Parses the meilisearch information to build data for the logger.
|
||||
*
|
||||
* @param ResponseAdapter $solrResponse
|
||||
* @param ResponseAdapter $meilisearchResponse
|
||||
* @param ?\Exception $e
|
||||
* @param string $url
|
||||
* @param string $contentSend
|
||||
* @return array
|
||||
*/
|
||||
protected function buildLogDataFromResponse(ResponseAdapter $solrResponse, \Exception $e = null, $url = '', $contentSend = '')
|
||||
protected function buildLogDataFromResponse(ResponseAdapter $meilisearchResponse, \Exception $e = null, $url = '', $contentSend = '')
|
||||
{
|
||||
$logData = ['query url' => $url, 'response' => (array)$solrResponse];
|
||||
$logData = ['query url' => $url, 'response' => (array)$meilisearchResponse];
|
||||
|
||||
if ($contentSend !== '') {
|
||||
$logData['content'] = $contentSend;
|
||||
@@ -284,8 +284,8 @@ abstract class AbstractSolrService
|
||||
} else {
|
||||
// trigger data parsing
|
||||
// @extensionScannerIgnoreLine
|
||||
$solrResponse->response;
|
||||
$logData['response data'] = print_r($solrResponse, true);
|
||||
$meilisearchResponse->response;
|
||||
$logData['response data'] = print_r($meilisearchResponse, true);
|
||||
return $logData;
|
||||
}
|
||||
}
|
||||
@@ -294,13 +294,13 @@ abstract class AbstractSolrService
|
||||
* Call the /admin/ping servlet, can be used to quickly tell if a connection to the
|
||||
* server is available.
|
||||
*
|
||||
* Simply overrides the SolrPhpClient implementation, changing ping from a
|
||||
* Simply overrides the MeilisearchPhpClient implementation, changing ping from a
|
||||
* HEAD to a GET request, see http://forge.typo3.org/issues/44167
|
||||
*
|
||||
* Also does not report the time, see https://forge.typo3.org/issues/64551
|
||||
*
|
||||
* @param boolean $useCache indicates if the ping result should be cached in the instance or not
|
||||
* @return bool TRUE if Solr can be reached, FALSE if not
|
||||
* @return bool TRUE if Meilisearch can be reached, FALSE if not
|
||||
*/
|
||||
public function ping($useCache = true)
|
||||
{
|
||||
@@ -327,14 +327,14 @@ abstract class AbstractSolrService
|
||||
$httpResponse = $this->performPingRequest($useCache);
|
||||
$end = $this->getMilliseconds();
|
||||
} catch (HttpException $e) {
|
||||
$message = 'Solr ping failed with unexpected response code: ' . $e->getCode();
|
||||
$message = 'Meilisearch ping failed with unexpected response code: ' . $e->getCode();
|
||||
/** @var $exception \WapplerSystems\Meilisearch\PingFailedException */
|
||||
$exception = GeneralUtility::makeInstance(PingFailedException::class, /** @scrutinizer ignore-type */ $message);
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
if ($httpResponse->getHttpStatus() !== 200) {
|
||||
$message = 'Solr ping failed with unexpected response code: ' . $httpResponse->getHttpStatus();
|
||||
$message = 'Meilisearch ping failed with unexpected response code: ' . $httpResponse->getHttpStatus();
|
||||
/** @var $exception \WapplerSystems\Meilisearch\PingFailedException */
|
||||
$exception = GeneralUtility::makeInstance(PingFailedException::class, /** @scrutinizer ignore-type */ $message);
|
||||
throw $exception;
|
||||
@@ -413,7 +413,7 @@ abstract class AbstractSolrService
|
||||
$request = new Request();
|
||||
$path = parse_url($url, PHP_URL_PATH);
|
||||
$endpoint = $this->getPrimaryEndpoint();
|
||||
$api = $request->getApi() === Request::API_V1 ? 'solr' : 'api';
|
||||
$api = $request->getApi() === Request::API_V1 ? 'meilisearch' : 'api';
|
||||
$coreBasePath = $endpoint->getPath() . '/' . $api . '/' . $endpoint->getCore() . '/';
|
||||
|
||||
$handler = $this->buildRelativePath($coreBasePath, $path);
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Service;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -25,19 +25,19 @@ namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Parser\SchemaParser;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Parser\StopWordParser;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Parser\SynonymParser;
|
||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Schema\Schema;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Parser\SchemaParser;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Parser\StopWordParser;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Parser\SynonymParser;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Schema\Schema;
|
||||
use Solarium\Client;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Class SolrAdminService
|
||||
* Class MeilisearchAdminService
|
||||
*/
|
||||
class SolrAdminService extends AbstractSolrService
|
||||
class MeilisearchAdminService extends AbstractMeilisearchService
|
||||
{
|
||||
const PLUGINS_SERVLET = 'admin/plugins';
|
||||
const LUKE_SERVLET = 'admin/luke';
|
||||
@@ -61,7 +61,7 @@ class SolrAdminService extends AbstractSolrService
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $solrconfigName;
|
||||
protected $meilisearchconfigName;
|
||||
|
||||
/**
|
||||
* @var SchemaParser
|
||||
@@ -99,12 +99,12 @@ class SolrAdminService extends AbstractSolrService
|
||||
* @param SynonymParser $synonymParser
|
||||
* @param StopWordParser $stopWordParser
|
||||
* @param SchemaParser $schemaParser
|
||||
* @param SolrLogManager $logManager
|
||||
* @param MeilisearchLogManager $logManager
|
||||
*/
|
||||
public function __construct(
|
||||
Client $client,
|
||||
TypoScriptConfiguration $typoScriptConfiguration = null,
|
||||
SolrLogManager $logManager = null,
|
||||
MeilisearchLogManager $logManager = null,
|
||||
SynonymParser $synonymParser = null,
|
||||
StopWordParser $stopWordParser = null,
|
||||
SchemaParser $schemaParser = null
|
||||
@@ -118,7 +118,7 @@ class SolrAdminService extends AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the /admin/system servlet and retrieve system information about Solr
|
||||
* Call the /admin/system servlet and retrieve system information about Meilisearch
|
||||
*
|
||||
* @return ResponseAdapter
|
||||
*/
|
||||
@@ -128,7 +128,7 @@ class SolrAdminService extends AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about the plugins installed in Solr
|
||||
* Gets information about the plugins installed in Meilisearch
|
||||
*
|
||||
* @return array A nested array of plugin data.
|
||||
*/
|
||||
@@ -177,7 +177,7 @@ class SolrAdminService extends AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about the Solr server
|
||||
* Gets information about the Meilisearch server
|
||||
*
|
||||
* @return ResponseAdapter
|
||||
*/
|
||||
@@ -195,37 +195,37 @@ class SolrAdminService extends AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the solrconfig.xml file installed and in use on the Solr
|
||||
* Gets the name of the meilisearchconfig.xml file installed and in use on the Meilisearch
|
||||
* server.
|
||||
*
|
||||
* @return string Name of the active solrconfig.xml
|
||||
* @return string Name of the active meilisearchconfig.xml
|
||||
*/
|
||||
public function getSolrconfigName()
|
||||
public function getMeilisearchconfigName()
|
||||
{
|
||||
if (is_null($this->solrconfigName)) {
|
||||
$solrconfigXmlUrl = $this->_constructUrl(self::FILE_SERVLET, ['file' => 'solrconfig.xml']);
|
||||
$response = $this->_sendRawGet($solrconfigXmlUrl);
|
||||
$solrconfigXml = simplexml_load_string($response->getRawResponse());
|
||||
if ($solrconfigXml === false) {
|
||||
throw new \InvalidArgumentException('No valid xml response from schema file: ' . $solrconfigXmlUrl);
|
||||
if (is_null($this->meilisearchconfigName)) {
|
||||
$meilisearchconfigXmlUrl = $this->_constructUrl(self::FILE_SERVLET, ['file' => 'meilisearchconfig.xml']);
|
||||
$response = $this->_sendRawGet($meilisearchconfigXmlUrl);
|
||||
$meilisearchconfigXml = simplexml_load_string($response->getRawResponse());
|
||||
if ($meilisearchconfigXml === false) {
|
||||
throw new \InvalidArgumentException('No valid xml response from schema file: ' . $meilisearchconfigXmlUrl);
|
||||
}
|
||||
$this->solrconfigName = (string)$solrconfigXml->attributes()->name;
|
||||
$this->meilisearchconfigName = (string)$meilisearchconfigXml->attributes()->name;
|
||||
}
|
||||
|
||||
return $this->solrconfigName;
|
||||
return $this->meilisearchconfigName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Solr server's version number.
|
||||
* Gets the Meilisearch server's version number.
|
||||
*
|
||||
* @return string Solr version number
|
||||
* @return string Meilisearch version number
|
||||
*/
|
||||
public function getSolrServerVersion()
|
||||
public function getMeilisearchServerVersion()
|
||||
{
|
||||
$systemInformation = $this->getSystemInformation();
|
||||
// don't know why $systemInformation->lucene->solr-spec-version won't work
|
||||
// don't know why $systemInformation->lucene->meilisearch-spec-version won't work
|
||||
$luceneInformation = (array)$systemInformation->lucene;
|
||||
return $luceneInformation['solr-spec-version'];
|
||||
return $luceneInformation['meilisearch-spec-version'];
|
||||
}
|
||||
|
||||
/**
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Service;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -25,16 +25,16 @@ namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\Domain\Search\Query\Query;
|
||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Solr\SolrCommunicationException;
|
||||
use WapplerSystems\Meilisearch\System\Solr\SolrInternalServerErrorException;
|
||||
use WapplerSystems\Meilisearch\System\Solr\SolrUnavailableException;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchCommunicationException;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchInternalServerErrorException;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchUnavailableException;
|
||||
use Solarium\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Class SolrReadService
|
||||
* Class MeilisearchReadService
|
||||
*/
|
||||
class SolrReadService extends AbstractSolrService
|
||||
class MeilisearchReadService extends AbstractMeilisearchService
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -51,8 +51,8 @@ class SolrReadService extends AbstractSolrService
|
||||
* Performs a search.
|
||||
*
|
||||
* @param Query $query
|
||||
* @return ResponseAdapter Solr response
|
||||
* @throws \RuntimeException if Solr returns a HTTP status code other than 200
|
||||
* @return ResponseAdapter Meilisearch response
|
||||
* @throws \RuntimeException if Meilisearch returns a HTTP status code other than 200
|
||||
*/
|
||||
public function search($query)
|
||||
{
|
||||
@@ -88,32 +88,32 @@ class SolrReadService extends AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* This method maps the failed solr requests to a meaningful exception.
|
||||
* This method maps the failed meilisearch requests to a meaningful exception.
|
||||
*
|
||||
* @param HttpException $exception
|
||||
* @throws SolrCommunicationException
|
||||
* @throws MeilisearchCommunicationException
|
||||
* @return HttpException
|
||||
*/
|
||||
protected function handleErrorResponses(HttpException $exception)
|
||||
{
|
||||
$status = $exception->getCode();
|
||||
$message = $exception->getStatusMessage();
|
||||
$solrRespone = new ResponseAdapter($exception->getBody());
|
||||
$meilisearchRespone = new ResponseAdapter($exception->getBody());
|
||||
|
||||
if ($status === 0 || $status === 502) {
|
||||
$e = new SolrUnavailableException('Solr Server not available: ' . $message, 1505989391);
|
||||
$e->setSolrResponse($solrRespone);
|
||||
$e = new MeilisearchUnavailableException('Meilisearch Server not available: ' . $message, 1505989391);
|
||||
$e->setMeilisearchResponse($meilisearchRespone);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($status === 500) {
|
||||
$e = new SolrInternalServerErrorException('Internal Server error during search: ' . $message, 1505989897);
|
||||
$e->setSolrResponse($solrRespone);
|
||||
$e = new MeilisearchInternalServerErrorException('Internal Server error during search: ' . $message, 1505989897);
|
||||
$e->setMeilisearchResponse($meilisearchRespone);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$e = new SolrCommunicationException('Invalid query. Solr returned an error: ' . $status . ' ' . $message, 1293109870);
|
||||
$e->setSolrResponse($solrRespone);
|
||||
$e = new MeilisearchCommunicationException('Invalid query. Meilisearch returned an error: ' . $status . ' ' . $message, 1293109870);
|
||||
$e->setMeilisearchResponse($meilisearchRespone);
|
||||
|
||||
throw $e;
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
namespace WapplerSystems\Meilisearch\System\Meilisearch\Service;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -24,14 +24,14 @@ namespace WapplerSystems\Meilisearch\System\Solr\Service;
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\ResponseAdapter;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\ResponseAdapter;
|
||||
use Solarium\QueryType\Extract\Query;
|
||||
|
||||
/**
|
||||
* Class SolrWriteService
|
||||
* Class MeilisearchWriteService
|
||||
*/
|
||||
class SolrWriteService extends AbstractSolrService
|
||||
class MeilisearchWriteService extends AbstractMeilisearchService
|
||||
{
|
||||
const EXTRACT_SERVLET = 'update/extract';
|
||||
|
||||
@@ -49,8 +49,8 @@ class SolrWriteService extends AbstractSolrService
|
||||
} catch (\Exception $e) {
|
||||
$param = $query->getRequestBuilder()->build($query)->getParams();
|
||||
$this->logger->log(
|
||||
SolrLogManager::ERROR,
|
||||
'Extracting text and meta data through Solr Cell over HTTP POST',
|
||||
MeilisearchLogManager::ERROR,
|
||||
'Extracting text and meta data through Meilisearch Cell over HTTP POST',
|
||||
[
|
||||
'query' => (array)$query,
|
||||
'parameters' => $param,
|
||||
@@ -93,9 +93,9 @@ class SolrWriteService extends AbstractSolrService
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an array of Solr Documents to the index all at once
|
||||
* Add an array of Meilisearch Documents to the index all at once
|
||||
*
|
||||
* @param array $documents Should be an array of \WapplerSystems\Meilisearch\System\Solr\Document\Document instances
|
||||
* @param array $documents Should be an array of \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document instances
|
||||
* @return ResponseAdapter
|
||||
*/
|
||||
public function addDocuments($documents)
|
@@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\System\Mvc\Backend\Component\Exception;
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-support@dkd.de>
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-support@dkd.de>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
|
@@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\System\Mvc\Backend;
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-support@dkd.de>
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-support@dkd.de>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
|
@@ -81,8 +81,8 @@ class ModuleDataStorageService implements SingletonInterface
|
||||
$serializedModuleData = '';
|
||||
return;
|
||||
}
|
||||
if (false !== strpos($serializedModuleData, 'ApacheSolrForTypo3\\Solr\\Domain\\Model\\ModuleData')
|
||||
|| false !== strpos($serializedModuleData, 'Tx_Solr_Site')) {
|
||||
if (false !== strpos($serializedModuleData, 'WapplerSystems\\Meilisearch\\Domain\\Model\\ModuleData')
|
||||
|| false !== strpos($serializedModuleData, 'Tx_Meilisearch_Site')) {
|
||||
$serializedModuleData = '';
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ use TYPO3\CMS\Core\Database\Query\QueryBuilder;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Repository class to encapsulate the database access for records used in solr.
|
||||
* Repository class to encapsulate the database access for records used in meilisearch.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\System\Records\Pages;
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-eb-support@dkd.de>
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-eb-support@dkd.de>
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\System\Records\SystemLanguage;
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-eb-support@dkd.de>
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-eb-support@dkd.de>
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
@@ -33,7 +33,7 @@ use TYPO3\CMS\Core\SingletonInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* SystemLanguageRepository to encapsulate the database access for records used in solr.
|
||||
* SystemLanguageRepository to encapsulate the database access for records used in meilisearch.
|
||||
*
|
||||
*/
|
||||
class SystemLanguageRepository extends AbstractRepository implements SingletonInterface
|
||||
|
@@ -4,7 +4,7 @@ namespace WapplerSystems\Meilisearch\System\Records\SystemTemplate;
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-eb-support@dkd.de>
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-eb-support@dkd.de>
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
@@ -28,7 +28,7 @@ namespace WapplerSystems\Meilisearch\System\Records\SystemTemplate;
|
||||
use WapplerSystems\Meilisearch\System\Records\AbstractRepository;
|
||||
|
||||
/**
|
||||
* SystemTemplateRepository to encapsulate the database access for records used in solr.
|
||||
* SystemTemplateRepository to encapsulate the database access for records used in meilisearch.
|
||||
*
|
||||
*/
|
||||
class SystemTemplateRepository extends AbstractRepository
|
||||
|
@@ -60,14 +60,14 @@ class ConfigurationService
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the given solrConfiguration with flex form configuration.
|
||||
* Override the given meilisearchConfiguration with flex form configuration.
|
||||
*
|
||||
* @param string $flexFormData The raw data from database.
|
||||
* @param TypoScriptConfiguration $solrTypoScriptConfiguration
|
||||
* @param TypoScriptConfiguration $meilisearchTypoScriptConfiguration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function overrideConfigurationWithFlexFormSettings($flexFormData, TypoScriptConfiguration $solrTypoScriptConfiguration)
|
||||
public function overrideConfigurationWithFlexFormSettings($flexFormData, TypoScriptConfiguration $meilisearchTypoScriptConfiguration)
|
||||
{
|
||||
if (empty($flexFormData)) {
|
||||
return;
|
||||
@@ -77,7 +77,7 @@ class ConfigurationService
|
||||
$flexFormConfiguration = $this->overrideFilter($flexFormConfiguration);
|
||||
$flexFormConfiguration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($flexFormConfiguration);
|
||||
|
||||
$solrTypoScriptConfiguration->mergeSolrConfiguration($flexFormConfiguration, true, false);
|
||||
$meilisearchTypoScriptConfiguration->mergeMeilisearchConfiguration($flexFormConfiguration, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,7 +5,7 @@ namespace WapplerSystems\Meilisearch\System\Session;
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <solr-eb-support@dkd.de>
|
||||
* (c) 2010-2017 dkd Internet Service GmbH <meilisearch-eb-support@dkd.de>
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
|
@@ -1,166 +0,0 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\System\Solr;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use Solarium\Core\Client\Endpoint;
|
||||
|
||||
/**
|
||||
* Represent a server node of solr, in the most setups you would only have one, but sometimes
|
||||
* multiple for reading and writing.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
* @copyright Copyright (c) 2009-2020 Timo Hund <timo.hund@dkd.de>
|
||||
*
|
||||
* @deprecated Class will removed with Ext:solr 12.x. Use class \Solarium\Core\Client\Endpoint instead.
|
||||
*/
|
||||
class Node extends Endpoint
|
||||
{
|
||||
/**
|
||||
* Node constructor.
|
||||
* @param string $scheme
|
||||
* @param string $host
|
||||
* @param int $port
|
||||
* @param string $path
|
||||
* @param ?string $username
|
||||
* @param ?string $password
|
||||
*/
|
||||
public function __construct(
|
||||
string $scheme = 'http',
|
||||
string $host = 'localhost',
|
||||
int $port = 8983,
|
||||
string $path = '/solr/core_en/',
|
||||
?string $username = null,
|
||||
?string $password = null
|
||||
) {
|
||||
$path = (string)$path;
|
||||
$elements = explode('/', trim($path, '/'));
|
||||
$coreName = (string)array_pop($elements);
|
||||
// Remove API version
|
||||
array_pop($elements);
|
||||
|
||||
// The path should always have the same format!
|
||||
$path = trim(implode('/', $elements), '/');
|
||||
|
||||
$options = [
|
||||
'scheme' => $scheme,
|
||||
'host' => $host,
|
||||
'port' => $port,
|
||||
'path' => '/' . $path,
|
||||
'collection' => null,
|
||||
'core' => $coreName,
|
||||
'leader' => false,
|
||||
];
|
||||
|
||||
parent::__construct($options);
|
||||
$this->setAuthentication($username, $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $configuration
|
||||
* @return Node
|
||||
*/
|
||||
public static function fromArray(array $configuration): Node
|
||||
{
|
||||
static::checkIfRequiredKeyIsSet($configuration, 'scheme');
|
||||
static::checkIfRequiredKeyIsSet($configuration, 'host');
|
||||
static::checkIfRequiredKeyIsSet($configuration, 'port');
|
||||
static::checkIfRequiredKeyIsSet($configuration, 'path');
|
||||
|
||||
$scheme = $configuration['scheme'];
|
||||
$host = $configuration['host'];
|
||||
$port = $configuration['port'];
|
||||
$path = $configuration['path'];
|
||||
|
||||
$username = $configuration['username'] ?? '';
|
||||
$password = $configuration['password'] ?? '';
|
||||
return new Node($scheme, $host, $port, $path, $username, $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the required configuration option is set.
|
||||
*
|
||||
* @param array $configuration
|
||||
* @param string $name
|
||||
* @throws |UnexpectedValueException
|
||||
*/
|
||||
protected static function checkIfRequiredKeyIsSet(array $configuration, string $name)
|
||||
{
|
||||
if (empty($configuration[$name])) {
|
||||
throw new \UnexpectedValueException('Required solr connection property ' . $name. ' is missing.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername(): string
|
||||
{
|
||||
return (string)$this->getOption('username');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword(): string
|
||||
{
|
||||
return (string)$this->getOption('password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path including api path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCoreBasePath(): string
|
||||
{
|
||||
$pathWithoutLeadingAndTrailingSlashes = trim(trim($this->getPath()), "/");
|
||||
$pathWithoutLastSegment = substr($pathWithoutLeadingAndTrailingSlashes, 0, strrpos($pathWithoutLeadingAndTrailingSlashes, "/"));
|
||||
return ($pathWithoutLastSegment === '') ? '/' : '/' . $pathWithoutLastSegment . '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the core name from the configured path.
|
||||
*
|
||||
* @return string
|
||||
* @deprecated Will be remove with Ext:solr 12.x. Use method getCore() instead.
|
||||
*/
|
||||
public function getCoreName(): string
|
||||
{
|
||||
return $this->getCore();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSolariumClientOptions(): array
|
||||
{
|
||||
return [
|
||||
'host' => $this->getHost(),
|
||||
'port' => $this->getPort(),
|
||||
'scheme' => $this->getScheme(),
|
||||
'path' => $this->getPath(),
|
||||
'core' => $this->getCore()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated Will be removed with Ext:solr 12.x. Use methods getCoreBaseUri() for API version 1 instead
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getCoreBaseUri();
|
||||
}
|
||||
}
|
@@ -60,18 +60,18 @@ class FlexFormUserFunctions
|
||||
return;
|
||||
}
|
||||
|
||||
$newItems = $this->getParsedSolrFieldsFromSchema($configuredFacets, $pageRecord);
|
||||
$newItems = $this->getParsedMeilisearchFieldsFromSchema($configuredFacets, $pageRecord);
|
||||
$parentInformation['items'] = $newItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method parses the solr schema fields into the required format for the backend flexform.
|
||||
* This method parses the meilisearch schema fields into the required format for the backend flexform.
|
||||
*
|
||||
* @param array $configuredFacets
|
||||
* @param array $pageRecord
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getParsedSolrFieldsFromSchema($configuredFacets, $pageRecord)
|
||||
protected function getParsedMeilisearchFieldsFromSchema($configuredFacets, $pageRecord)
|
||||
{
|
||||
$newItems = [];
|
||||
|
||||
@@ -96,7 +96,7 @@ class FlexFormUserFunctions
|
||||
}
|
||||
|
||||
$newItems[$value] = [$label, $value];
|
||||
}, $this->getFieldNamesFromSolrMetaDataForPage($pageRecord));
|
||||
}, $this->getFieldNamesFromMeilisearchMetaDataForPage($pageRecord));
|
||||
|
||||
ksort($newItems, SORT_NATURAL);
|
||||
return $newItems;
|
||||
@@ -126,11 +126,11 @@ class FlexFormUserFunctions
|
||||
}
|
||||
|
||||
/**
|
||||
* Get solr connection.
|
||||
* Get meilisearch connection.
|
||||
*
|
||||
* @param array $pageRecord
|
||||
*
|
||||
* @return \WapplerSystems\Meilisearch\System\Solr\SolrConnection
|
||||
* @return \WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection
|
||||
*/
|
||||
protected function getConnection(array $pageRecord)
|
||||
{
|
||||
@@ -138,12 +138,12 @@ class FlexFormUserFunctions
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all fieldnames that occure in the solr schema for one page.
|
||||
* Retrieves all fieldnames that occure in the meilisearch schema for one page.
|
||||
*
|
||||
* @param array $pageRecord
|
||||
* @return array
|
||||
*/
|
||||
protected function getFieldNamesFromSolrMetaDataForPage(array $pageRecord)
|
||||
protected function getFieldNamesFromMeilisearchMetaDataForPage(array $pageRecord)
|
||||
{
|
||||
return array_keys((array)$this->getConnection($pageRecord)->getAdminService()->getFieldsMetaData());
|
||||
}
|
||||
@@ -184,7 +184,7 @@ class FlexFormUserFunctions
|
||||
*/
|
||||
protected function getConfigurationFromPageId($pid)
|
||||
{
|
||||
$typoScriptConfiguration = $this->frontendEnvironment->getSolrConfigurationFromPageId($pid);
|
||||
$typoScriptConfiguration = $this->frontendEnvironment->getMeilisearchConfigurationFromPageId($pid);
|
||||
return $typoScriptConfiguration;
|
||||
}
|
||||
|
||||
|
@@ -69,8 +69,8 @@ class SiteUtility
|
||||
*
|
||||
* In addition every property can be defined for the ```read``` and ```write``` scope.
|
||||
*
|
||||
* The convention for property keys is "solr_{propertyName}_{scope}". With the configuration "solr_host_read" you define the host
|
||||
* for the solr read connection.
|
||||
* The convention for property keys is "meilisearch_{propertyName}_{scope}". With the configuration "meilisearch_host_read" you define the host
|
||||
* for the meilisearch read connection.
|
||||
*
|
||||
* @param Site $typo3Site
|
||||
* @param string $property
|
||||
@@ -104,11 +104,11 @@ class SiteUtility
|
||||
$scope = 'read';
|
||||
}
|
||||
|
||||
// convention key solr_$property_$scope
|
||||
$keyToCheck = 'solr_' . $property . '_' . $scope;
|
||||
// convention key meilisearch_$property_$scope
|
||||
$keyToCheck = 'meilisearch_' . $property . '_' . $scope;
|
||||
|
||||
// convention fallback key solr_$property_read
|
||||
$fallbackKey = 'solr_' . $property . '_read';
|
||||
// convention fallback key meilisearch_$property_read
|
||||
$fallbackKey = 'meilisearch_' . $property . '_read';
|
||||
|
||||
// try to find language specific setting if found return it
|
||||
$languageSpecificConfiguration = $typo3Site->getLanguageById($languageId)->toArray();
|
||||
@@ -133,13 +133,13 @@ class SiteUtility
|
||||
protected static function writeConnectionIsEnabled(Site $typo3Site, int $languageId): bool
|
||||
{
|
||||
$languageSpecificConfiguration = $typo3Site->getLanguageById($languageId)->toArray();
|
||||
$value = self::getValueOrFallback($languageSpecificConfiguration, 'solr_use_write_connection', 'solr_use_write_connection');
|
||||
$value = self::getValueOrFallback($languageSpecificConfiguration, 'meilisearch_use_write_connection', 'meilisearch_use_write_connection');
|
||||
if ($value !== null) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$siteBaseConfiguration = $typo3Site->getConfiguration();
|
||||
$value = self::getValueOrFallback($siteBaseConfiguration, 'solr_use_write_connection', 'solr_use_write_connection');
|
||||
$value = self::getValueOrFallback($siteBaseConfiguration, 'meilisearch_use_write_connection', 'meilisearch_use_write_connection');
|
||||
if ($value !== null) {
|
||||
return $value;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\System\Validator;
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
* Class Path is used for Solr Path related methods
|
||||
* Class Path is used for Meilisearch Path related methods
|
||||
*
|
||||
* @author Thomas Hohn <tho@systime.dk>
|
||||
*/
|
||||
@@ -33,12 +33,12 @@ class Path
|
||||
{
|
||||
|
||||
/**
|
||||
* Validate that a path is a valid Solr Path
|
||||
* Validate that a path is a valid Meilisearch Path
|
||||
*
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
public function isValidSolrPath($path)
|
||||
public function isValidMeilisearchPath($path)
|
||||
{
|
||||
$path = trim($path);
|
||||
|
||||
|
Reference in New Issue
Block a user