Commit 2592736e authored by Nacim Goura's avatar Nacim Goura

configure elasticsearch

parent ff8e1e2c
......@@ -73,6 +73,7 @@ module.exports = {
searchSite.initElasticsearch()
.then((success) => {
console.log(chalk.green(success));
crawler.queue('http://www.hautesavoie.fr/vos-elus/christian-monteil');
crawler.queue(listSite);
crawler.on('drain', function(){
if(listError !== []) {
......
......@@ -115,11 +115,11 @@ exports.search = function(term) {
if(term) {
params.query = {
match: {
"title": {
query: term,
slop: 50
}
multi_match: {
query: term,
fuzziness: "AUTO",
fields: ['title', 'body'],
analyzer: 'analyzer_html'
}
};
}
......
......@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"start": "DEBUG=idsearch* node ./bin/www",
"postinstall": "cd public && bower install"
"postinstall": "bower install"
},
"dependencies": {
"body-parser": "~1.16.0",
......
......@@ -13,12 +13,14 @@ module.exports = function(app) {
searchController.search(term)
.then(function(sites) {
res.render('index', {
sites: sites
sites: sites,
term: term
});
}, (err) => {
console.log(err);
res.render('index', {
alert: err
alert: err,
term: term
});
});
});
......
<div class="row">
<form action="/" method="post">
<input type="search" class="form-control" name="search" placeholder="Rechercher...">
<input type="search" class="form-control" name="search" placeholder="Rechercher..." value="{{term}}">
<input type="submit" class="btn btn-success" value="Rechercher">
</form>
</div>
......@@ -10,7 +10,7 @@
<ul>
{{#each sites}}
<li>
<a href="{{this._source.url}}">{{this._source.title}}</a>
<a href="{{this._source.url}}" target="_blank">{{this._source.title}}</a>
</li>
{{/each}}
</ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment