null+****@clear*****
null+****@clear*****
2012年 8月 9日 (木) 13:44:03 JST
SHIMODA Hiroshi 2012-08-09 13:44:03 +0900 (Thu, 09 Aug 2012) New Revision: a6a0975aec39c8de53bbd2ed610a2b422fb8e53e https://github.com/groonga/gcs/commit/a6a0975aec39c8de53bbd2ed610a2b422fb8e53e Log: Format select results correctly Modified files: lib/database/domain.js lib/wrapped-nroonga.js Modified: lib/database/domain.js (+2 -7) =================================================================== --- lib/database/domain.js 2012-08-09 12:39:42 +0900 (7ce4157) +++ lib/database/domain.js 2012-08-09 13:44:03 +0900 (58fe888) @@ -264,14 +264,9 @@ Domain.prototype = { }; var synonyms = this.context.commandSync('select', options); - synonyms = nroonga.formatResults(synonyms); - Object.keys(synonyms).sort().forEach(function(key) { - var terms = synonyms[key]; - terms = JSON.parse(terms); - synonyms[key] = terms.sort(); - }); + synonyms = nroonga.formatSelectResult(synonyms); - return synonyms; + return synonyms.results; }, updateSynonymsSync: function(synonymOptions) { Modified: lib/wrapped-nroonga.js (+8 -0) =================================================================== --- lib/wrapped-nroonga.js 2012-08-09 12:39:42 +0900 (f5155b3) +++ lib/wrapped-nroonga.js 2012-08-09 13:44:03 +0900 (ef29e50) @@ -133,3 +133,11 @@ function formatResults(results) { return hashResults; } exports.formatResults = formatResults; + +function formatSelectResult(result) { + return { + count: result[0][0], + results: formatResults(result.slice(1)) + }; +} +exports.formatSelectResult = formatSelectResult; -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download