More work on getting multiple keywords working
This commit is contained in:
parent
14e22e0d31
commit
aa347e91c2
@ -17,8 +17,8 @@
|
||||
|
||||
$.getJSON('/node/search', params, function(results) {
|
||||
var hintData = {};
|
||||
for (var feature in results.columns) {
|
||||
hintData[feature] = results.columns[feature].hints;
|
||||
for (var keyword in results.columns) {
|
||||
hintData[keyword] = results.columns[keyword].hints;
|
||||
}
|
||||
|
||||
ctx.grapher.setColumnHints(hintData);
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
function onSearch() {
|
||||
var params = {
|
||||
keyword: $('#keyword').val(),
|
||||
keywords: $('#keywords').val(),
|
||||
searchRange: { min: -1.0, max: 1.0 },
|
||||
minScore: parseInt($('#minScore').val()),
|
||||
hintSteps: parseInt($('#hintSteps').val()),
|
||||
@ -73,24 +73,28 @@
|
||||
$('#results').append(template({'results': results}));
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).on({
|
||||
ajaxStart: function() {
|
||||
$('#spinner').show();
|
||||
},
|
||||
|
||||
ajaxStop: function() {
|
||||
$('#spinner').hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
$.getJSON('/node/keywords', function(keywords) {
|
||||
for (var i = 0; i < keywords.length; ++i) {
|
||||
var properties = { value: keywords[i], text: keywords[i] };
|
||||
$('#keyword').append($('<option></option>', properties));
|
||||
for (var i = 0, count = keywords.length; i < count; ++i) {
|
||||
$('#keywords').append($('<option></option>', {
|
||||
value: keywords[i],
|
||||
text: keywords[i]
|
||||
}));
|
||||
}
|
||||
|
||||
$('#search').prop('disabled', false);
|
||||
$('#search').click(onSearch);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}(window.hscd = window.hscd || {}));
|
||||
|
@ -118,6 +118,8 @@ module.exports.execQuery = function(query) {
|
||||
var searchResults = null;
|
||||
|
||||
if (!searchParams) {
|
||||
searchParams = {};
|
||||
|
||||
for (var i = 0, count = query.keywords.length; i < count; ++i) {
|
||||
var keyword = query.keywords[i];
|
||||
if (_.has(db_keywords, keyword)) {
|
||||
@ -142,7 +144,7 @@ module.exports.execQuery = function(query) {
|
||||
query.hintSteps
|
||||
);
|
||||
|
||||
graphColumns[param.name] = {
|
||||
graphColumns[keyword] = {
|
||||
color: '#607080',
|
||||
value: searchParams[keyword],
|
||||
hints: searchHints,
|
||||
|
Loading…
Reference in New Issue
Block a user