From 4ba4799083ebe4954c0b3284ecff3bf96e851203 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 17 Oct 2014 18:07:06 +0900 Subject: [PATCH] Fixing JavaScript warnings, returning review ID with records --- server/search.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/search.js b/server/search.js index d3da555..80a1e13 100644 --- a/server/search.js +++ b/server/search.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + /* The MIT License (MIT) @@ -63,8 +65,8 @@ function add(values1, values2) { function combine(dict, params) { var result = {}; - for (var key in params) { - var values = scale(dict[key], params[key]); + for (var paramIter in params) { + var values = scale(dict[paramIter], params[paramIter]); result = add(values, result); } @@ -73,8 +75,8 @@ function combine(dict, params) { }); if (max > 0.0) { - for (var key in result) { - result[key] = result[key] / max; + for (var resultIter in result) { + result[resultIter] = result[resultIter] / max; } } @@ -242,6 +244,7 @@ function getRecords(callback) { var records = _.map(rows, function(row) { return { name: row.name, + id: row.id, relativeUrl: row.url, rating: { food: row.food, @@ -290,7 +293,7 @@ function execQuery(query, callback) { value: query.searchParams[keyword], hints: searchHints, steps: query.hintSteps - } + }; } callback({