diff --git a/packages/lib/services/rest/routes/search.ts b/packages/lib/services/rest/routes/search.ts index 6bc60a4df..cf0efca75 100644 --- a/packages/lib/services/rest/routes/search.ts +++ b/packages/lib/services/rest/routes/search.ts @@ -37,8 +37,8 @@ export default async function(request: Request) { 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 - // relevance. + // We do not sort the results if the "order_by" query parameter is not specified, because the + // search engine has already sorted them in order of relevance. // https://github.com/laurent22/joplin/issues/10088 - return collectionToPaginatedResults(modelType, results, request, { sort: false }); + return collectionToPaginatedResults(modelType, results, request, { sort: !!request.query.order_by }); }