first commit

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

View File

@@ -29,7 +29,7 @@ use WapplerSystems\Meilisearch\IndexQueue\AbstractIndexer;
use WapplerSystems\Meilisearch\IndexQueue\InvalidFieldNameException;
use WapplerSystems\Meilisearch\SubstitutePageIndexer;
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
use WapplerSystems\Meilisearch\Util;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -57,7 +57,7 @@ class PageFieldMappingIndexer implements SubstitutePageIndexer
*/
public function __construct(TypoScriptConfiguration $configuration = null)
{
$this->configuration = $configuration == null ? Util::getSolrConfiguration() : $configuration;
$this->configuration = $configuration == null ? Util::getMeilisearchConfiguration() : $configuration;
}
/**
@@ -75,7 +75,7 @@ class PageFieldMappingIndexer implements SubstitutePageIndexer
* plugin.tx_meilisearch.index.queue.pages.fields.
*
* @param Document $pageDocument The original page document.
* @return Document A Apache Solr Document object that replace the default page document
* @return Document A Meilisearch Document object that replace the default page document
*/
public function getPageDocument(Document $pageDocument)
{
@@ -131,16 +131,16 @@ class PageFieldMappingIndexer implements SubstitutePageIndexer
* Allows to put the page record through cObj processing if wanted / needed.
* Otherwise the plain page record field value is used.
*
* @param string $solrFieldName The Solr field name to resolve the value from the item's record
* @param string $meilisearchFieldName The Meilisearch field name to resolve the value from the item's record
* @return string The resolved string value to be indexed
*/
protected function resolveFieldValue($solrFieldName, Document $pageDocument)
protected function resolveFieldValue($meilisearchFieldName, Document $pageDocument)
{
$pageRecord = $GLOBALS['TSFE']->page;
$pageIndexingConfiguration = $this->configuration->getIndexQueueFieldsConfigurationByConfigurationName($this->pageIndexingConfigurationName);
if (isset($pageIndexingConfiguration[$solrFieldName . '.'])) {
if (isset($pageIndexingConfiguration[$meilisearchFieldName . '.'])) {
$pageRecord = AbstractIndexer::addVirtualContentFieldToRecord($pageDocument, $pageRecord);
// configuration found => need to resolve a cObj
@@ -148,15 +148,15 @@ class PageFieldMappingIndexer implements SubstitutePageIndexer
$contentObject->start($pageRecord, 'pages');
$fieldValue = $contentObject->cObjGetSingle(
$pageIndexingConfiguration[$solrFieldName],
$pageIndexingConfiguration[$solrFieldName . '.']
$pageIndexingConfiguration[$meilisearchFieldName],
$pageIndexingConfiguration[$meilisearchFieldName . '.']
);
if (AbstractIndexer::isSerializedValue($pageIndexingConfiguration, $solrFieldName)) {
if (AbstractIndexer::isSerializedValue($pageIndexingConfiguration, $meilisearchFieldName)) {
$fieldValue = unserialize($fieldValue);
}
} else {
$fieldValue = $pageRecord[$pageIndexingConfiguration[$solrFieldName]];
$fieldValue = $pageRecord[$pageIndexingConfiguration[$meilisearchFieldName]];
}
return $fieldValue;