Skip to content

Commit

Permalink
Merge pull request #1609 from jonasraoni/bugfix-stable-3_3_0-10111-fi…
Browse files Browse the repository at this point in the history
…x-search-result

Bugfix stable 3 3 0 10111 fix search result
  • Loading branch information
jonasraoni authored Jun 25, 2024
2 parents 28aebc9 + af22b64 commit 652ab19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions classes/search/MonographSearch.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ function getSparseArray($unorderedResults, $orderBy, $orderDir, $exclude) {
// Calculate a well-ordered (unique) score.
$resultCount = count($unorderedResults);
$i = 0;
foreach ($unorderedResults as $submissionId => &$data) {
// Reference is necessary to permit modification
$data['score'] = ($resultCount * $data['count']) + $i++;
foreach ($unorderedResults as $submissionId => $data) {
$data[$submissionId]['score'] = ($resultCount * $data['count']) + $i++;
}

// If we got a primary sort order then apply it and use score as secondary
Expand Down Expand Up @@ -211,7 +210,7 @@ function getKeywordsFromSearchFilters($searchFilters) {
$indexFieldMap[SUBMISSION_SEARCH_INDEX_TERMS] = 'indexTerms';
$keywords = array();
if (isset($searchFilters['query'])) {
$keywords[null] = $searchFilters['query'];
$keywords[''] = $searchFilters['query'];
}
foreach($indexFieldMap as $bitmap => $searchField) {
if (isset($searchFilters[$searchField]) && !empty($searchFilters[$searchField])) {
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp

0 comments on commit 652ab19

Please sign in to comment.