1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Chore: Fixed sorting logic for search API

This commit is contained in:
Laurent Cozic 2024-04-27 12:11:40 +01:00
parent 5cdc1e93b3
commit 431ce430a0

View File

@ -37,8 +37,8 @@ export default async function(request: Request) {
results = (await SearchEngineUtils.notesForQuery(query, false, options)).notes; results = (await SearchEngineUtils.notesForQuery(query, false, options)).notes;
} }
// We do not sort the results because the search engine has already sorted them in order of // We do not sort the results if the "order_by" query parameter is not specified, because the
// relevance. // search engine has already sorted them in order of relevance.
// https://github.com/laurent22/joplin/issues/10088 // https://github.com/laurent22/joplin/issues/10088
return collectionToPaginatedResults(modelType, results, request, { sort: false }); return collectionToPaginatedResults(modelType, results, request, { sort: !!request.query.order_by });
} }