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

View File

@ -130,7 +130,7 @@ module.exports.getKeywords = function() {
} }
module.exports.execQuery = function(query) { 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 searchResults = searchData(searchParams, query.minScore);
var graphColumns = { }; var graphColumns = { };