[Groonga-commit] nroonga/norema [master] path_facets can be undefined

Back to archive index

Yoji SHIDARA null+****@clear*****
Tue Aug 28 15:08:51 JST 2012


Yoji SHIDARA	2012-08-28 15:08:51 +0900 (Tue, 28 Aug 2012)

  New Revision: 4a00ef96b66512fa9edc172a6c6788f876c47a58
  https://github.com/nroonga/norema/commit/4a00ef96b66512fa9edc172a6c6788f876c47a58

  Log:
    path_facets can be undefined

  Modified files:
    lib/server.js

  Modified: lib/server.js (+6 -1)
===================================================================
--- lib/server.js    2012-08-22 21:09:56 +0900 (4ffbe08)
+++ lib/server.js    2012-08-28 15:08:51 +0900 (6ccddd4)
@@ -101,6 +101,7 @@ app.get('/search', function(request, response, next) {
     var nextStart = start + options.size;
     var previousStart = start - options.size;
     var nextLink = previousLink = null;
+    var pathFacets = [];
 
     if (nextStart < numFound) {
       nextLink = urlForSearch({
@@ -115,13 +116,17 @@ app.get('/search', function(request, response, next) {
       });
     }
 
+    if (results.facets.path_facet) {
+      pathFacets = results.facets.path_facet.constraints;
+    }
+
     var locals = {
       urlForSearch: urlForSearch,
       titleToId: titleToId,
       query: options.q,
       records: results.hits.hit,
       numFound: numFound,
-      pathFacets: results.facets.path_facet.constraints,
+      pathFacets: pathFacets,
       from: start + 1,
       to: start + numReturned,
       numShowing: numReturned,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index