similar notes algorithm tweaks (WIP)

This commit is contained in:
zadam
2020-09-10 21:01:46 +02:00
parent bff5b015ea
commit 056c40c0d0
4 changed files with 35 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
const noteCacheService = require('../../services/note_cache/note_cache_service');
const repository = require('../../services/repository');
function getSimilarNotes(req) {
async function getSimilarNotes(req) {
const noteId = req.params.noteId;
const note = repository.getNote(noteId);
@@ -12,7 +12,7 @@ function getSimilarNotes(req) {
return [404, `Note ${noteId} not found.`];
}
const results = noteCacheService.findSimilarNotes(noteId);
const results = await noteCacheService.findSimilarNotes(noteId);
return results
.filter(note => note.noteId !== noteId);