diff --git a/packages/lib/services/rest/routes/search.ts b/packages/lib/services/rest/routes/search.ts index e813f2b2d51..ce7f3c67904 100644 --- a/packages/lib/services/rest/routes/search.ts +++ b/packages/lib/services/rest/routes/search.ts @@ -5,7 +5,7 @@ import { ErrorBadRequest, ErrorMethodNotAllowed } from '../utils/errors'; import requestFields from '../utils/requestFields'; import collectionToPaginatedResults from '../utils/collectionToPaginatedResults'; import BaseItem from '../../../models/BaseItem'; -import SearchEngineUtils from '../../searchengine/SearchEngineUtils'; +import SearchEngineUtils, { NotesForQueryOptions } from '../../searchengine/SearchEngineUtils'; export default async function(request: Request) { if (request.method !== 'GET') throw new ErrorMethodNotAllowed(); @@ -28,7 +28,11 @@ export default async function(request: Request) { options.caseInsensitive = true; results = await ModelClass.all(options); } else { - results = await SearchEngineUtils.notesForQuery(query, false, defaultLoadOptions(request, ModelType.Note)); + const options: NotesForQueryOptions = { + ...defaultLoadOptions(request, ModelType.Note), + appendWildCards: true, + }; + results = await SearchEngineUtils.notesForQuery(query, false, options); } return collectionToPaginatedResults(modelType, results, request);