Skip to content

Commit

Permalink
feature(search): update search feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Akinmyde committed May 21, 2019
1 parent cdc8c6d commit bf8d036
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/controllers/search-article.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const searchArticles = async (req, res) => {
});
}
const searchFilter = req.query.filter;
const limit = 3;
const articles = Article.findAll({
limit,
where: {
title: {
[sequelize.Op.iLike]: `%${searchFilter}%`,
Expand All @@ -38,6 +40,7 @@ const searchArticles = async (req, res) => {
});

const keywords = Keyword.findAll({
limit,
where: {
keyword: {
[sequelize.Op.iLike]: `%${searchFilter}%`,
Expand Down Expand Up @@ -68,6 +71,7 @@ const searchArticles = async (req, res) => {
});

const authors = User.findAll({
limit,
where: {
first_name: {
[sequelize.Op.iLike]: `%${searchFilter}%`,
Expand Down

0 comments on commit bf8d036

Please sign in to comment.