mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
(search) limit results to 20
This commit is contained in:
parent
dc98014744
commit
05ce86ef1a
@ -407,6 +407,8 @@ class SearchIndexInclusive extends SearchIndex {
|
||||
}
|
||||
}
|
||||
|
||||
const SEARCH_LIMIT = 20;
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const indices = Object.fromEntries(
|
||||
[
|
||||
@ -432,6 +434,7 @@ export default defineEventHandler(async (event) => {
|
||||
.toSorted((resultA, resultB) => {
|
||||
return resultB.score - resultA.score;
|
||||
})
|
||||
.slice(0, SEARCH_LIMIT)
|
||||
.map((result) => {
|
||||
return indices[result.type].transform(result);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user