null+****@clear*****
null+****@clear*****
2012年 8月 9日 (木) 15:25:49 JST
Yoji SHIDARA 2012-08-09 15:25:49 +0900 (Thu, 09 Aug 2012) New Revision: 93063e48ada7f909a6ee1fb7f31a7637c0e8ab73 https://github.com/nroonga/norema/commit/93063e48ada7f909a6ee1fb7f31a7637c0e8ab73 Log: Show the number of records found Modified files: lib/server.js views/search.jade Modified: lib/server.js (+9 -4) =================================================================== --- lib/server.js 2012-08-09 15:08:36 +0900 (f17a9f0) +++ lib/server.js 2012-08-09 15:25:49 +0900 (059b9c5) @@ -64,11 +64,16 @@ app.get('/', function(request, response, next){ if (error) { return next(error); } - var records = results.hits.hit; + var locals = { + query: query, + records: results.hits.hit, + num_found: results.hits.found, + from: results.hits.start + 1, + to: results.hits.start + results.hits.hit.length, + num_showing: results.hits.hit.length + }; - return response.render('search.jade', - {records: records, query: query} - ); + return response.render('search.jade', locals); }); } else { return response.render('index.jade', Modified: views/search.jade (+3 -0) =================================================================== --- views/search.jade 2012-08-09 15:08:36 +0900 (5628375) +++ views/search.jade 2012-08-09 15:25:49 +0900 (7086eda) @@ -2,6 +2,9 @@ extends layout block content if records + .alert.alert-info + = "Found " + num_found + " entries. Showing " + from + " - " + to + " (" + num_showing + " entries)." + each record, index in records .record h2 #{record.data.title} -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download