Skip to content

Commit

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

Bugfix stable 3 3 0 10111 fix search result
  • Loading branch information
jonasraoni authored Jun 25, 2024
2 parents e7513af + 2890a03 commit d68b40e
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 @@ 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 @@ -210,7 +209,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

0 comments on commit d68b40e

Please sign in to comment.