diff options
| author | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2024-04-11 19:16:31 +0300 |
|---|---|---|
| committer | Geo Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2024-04-11 19:16:31 +0300 |
| commit | 762d85c95690f510bec4dd8c37c05454ae1be4fc (patch) | |
| tree | bb2283602195f299530b862fbe761ddbf4e821ce /paths.js | |
| parent | f6682b3a1d90ae4f0b86edebb28ebb17a811b57a (diff) | |
| download | oseine-762d85c95690f510bec4dd8c37c05454ae1be4fc.tar.gz oseine-762d85c95690f510bec4dd8c37c05454ae1be4fc.tar.bz2 oseine-762d85c95690f510bec4dd8c37c05454ae1be4fc.zip | |
introduce resemblance; compare match implementations; retro-search in progress
Diffstat (limited to 'paths.js')
| -rw-r--r-- | paths.js | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -1,8 +1,10 @@ const Router = require('koa-router'); + const kb = require('./pieces/kb-util.js'); const data = require('./pieces/prepare-streams'); const products = require('./data/products.json'); const bench = require('./benchmark/find.js'); +const macthStr = require('./benchmark/match-str.js'); // Prefix all routes with: /items const router = new Router({ @@ -48,16 +50,29 @@ const router = new Router({ // Routes + +router.get('/', (ctx, next) => { + ctx.body = { + success: true, + title: 'oseine', + description: 'oseine search engine is not elastic', + message: 'where are you now?' + } + next(); +}) + router.get('/search', (ctx, next) => { ctx.body = []; next(); }); router.get('/search/:title', (ctx, next) => { + // console.log(ctx); let words = kb.keyboardize(kb.clean(ctx.params.title)).split(' '); ctx.body = { params: ctx.params, - results: words + results: words, + nxt: next }; next(); }); @@ -105,7 +120,14 @@ router.get('/test/json', (ctx, next) => { // easy test route router.get('/bench/fe', (ctx, next) => { // easy test route // test anything ... // ctx.body = bench.compare(); - ctx.body = bench.byFor(); + ctx.body = bench.compare(); + next(); +}); + +router.get('/bench/match', (ctx, next) => { // easy test route + // test anything ... + // ctx.body = bench.compare(); + ctx.body = macthStr.run(); next(); }); |
