Fixing search
This commit is contained in:
parent
aa347e91c2
commit
f3f23a288b
@ -114,30 +114,26 @@ module.exports.getKeywords = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports.execQuery = function(query) {
|
module.exports.execQuery = function(query) {
|
||||||
var searchParams = query.searchParams;
|
if (!query.searchParams) {
|
||||||
var searchResults = null;
|
query.searchParams = {};
|
||||||
|
|
||||||
if (!searchParams) {
|
|
||||||
searchParams = {};
|
|
||||||
|
|
||||||
for (var i = 0, count = query.keywords.length; i < count; ++i) {
|
for (var i = 0, count = query.keywords.length; i < count; ++i) {
|
||||||
var keyword = query.keywords[i];
|
var keyword = query.keywords[i];
|
||||||
if (_.has(db_keywords, keyword)) {
|
if (_.has(db_keywords, keyword)) {
|
||||||
searchParams[keyword] = 1.0;
|
query.searchParams[keyword] = 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResults = findData(
|
|
||||||
searchParams,
|
|
||||||
query.minScore,
|
|
||||||
query.maxResults
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var searchResults = findData(
|
||||||
|
query.searchParams,
|
||||||
|
query.minScore,
|
||||||
|
query.maxResults
|
||||||
|
);
|
||||||
|
|
||||||
var graphColumns = {};
|
var graphColumns = {};
|
||||||
for (var keyword in searchParams) {
|
for (var keyword in query.searchParams) {
|
||||||
var searchHints = searchBuildHints(
|
var searchHints = searchBuildHints(
|
||||||
searchParams,
|
query.searchParams,
|
||||||
query.minScore,
|
query.minScore,
|
||||||
keyword,
|
keyword,
|
||||||
query.searchRange,
|
query.searchRange,
|
||||||
@ -146,7 +142,7 @@ module.exports.execQuery = function(query) {
|
|||||||
|
|
||||||
graphColumns[keyword] = {
|
graphColumns[keyword] = {
|
||||||
color: '#607080',
|
color: '#607080',
|
||||||
value: searchParams[keyword],
|
value: query.searchParams[keyword],
|
||||||
hints: searchHints,
|
hints: searchHints,
|
||||||
steps: query.hintSteps
|
steps: query.hintSteps
|
||||||
}
|
}
|
||||||
@ -154,7 +150,7 @@ module.exports.execQuery = function(query) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
columns: graphColumns,
|
columns: graphColumns,
|
||||||
params: searchParams,
|
params: query.searchParams,
|
||||||
items: searchResults
|
items: searchResults
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user