Load new search results on vocab and global search pages#1917
Merged
UnniKohonen merged 6 commits intomainfrom Feb 2, 2026
Merged
Load new search results on vocab and global search pages#1917UnniKohonen merged 6 commits intomainfrom
UnniKohonen merged 6 commits intomainfrom
Conversation
joelit
requested changes
Jan 29, 2026
Contributor
joelit
left a comment
There was a problem hiding this comment.
Looks pretty good. I would handle the search parameters trough the provided JS object, though.
resource/js/load-search-results.js
Outdated
Comment on lines
+20
to
+23
| const searchURL = | ||
| window.SKOSMOS.pageType === 'vocab-search' | ||
| ? `${window.SKOSMOS.vocab}/${window.SKOSMOS.lang}/search?clang=${window.SKOSMOS.content_lang}&q=${params.get('q')}&offset=${searchResultOffset}` | ||
| : `${window.SKOSMOS.lang}/search?clang=${window.SKOSMOS.content_lang}&q=${params.get('q')}&vocabs=${params.get('vocabs')}&offset=${searchResultOffset}` |
Contributor
There was a problem hiding this comment.
Maybe instead use the URLSearchParams object to handle the search parameters
Suggested change
| const searchURL = | |
| window.SKOSMOS.pageType === 'vocab-search' | |
| ? `${window.SKOSMOS.vocab}/${window.SKOSMOS.lang}/search?clang=${window.SKOSMOS.content_lang}&q=${params.get('q')}&offset=${searchResultOffset}` | |
| : `${window.SKOSMOS.lang}/search?clang=${window.SKOSMOS.content_lang}&q=${params.get('q')}&vocabs=${params.get('vocabs')}&offset=${searchResultOffset}` | |
| params.set('offset', searchResultOffset) | |
| const searchURL = | |
| window.SKOSMOS.pageType === 'vocab-search' | |
| ? `${window.SKOSMOS.vocab}/${window.SKOSMOS.lang}/search?${params.toString()}` | |
| : `${window.SKOSMOS.lang}/search?${params.toString()}` |
resource/js/load-search-results.js
Outdated
| const newLastResult = document.querySelector('.search-result:last-of-type') | ||
|
|
||
| const translatedMessage = $t('All %d results displayed').replace('%d', window.SKOSMOS.search_count) | ||
| newLastResult.innerHTML += `<p id="search-count">${translatedMessage}</p>` |
Contributor
There was a problem hiding this comment.
Looks a bit hacky, but when I tried writing something nicer by creating a p-element and appending it to the search-results div, it didn't really come up that much better.
|
osma
approved these changes
Feb 2, 2026
Member
osma
left a comment
There was a problem hiding this comment.
Tested it. Looks good, also works with special characters in the search string. Excellent work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Reasons for creating this PR
No new results are loaded when scrolling on vocab and global search pages. This PR adds the functionality.
Link to relevant issue(s), if any
Description of the changes in this PR
load-search-results.jsthat loads new search results when the search result list is scrolled downsearch_countandsearch_results_sizekeys toSKOSMOSobjectKnown problems or uncertainties in this PR
Checklist
.sr-onlyclass, color contrast)