Update quick start guide's complex query.
This commit is contained in:
@ -113,9 +113,9 @@ NOTE: In this example, `request` and `response` are http://expressjs.com/api.htm
|
||||
|
||||
[source,js]
|
||||
-----------------
|
||||
var pageNum = request.param('page', 1);
|
||||
var perPage = request.param('per_page', 15);
|
||||
var userQuery = request.param('search_query');
|
||||
var pageNum = request.params.page;
|
||||
var perPage = request.params.per_page;
|
||||
var userQuery = request.params.'search_query;
|
||||
var userId = request.session.userId;
|
||||
|
||||
client.search({
|
||||
@ -146,16 +146,17 @@ client.search({
|
||||
}
|
||||
}
|
||||
}
|
||||
}, function (error, response) {
|
||||
}
|
||||
}, function (err, res) {
|
||||
if (err) {
|
||||
// handle error
|
||||
return;
|
||||
}
|
||||
|
||||
response.render('search_results', {
|
||||
results: response.hits.hits,
|
||||
results: res.hits.hits,
|
||||
page: pageNum,
|
||||
pages: Math.ceil(response.hits.total / perPage)
|
||||
pages: Math.ceil(res.hits.total / perPage)
|
||||
})
|
||||
});
|
||||
-----------------
|
||||
|
||||
Reference in New Issue
Block a user