mirror of
https://github.com/zadam/trilium.git
synced 2024-11-17 21:21:40 +08:00
20 lines
411 B
JavaScript
20 lines
411 B
JavaScript
|
"use strict";
|
||
|
|
||
|
const autocompleteService = require('../../services/autocomplete');
|
||
|
|
||
|
async function getAutocomplete(req) {
|
||
|
const query = req.query.query;
|
||
|
|
||
|
const results = autocompleteService.getResults(query);
|
||
|
|
||
|
return results.map(res => {
|
||
|
return {
|
||
|
value: res.title + '(' + res.path + ')',
|
||
|
title: res.title
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
getAutocomplete
|
||
|
};
|