first commit
This commit is contained in:
@@ -32,7 +32,7 @@ use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* A ResultParser is responsible to create the result object structure from the \Apache_Solr_Response
|
||||
* A ResultParser is responsible to create the result object structure from the \Apache_Meilisearch_Response
|
||||
* and assign it to the SearchResultSet.
|
||||
*/
|
||||
abstract class AbstractResultParser {
|
||||
|
@@ -62,7 +62,7 @@ class DefaultResultParser extends AbstractResultParser {
|
||||
}
|
||||
|
||||
foreach ($documents as $searchResult) {
|
||||
$searchResultObject = $this->searchResultBuilder->fromApacheSolrDocument($searchResult);
|
||||
$searchResultObject = $this->searchResultBuilder->fromApacheMeilisearchDocument($searchResult);
|
||||
$searchResults[] = $searchResultObject;
|
||||
}
|
||||
|
||||
|
@@ -26,11 +26,11 @@ namespace WapplerSystems\Meilisearch\Domain\Search\ResultSet\Result\Parser;
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\System\Configuration\TypoScriptConfiguration;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Document\Document;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Document\Document;
|
||||
use WapplerSystems\Meilisearch\Util;
|
||||
|
||||
/**
|
||||
* Applies htmlspecialschars on documents of a solr response.
|
||||
* Applies htmlspecialschars on documents of a meilisearch response.
|
||||
*/
|
||||
class DocumentEscapeService {
|
||||
|
||||
@@ -44,7 +44,7 @@ class DocumentEscapeService {
|
||||
* @param TypoScriptConfiguration|null $typoScriptConfiguration
|
||||
*/
|
||||
public function __construct(TypoScriptConfiguration $typoScriptConfiguration = null) {
|
||||
$this->typoScriptConfiguration = $typoScriptConfiguration ?? Util::getSolrConfiguration();
|
||||
$this->typoScriptConfiguration = $typoScriptConfiguration ?? Util::getMeilisearchConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,13 +56,13 @@ class DocumentEscapeService {
|
||||
*/
|
||||
public function applyHtmlSpecialCharsOnAllFields(array $documents)
|
||||
{
|
||||
$trustedSolrFields = $this->typoScriptConfiguration->getSearchTrustedFieldsArray();
|
||||
$trustedMeilisearchFields = $this->typoScriptConfiguration->getSearchTrustedFieldsArray();
|
||||
|
||||
foreach ($documents as $key => $document) {
|
||||
$fieldNames = array_keys($document->getFields() ?? []);
|
||||
|
||||
foreach ($fieldNames as $fieldName) {
|
||||
if (is_array($trustedSolrFields) && in_array($fieldName, $trustedSolrFields)) {
|
||||
if (is_array($trustedMeilisearchFields) && in_array($fieldName, $trustedMeilisearchFields)) {
|
||||
// we skip this field, since it was marked as secure
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user