diff options
Diffstat (limited to 'routes')
-rw-r--r-- | routes/search.js (renamed from routes/index.js) | 6 | ||||
-rw-r--r-- | routes/suggest.js | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/routes/index.js b/routes/search.js index 570aea0..c861f61 100644 --- a/routes/index.js +++ b/routes/search.js @@ -2,13 +2,15 @@ const database = require("../database"); const express = require("express"); const router = express.Router(); -/* GET home page. */ router.get('/', (req, res, next) => { database.search("crawled", { size: 20, from: 0, query: { - match_all: {} + multi_match: { + query: req.query.q, + fuzziness: 3 // decrease for more specific results + } } }).then(results => { res.json(results.hits) diff --git a/routes/suggest.js b/routes/suggest.js new file mode 100644 index 0000000..352619f --- /dev/null +++ b/routes/suggest.js @@ -0,0 +1,9 @@ +const database = require("../database"); +const express = require("express"); +const router = express.Router(); + +router.get("/", (req, res, next) => { + res.json({message: "NOT INTEGRATED YET!"}) +}); + +module.exports = router;
\ No newline at end of file |