Skip to content

Commit

Permalink
fix search on posts
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Feb 15, 2019
1 parent ba00f7a commit e95e9fe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/server/routes/rest/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ var route = function(req, res, next) {
req.query.searchfields !== ''
) {
searchfields = req.query.searchfields.split(',');
searchfields = searchfields.map((item) => {
return ('publish.' + item);
});
}

var list = Manager.instance.getPage(
var result = Manager.instance.getPage(
start,
length,
sortField,
Expand All @@ -60,8 +63,12 @@ var route = function(req, res, next) {
searchfields
)

result.data = result.data.map((doc) => {
return (doc.publish)
})

res.set('Content-Type', 'application/json')
res.send(JSON.stringify(list))
res.send(JSON.stringify(result))
}

export default route

0 comments on commit e95e9fe

Please sign in to comment.