1

Adding code to remove keywords

This commit is contained in:
Alex Yatskov 2014-11-09 12:15:27 +09:00
parent 16da52d53f
commit 305e6d96ec
2 changed files with 24 additions and 1 deletions

View File

@ -93,7 +93,24 @@
}
function onForget() {
var keyword = $('#searchKeyword').val();
if (!confirm('Are you sure you want to delete keyword "' + keyword + '"?')) {
return;
}
var query = {
keyword: keyword
};
$.getJSON('/remove_keyword', query, function(results) {
if (results.success) {
$('#searchKeyword option:selected').remove();
onSearch();
}
else {
alert('Failed to forget keyword');
}
});
}
function onSearch() {
@ -156,7 +173,7 @@
history.slider('setValue', count - 1);
if (count > 1) {
$('#history').slideDown();
$('#history').show();
}
}

View File

@ -55,6 +55,12 @@ function main(staticFiles, port) {
});
});
app.use('/remove_keyword', function(req, res) {
search.removeKeyword(req.query, function(results) {
res.json(results);
});
});
app.use('/search', function(req, res) {
search.execQuery(req.query, function(results) {
res.json(results);