Improve indentation in quickstart

This commit is contained in:
Spencer
2015-11-19 14:55:54 -06:00
parent f5a9ca983b
commit 315fd62fb1

View File

@ -118,46 +118,48 @@ var perPage = request.params.per_page;
var userQuery = request.params.search_query; var userQuery = request.params.search_query;
var userId = request.session.userId; var userId = request.session.userId;
client.search({ var searchParams = {
index: 'posts', index: 'posts',
from: (pageNum - 1) * perPage, from: (pageNum - 1) * perPage,
size: perPage, size: perPage,
body: { body: {
query: { query: {
filtered: { filtered: {
query: { query: {
match: { match: {
// match the query agains all of // match the query agains all of
// the fields in the posts index // the fields in the posts index
_all: userQuery _all: userQuery
}
},
filter: {
// only return documents that are
// public or owned by the current user
or: [
{
term: { privacy: "public" }
},
{
term: { owner: userId }
}
]
} }
},
filter: {
// only return documents that are
// public or owned by the current user
or: [
{
term: { privacy: "public" }
},
{
term: { owner: userId }
}
]
} }
} }
} }
}, function (err, res) { }
if (err) { };
client.search(searchParams, function (err, res) {
if (err) {
// handle error // handle error
return; throw err;
} }
response.render('search_results', { response.render('search_results', {
results: res.hits.hits, results: res.hits.hits,
page: pageNum, page: pageNum,
pages: Math.ceil(res.hits.total / perPage) pages: Math.ceil(res.hits.total / perPage)
}) });
}); });
----------------- -----------------