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 userId = request.session.userId;
client.search({
index: 'posts',
from: (pageNum - 1) * perPage,
size: perPage,
body: {
query: {
filtered: {
query: {
match: {
// match the query agains all of
// the fields in the posts index
_all: userQuery
}
},
filter: {
// only return documents that are
// public or owned by the current user
or: [
{
term: { privacy: "public" }
},
{
term: { owner: userId }
}
]
var searchParams = {
index: 'posts',
from: (pageNum - 1) * perPage,
size: perPage,
body: {
query: {
filtered: {
query: {
match: {
// match the query agains all of
// the fields in the posts index
_all: userQuery
}
},
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
return;
throw err;
}
response.render('search_results', {
results: res.hits.hits,
page: pageNum,
pages: Math.ceil(res.hits.total / perPage)
})
});
});
-----------------