Navigation Menu

Skip to content

Commit

Permalink
path_facets can be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
darashi committed Aug 28, 2012
1 parent 1649429 commit 4a00ef9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/server.js
Expand Up @@ -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({
Expand All @@ -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,
Expand Down

0 comments on commit 4a00ef9

Please sign in to comment.