Skip to content

Commit

Permalink
Merge pull request #4338 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 b91d468 + 3d3cedb commit d3f50ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions classes/search/ArticleSearch.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ public 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 @@ public 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 d3f50ed

Please sign in to comment.