first commit
This commit is contained in:
@@ -33,8 +33,6 @@ use WapplerSystems\Meilisearch\Domain\Site\Site;
|
||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use WapplerSystems\Meilisearch\Task\IndexQueueWorkerTask;
|
||||
use Solarium\Exception\HttpException;
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
|
||||
|
||||
@@ -140,7 +138,7 @@ class IndexService
|
||||
$this->emitSignal('afterIndexItems', [$itemsToIndex, $this->getContextTask(), $indexRunId]);
|
||||
|
||||
if ($enableCommitsSetting && count($itemsToIndex) > 0) {
|
||||
$meilisearchServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->site);
|
||||
$meilisearchServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionBySite($this->site);
|
||||
foreach ($meilisearchServers as $meilisearchServer) {
|
||||
try {
|
||||
$meilisearchServer->getWriteService()->commit(false, false, false);
|
||||
|
@@ -121,7 +121,7 @@ abstract class AbstractStrategy
|
||||
$enableCommitsSetting = $site->getMeilisearchConfiguration()->getEnableCommits();
|
||||
$siteHash = $site->getSiteHash();
|
||||
// a site can have multiple connections (cores / languages)
|
||||
$meilisearchConnections = $this->connectionManager->getConnectionsBySite($site);
|
||||
$meilisearchConnections = $this->connectionManager->getConnectionBySite($site);
|
||||
if ($language > 0) {
|
||||
$meilisearchConnections = [$language => $meilisearchConnections[$language]];
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument;
|
||||
namespace WapplerSystems\Meilisearch\Domain\Search\MeilisearchDocument;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
@@ -35,7 +35,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
||||
|
||||
/**
|
||||
* Builder class to build an ApacheMeilisearchDocument
|
||||
* Builder class to build an MeilisearchDocument
|
||||
*
|
||||
* Responsible to build \WapplerSystems\Meilisearch\System\Meilisearch\Document\Document
|
||||
*
|
||||
@@ -64,38 +64,37 @@ class Builder
|
||||
* @param string $url
|
||||
* @param Rootline $pageAccessRootline
|
||||
* @param string $mountPointParameter
|
||||
* @return Document|object
|
||||
* @return array
|
||||
*/
|
||||
public function fromPage(TypoScriptFrontendController $page, $url, Rootline $pageAccessRootline, $mountPointParameter): Document
|
||||
public function fromPage(TypoScriptFrontendController $page, $url, Rootline $pageAccessRootline, $mountPointParameter): array
|
||||
{
|
||||
/* @var $document Document */
|
||||
$document = GeneralUtility::makeInstance(Document::class);
|
||||
$document = [];
|
||||
$site = $this->getSiteByPageId($page->id);
|
||||
$pageRecord = $page->page;
|
||||
|
||||
$accessGroups = $this->getDocumentIdGroups($pageAccessRootline);
|
||||
$documentId = $this->getPageDocumentId($page, $accessGroups, $mountPointParameter);
|
||||
|
||||
$document->setField('id', $documentId);
|
||||
$document->setField('site', $site->getDomain());
|
||||
$document->setField('siteHash', $site->getSiteHash());
|
||||
$document->setField('appKey', 'EXT:meilisearch');
|
||||
$document->setField('type', 'pages');
|
||||
$document['id'] = $documentId;
|
||||
$document['site'] = $site->getDomain();
|
||||
$document['siteHash'] = $site->getSiteHash();
|
||||
$document['appKey'] = 'EXT:meilisearch';
|
||||
$document['type'] = 'pages';
|
||||
|
||||
// system fields
|
||||
$document->setField('uid', $page->id);
|
||||
$document->setField('pid', $pageRecord['pid']);
|
||||
$document['uid'] = $page->id;
|
||||
$document['pid'] = $pageRecord['pid'];
|
||||
|
||||
// variantId
|
||||
$variantId = $this->variantIdBuilder->buildFromTypeAndUid('pages', $page->id);
|
||||
$document->setField('variantId', $variantId);
|
||||
$document['variantId'] = $variantId;
|
||||
|
||||
$document->setField('typeNum', $page->type);
|
||||
$document->setField('created', $pageRecord['crdate']);
|
||||
$document->setField('changed', $pageRecord['SYS_LASTCHANGED']);
|
||||
$document['typeNum'] = $page->type;
|
||||
$document['created'] = $pageRecord['crdate'];
|
||||
$document['changed'] = $pageRecord['SYS_LASTCHANGED'];
|
||||
|
||||
$rootline = $this->getRootLineFieldValue($page->id, $mountPointParameter);
|
||||
$document->setField('rootline', $rootline);
|
||||
$document['rootline'] = $rootline;
|
||||
|
||||
// access
|
||||
$this->addAccessField($document, $pageAccessRootline);
|
||||
@@ -104,14 +103,14 @@ class Builder
|
||||
// content
|
||||
// @extensionScannerIgnoreLine
|
||||
$contentExtractor = $this->getExtractorForPageContent($page->content);
|
||||
$document->setField('title', $contentExtractor->getPageTitle());
|
||||
$document->setField('subTitle', $pageRecord['subtitle']);
|
||||
$document->setField('navTitle', $pageRecord['nav_title']);
|
||||
$document->setField('author', $pageRecord['author']);
|
||||
$document->setField('description', $pageRecord['description']);
|
||||
$document->setField('abstract', $pageRecord['abstract']);
|
||||
$document->setField('content', $contentExtractor->getIndexableContent());
|
||||
$document->setField('url', $url);
|
||||
$document['title'] = $contentExtractor->getPageTitle();
|
||||
$document['subTitle'] = $pageRecord['subtitle'];
|
||||
$document['navTitle'] = $pageRecord['nav_title'];
|
||||
$document['author'] = $pageRecord['author'];
|
||||
$document['description'] = $pageRecord['description'];
|
||||
$document['abstract'] = $pageRecord['abstract'];
|
||||
$document['content'] = $contentExtractor->getIndexableContent();
|
||||
$document['url'] = $url;
|
||||
|
||||
$this->addKeywordsField($document, $pageRecord);
|
||||
$this->addTagContentFields($document, $contentExtractor->getTagContent());
|
||||
@@ -127,9 +126,9 @@ class Builder
|
||||
* @param string $type
|
||||
* @param int $rootPageUid
|
||||
* @param string $accessRootLine
|
||||
* @return Document
|
||||
* @return array
|
||||
*/
|
||||
public function fromRecord(array $itemRecord, string $type, int $rootPageUid, string $accessRootLine): Document
|
||||
public function fromRecord(array $itemRecord, string $type, int $rootPageUid, string $accessRootLine): array
|
||||
{
|
||||
/* @var $document Document */
|
||||
$document = GeneralUtility::makeInstance(Document::class);
|
||||
@@ -139,36 +138,36 @@ class Builder
|
||||
$documentId = $this->getDocumentId($type, $site->getRootPageId(), $itemRecord['uid']);
|
||||
|
||||
// required fields
|
||||
$document->setField('id', $documentId);
|
||||
$document->setField('type', $type);
|
||||
$document->setField('appKey', 'EXT:meilisearch');
|
||||
$document['id'] = $documentId;
|
||||
$document['type'] = $type;
|
||||
$document['appKey'] = 'EXT:meilisearch';
|
||||
|
||||
// site, siteHash
|
||||
$document->setField('site', $site->getDomain());
|
||||
$document->setField('siteHash', $site->getSiteHash());
|
||||
$document['site'] = $site->getDomain();
|
||||
$document['siteHash'] = $site->getSiteHash();
|
||||
|
||||
// uid, pid
|
||||
$document->setField('uid', $itemRecord['uid']);
|
||||
$document->setField('pid', $itemRecord['pid']);
|
||||
$document['uid'] = $itemRecord['uid'];
|
||||
$document['pid'] = $itemRecord['pid'];
|
||||
|
||||
// variantId
|
||||
$variantId = $this->variantIdBuilder->buildFromTypeAndUid($type, $itemRecord['uid']);
|
||||
$document->setField('variantId', $variantId);
|
||||
$document['variantId'] = $variantId;
|
||||
|
||||
// created, changed
|
||||
if (!empty($GLOBALS['TCA'][$type]['ctrl']['crdate'])) {
|
||||
$document->setField('created', $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['crdate']]);
|
||||
$document['created'] = $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['crdate']];
|
||||
}
|
||||
if (!empty($GLOBALS['TCA'][$type]['ctrl']['tstamp'])) {
|
||||
$document->setField('changed', $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['tstamp']]);
|
||||
$document['changed'] = $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['tstamp']];
|
||||
}
|
||||
|
||||
// access, endtime
|
||||
$document->setField('access', $accessRootLine);
|
||||
$document['access'] = $accessRootLine;
|
||||
if (!empty($GLOBALS['TCA'][$type]['ctrl']['enablecolumns']['endtime'])
|
||||
&& $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['enablecolumns']['endtime']] != 0
|
||||
) {
|
||||
$document->setField('endtime', $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['enablecolumns']['endtime']]);
|
||||
$document['endtime'] = $itemRecord[$GLOBALS['TCA'][$type]['ctrl']['enablecolumns']['endtime']];
|
||||
}
|
||||
|
||||
return $document;
|
||||
@@ -255,37 +254,37 @@ class Builder
|
||||
/**
|
||||
* Adds the access field to the document if needed.
|
||||
*
|
||||
* @param Document $document
|
||||
* @param array $document
|
||||
* @param Rootline $pageAccessRootline
|
||||
*/
|
||||
protected function addAccessField(Document $document, Rootline $pageAccessRootline)
|
||||
protected function addAccessField(array &$document, Rootline $pageAccessRootline)
|
||||
{
|
||||
$access = (string)$pageAccessRootline;
|
||||
if (trim($access) !== '') {
|
||||
$document->setField('access', $access);
|
||||
$document['access'] = $access;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the endtime field value to the Document.
|
||||
*
|
||||
* @param Document $document
|
||||
* @param array $document
|
||||
* @param array $pageRecord
|
||||
*/
|
||||
protected function addEndtimeField(Document $document, $pageRecord)
|
||||
protected function addEndtimeField(array &$document, $pageRecord)
|
||||
{
|
||||
if ($pageRecord['endtime']) {
|
||||
$document->setField('endtime', $pageRecord['endtime']);
|
||||
$document['endtime'] = $pageRecord['endtime'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds keywords, multi valued.
|
||||
*
|
||||
* @param Document $document
|
||||
* @param array $document
|
||||
* @param array $pageRecord
|
||||
*/
|
||||
protected function addKeywordsField(Document $document, $pageRecord)
|
||||
protected function addKeywordsField(array &$document, $pageRecord)
|
||||
{
|
||||
if (!isset($pageRecord['keywords'])) {
|
||||
return;
|
||||
@@ -293,20 +292,20 @@ class Builder
|
||||
|
||||
$keywords = array_unique(GeneralUtility::trimExplode(',', $pageRecord['keywords'], true));
|
||||
foreach ($keywords as $keyword) {
|
||||
$document->addField('keywords', $keyword);
|
||||
$document['keywords'] = $keyword;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content from several tags like headers, anchors, ...
|
||||
*
|
||||
* @param Document $document
|
||||
* @param array $document
|
||||
* @param array $tagContent
|
||||
*/
|
||||
protected function addTagContentFields(Document $document, $tagContent = [])
|
||||
protected function addTagContentFields(array &$document, $tagContent = [])
|
||||
{
|
||||
foreach ($tagContent as $fieldName => $fieldValue) {
|
||||
$document->setField($fieldName, $fieldValue);
|
||||
$document[$fieldName] = $fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\Domain\Search\ApacheMeilisearchDocument;
|
||||
namespace WapplerSystems\Meilisearch\Domain\Search\MeilisearchDocument;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\Domain\Search\Query;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2010-2015 Ingo Renner <ingo@typo3.org>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use Solarium\QueryType\Extract\Query as SolariumExtractQuery;
|
||||
|
||||
/**
|
||||
* Specialized query for content extraction using Meilisearch Cell
|
||||
*
|
||||
*/
|
||||
class ExtractingQuery extends SolariumExtractQuery
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $file Absolute path to the file to extract content and meta data from.
|
||||
*/
|
||||
public function __construct($file)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setFile($file);
|
||||
$this->addParam('extractFormat', 'text');
|
||||
}
|
||||
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
namespace WapplerSystems\Meilisearch\Domain\Search\Query;
|
||||
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2009-2015 Ingo Renner <ingo@typo3.org>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use Solarium\QueryType\Select\Query\Query as SolariumQuery;
|
||||
|
||||
class Query extends SolariumQuery {
|
||||
|
||||
/**
|
||||
* Returns the query parameters that should be used.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getQueryParameters() {
|
||||
return $this->getParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getQuery();
|
||||
}
|
||||
}
|
@@ -62,7 +62,7 @@ class DefaultResultParser extends AbstractResultParser {
|
||||
}
|
||||
|
||||
foreach ($documents as $searchResult) {
|
||||
$searchResultObject = $this->searchResultBuilder->fromApacheMeilisearchDocument($searchResult);
|
||||
$searchResultObject = $this->searchResultBuilder->fromMeilisearchDocument($searchResult);
|
||||
$searchResults[] = $searchResultObject;
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class SearchResultBuilder {
|
||||
* @throws \InvalidArgumentException
|
||||
* @return SearchResult
|
||||
*/
|
||||
public function fromApacheMeilisearchDocument(Document $originalDocument)
|
||||
public function fromMeilisearchDocument(Document $originalDocument)
|
||||
{
|
||||
|
||||
$searchResultClassName = $this->getResultClassName();
|
||||
|
@@ -431,7 +431,7 @@ class SearchResultSetService
|
||||
throw new \UnexpectedValueException("Response did not contain a valid Document object");
|
||||
}
|
||||
|
||||
return $this->searchResultBuilder->fromApacheMeilisearchDocument($resultDocument);
|
||||
return $this->searchResultBuilder->fromMeilisearchDocument($resultDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -239,28 +239,14 @@ abstract class Site implements SiteInterface
|
||||
return $rootPageIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws NoMeilisearchConnectionFoundException
|
||||
*/
|
||||
public function getAllMeilisearchConnectionConfigurations(): array {
|
||||
$configs = [];
|
||||
foreach ($this->getAvailableLanguageIds() as $languageId) {
|
||||
try {
|
||||
$configs[$languageId] = $this->getMeilisearchConnectionConfiguration($languageId);
|
||||
} catch (NoMeilisearchConnectionFoundException $e) {}
|
||||
}
|
||||
return $configs;
|
||||
}
|
||||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return !empty($this->getAllMeilisearchConnectionConfigurations());
|
||||
return !empty($this->getMeilisearchConnectionConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $languageId
|
||||
* @return array
|
||||
*/
|
||||
abstract function getMeilisearchConnectionConfiguration(int $language = 0): array;
|
||||
abstract function getMeilisearchConnectionConfiguration(): array;
|
||||
}
|
||||
|
@@ -110,19 +110,12 @@ interface SiteInterface
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
|
||||
/**
|
||||
* @param int $language
|
||||
* @return array
|
||||
* @throws NoMeilisearchConnectionFoundException
|
||||
*/
|
||||
public function getMeilisearchConnectionConfiguration(int $language = 0): array;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws NoMeilisearchConnectionFoundException
|
||||
*/
|
||||
public function getAllMeilisearchConnectionConfigurations(): array;
|
||||
public function getMeilisearchConnectionConfiguration(): array;
|
||||
|
||||
|
||||
public function isEnabled(): bool;
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ class SiteRepository
|
||||
* @param TwoLevelCache|null $twoLevelCache
|
||||
* @param Registry|null $registry
|
||||
* @param SiteFinder|null $siteFinder
|
||||
* @param ExtensionConfiguration| null
|
||||
* @param ExtensionConfiguration|null
|
||||
*/
|
||||
public function __construct(
|
||||
RootPageResolver $rootPageResolver = null,
|
||||
@@ -230,8 +230,7 @@ class SiteRepository
|
||||
{
|
||||
/** @var $siteHashService SiteHashService */
|
||||
$siteHashService = GeneralUtility::makeInstance(SiteHashService::class);
|
||||
$siteHash = $siteHashService->getSiteHashForDomain($domain);
|
||||
return $siteHash;
|
||||
return $siteHashService->getSiteHashForDomain($domain);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,37 +271,21 @@ class SiteRepository
|
||||
$domain = $typo3Site->getBase()->getHost();
|
||||
|
||||
$siteHash = $this->getSiteHashForDomain($domain);
|
||||
$defaultLanguage = $typo3Site->getDefaultLanguage()->getLanguageId();
|
||||
$pageRepository = GeneralUtility::makeInstance(PagesRepository::class);
|
||||
$availableLanguageIds = array_map(function($language) {
|
||||
return $language->getLanguageId();
|
||||
}, $typo3Site->getLanguages());
|
||||
|
||||
$meilisearchConnectionConfigurations = [];
|
||||
$meilisearchConnectionConfiguration = [];
|
||||
|
||||
foreach ($availableLanguageIds as $languageUid) {
|
||||
$meilisearchEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', $languageUid, 'read', true);
|
||||
if ($meilisearchEnabled) {
|
||||
$meilisearchConnectionConfigurations[$languageUid] = [
|
||||
'connectionKey' => $rootPageRecord['uid'] . '|' . $languageUid,
|
||||
'rootPageTitle' => $rootPageRecord['title'],
|
||||
'rootPageUid' => $rootPageRecord['uid'],
|
||||
'read' => [
|
||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'read', 'http'),
|
||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'read', 'localhost'),
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'read', 7700),
|
||||
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'read', ''),
|
||||
],
|
||||
'write' => [
|
||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', $languageUid, 'write', 'http'),
|
||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', $languageUid, 'write', 'localhost'),
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port', $languageUid, 'write', 7700),
|
||||
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', $languageUid, 'write', ''),
|
||||
],
|
||||
|
||||
'language' => $languageUid
|
||||
];
|
||||
}
|
||||
$meilisearchEnabled = SiteUtility::getConnectionProperty($typo3Site, 'enabled', true);
|
||||
if ($meilisearchEnabled) {
|
||||
$meilisearchConnectionConfiguration = [
|
||||
'connectionKey' => $rootPageRecord['uid'] . '|',
|
||||
'rootPageTitle' => $rootPageRecord['title'],
|
||||
'rootPageUid' => $rootPageRecord['uid'],
|
||||
'scheme' => SiteUtility::getConnectionProperty($typo3Site, 'scheme', 'http'),
|
||||
'host' => SiteUtility::getConnectionProperty($typo3Site, 'host', 'localhost'),
|
||||
'port' => (int)SiteUtility::getConnectionProperty($typo3Site, 'port',7700),
|
||||
'apiKey' => SiteUtility::getConnectionProperty($typo3Site, 'apiKey', ''),
|
||||
];
|
||||
}
|
||||
|
||||
return GeneralUtility::makeInstance(
|
||||
@@ -318,11 +301,7 @@ class SiteRepository
|
||||
/** @scrutinizer ignore-type */
|
||||
$pageRepository,
|
||||
/** @scrutinizer ignore-type */
|
||||
$defaultLanguage,
|
||||
/** @scrutinizer ignore-type */
|
||||
$availableLanguageIds,
|
||||
/** @scrutinizer ignore-type */
|
||||
$meilisearchConnectionConfigurations,
|
||||
$meilisearchConnectionConfiguration,
|
||||
/** @scrutinizer ignore-type */
|
||||
$typo3Site
|
||||
);
|
||||
|
@@ -47,32 +47,29 @@ class Typo3ManagedSite extends Site
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $meilisearchConnectionConfigurations;
|
||||
protected $meilisearchConnectionConfiguration;
|
||||
|
||||
|
||||
public function __construct(
|
||||
TypoScriptConfiguration $configuration,
|
||||
array $page, $domain, $siteHash, PagesRepository $pagesRepository = null, $defaultLanguageId = 0, $availableLanguageIds = [], array $meilisearchConnectionConfigurations = [], Typo3Site $typo3SiteObject = null)
|
||||
array $page, $domain, $siteHash, PagesRepository $pagesRepository = null, array $meilisearchConnectionConfiguration = [], Typo3Site $typo3SiteObject = null)
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
$this->rootPage = $page;
|
||||
$this->domain = $domain;
|
||||
$this->siteHash = $siteHash;
|
||||
$this->pagesRepository = $pagesRepository ?? GeneralUtility::makeInstance(PagesRepository::class);
|
||||
$this->defaultLanguageId = $defaultLanguageId;
|
||||
$this->availableLanguageIds = $availableLanguageIds;
|
||||
$this->meilisearchConnectionConfigurations = $meilisearchConnectionConfigurations;
|
||||
$this->meilisearchConnectionConfiguration = $meilisearchConnectionConfiguration;
|
||||
$this->typo3SiteObject = $typo3SiteObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $language
|
||||
* @return array
|
||||
* @throws NoMeilisearchConnectionFoundException
|
||||
*/
|
||||
public function getMeilisearchConnectionConfiguration(int $language = 0): array
|
||||
public function getMeilisearchConnectionConfiguration(): array
|
||||
{
|
||||
if (!is_array($this->meilisearchConnectionConfigurations[$language])) {
|
||||
if (!is_array($this->meilisearchConnectionConfiguration)) {
|
||||
/* @var $noMeilisearchConnectionException NoMeilisearchConnectionFoundException */
|
||||
$noMeilisearchConnectionException = GeneralUtility::makeInstance(
|
||||
NoMeilisearchConnectionFoundException::class,
|
||||
@@ -80,12 +77,11 @@ class Typo3ManagedSite extends Site
|
||||
/** @scrutinizer ignore-type */ 1552491117
|
||||
);
|
||||
$noMeilisearchConnectionException->setRootPageId($this->getRootPageId());
|
||||
$noMeilisearchConnectionException->setLanguageId($language);
|
||||
|
||||
throw $noMeilisearchConnectionException;
|
||||
}
|
||||
|
||||
return $this->meilisearchConnectionConfigurations[$language];
|
||||
return $this->meilisearchConnectionConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,4 +93,5 @@ class Typo3ManagedSite extends Site
|
||||
{
|
||||
return $this->typo3SiteObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ class VariantsProcessor implements SearchResultSetProcessor
|
||||
$fields = get_object_vars($variantDocumentArray);
|
||||
$variantDocument = new SearchResult($fields);
|
||||
|
||||
$variantSearchResult = $this->resultBuilder->fromApacheMeilisearchDocument($variantDocument);
|
||||
$variantSearchResult = $this->resultBuilder->fromMeilisearchDocument($variantDocument);
|
||||
$variantSearchResult->setIsVariant(true);
|
||||
$variantSearchResult->setVariantParent($resultDocument);
|
||||
|
||||
|
Reference in New Issue
Block a user