Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ protected function parseSortingIntoObjects(SearchResultSet $resultSet): SearchRe
$field = $sortingOptions['field'];
$label = $sortingOptions['label'] ?? '';

$isResetOption = $field === 'relevance';
$sortBy = explode(' ', $configuration->getSearchQuerySortBy())[0];
if ($sortBy === '') {
$sortBy = 'relevance';
}

$isResetOption = $field === $sortBy;

// Allow stdWrap on label:
$labelHasSubConfiguration = is_array($sortingOptions['label.'] ?? null);
Expand Down
14 changes: 12 additions & 2 deletions Classes/System/Configuration/TypoScriptConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,11 +1203,21 @@ public function getSearchQueryReturnFieldsAsArray(array $defaultIfEmpty = []): a
}

/**
* Returns the configured target page for the search.
* By default, the contextPageId will be used
* Return the configured query sortBy value.
*
* plugin.tx_solr.search.targetPage
*/
public function getSearchQuerySortBy($defaultIfEmpty = ''): string
{
return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.sortBy', $defaultIfEmpty);
}

/**
* Returns the configured target page for the search.
* By default, the contextPageId will be used
*
* plugin.tx_solr.search.targetPage
*/
public function getSearchTargetPage(): int
{
$targetPage = (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.targetPage', 0);
Expand Down
Loading