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]
|
[source,js]
|
||||||
-----------------
|
-----------------
|
||||||
var pageNum = request.param('page', 1);
|
var pageNum = request.params.page;
|
||||||
var perPage = request.param('per_page', 15);
|
var perPage = request.params.per_page;
|
||||||
var userQuery = request.param('search_query');
|
var userQuery = request.params.'search_query;
|
||||||
var userId = request.session.userId;
|
var userId = request.session.userId;
|
||||||
|
|
||||||
client.search({
|
client.search({
|
||||||
@ -146,16 +146,17 @@ client.search({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, function (error, response) {
|
}
|
||||||
|
}, function (err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// handle error
|
// handle error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.render('search_results', {
|
response.render('search_results', {
|
||||||
results: response.hits.hits,
|
results: res.hits.hits,
|
||||||
page: pageNum,
|
page: pageNum,
|
||||||
pages: Math.ceil(response.hits.total / perPage)
|
pages: Math.ceil(res.hits.total / perPage)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user