1

Search using network

This commit is contained in:
Alex Yatskov 2014-07-28 16:21:08 +09:00
parent a9f03b30f6
commit 7401359144
2 changed files with 21 additions and 12 deletions

View File

@ -11,20 +11,29 @@ function outputResults(results, maxResults) {
}
function onAdjust(name, value) {
// var wa = window.adjuster;
// var wg = window.grapher;
var wa = window.adjuster;
var wg = window.grapher;
// wa.searchParams[name] = value;
// console.log(wa.searchParams);
wa.searchParams[name] = value;
console.log(wa.searchParams);
// var hintData = {};
// _.each(wg.getColumnNames(), function(name) {
// hintData[name] = searchBuildHints(wa.searchParams, wa.minScore, name, wa.searchRange, wa.hintSteps);
// });
// wg.setColumnHints(hintData);
var params = {
searchParams: wa.searchParams,
searchRange: wa.searchRange,
minScore: wa.minScore,
hintSteps: wa.hintSteps,
maxResults: wa.maxResults
};
// var results = searchData(wa.searchParams, wa.minScore);
// outputResults(results, wa.maxResults);
$.getJSON('/node/search', params, function(results) {
var hintData = { };
for (var feature in results.columns) {
hintData[feature] = results.columns[feature].hints;
}
wg.setColumnHints(hintData);
outputResults(results.items, params.maxResults);
});
}
function onSearch() {

View File

@ -130,7 +130,7 @@ module.exports.getKeywords = function() {
}
module.exports.execQuery = function(query) {
var searchParams = db_keywords[query.keyword];
var searchParams = query.searchParams || db_keywords[query.keyword];
var searchResults = searchData(searchParams, query.minScore);
var graphColumns = { };