Yoji SHIDARA
null+****@clear*****
Tue Aug 21 15:57:07 JST 2012
Yoji SHIDARA 2012-08-21 15:57:07 +0900 (Tue, 21 Aug 2012) New Revision: c64605a1c94e109071f0a98e3e8f9070002a1857 https://github.com/nroonga/norema/commit/c64605a1c94e109071f0a98e3e8f9070002a1857 Log: Specify all options in handler Modified files: lib/server.js Modified: lib/server.js (+7 -13) =================================================================== --- lib/server.js 2012-08-21 15:52:32 +0900 (c2144c2) +++ lib/server.js 2012-08-21 15:57:07 +0900 (e9605e2) @@ -30,14 +30,7 @@ app.use(function(error, request, response, next){ // helpers function search(options, callback) { - var searchOptions = { - size: options.size, - facet: 'path', - q: options.query, - start: options.start - } - - var url = 'http://' + searchNode + '/2011-02-01/search?' + querystring.stringify(searchOptions); + var url = 'http://' + searchNode + '/2011-02-01/search?' + querystring.stringify(options); console.log(url); var buffer = ''; var request = http.get(url, function(response) { @@ -83,9 +76,10 @@ app.get('/', function(request, response){ app.get('/search', function(request, response, next) { var options = { - query: request.query.query, + q: request.query.query, start: parseInt((request.query.start || '0'), 10), - size: 100 + size: 100, + facet: 'path' }; console.log('SEARCH', options); @@ -102,13 +96,13 @@ app.get('/search', function(request, response, next) { if (nextStart < numFound) { nextLink = urlForSearch({ - query: options.query, + query: options.q, start: nextStart }); } if (previousStart >= 0) { previousLink = urlForSearch({ - query: options.query, + query: options.q, start: previousStart }); } @@ -116,7 +110,7 @@ app.get('/search', function(request, response, next) { var locals = { urlForSearch: urlForSearch, titleToId: titleToId, - query: options.query, + query: options.q, records: results.hits.hit, numFound: numFound, pathFacets: results.facets.path.constraints, -------------- next part -------------- HTML����������������������������... Download