Skip to content

Commit

Permalink
fix: es keyword search query error correction
Browse files Browse the repository at this point in the history
- κΈ°μ‘΄ keyword 검색 μ‹œ 였λ₯˜κ°€ λ°œμƒν•˜μ—¬, term을 must 속성(λ°°μ—΄)μ›μ†Œ
둜 이동
  • Loading branch information
kgpyo committed Dec 9, 2019
1 parent 7a49749 commit bc0257a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 0 additions & 7 deletions apis/product/routes/controller/getProductInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ const getProductListController = async (req, res, next) => {
};
delete res.locals.filter;
}
if (res.locals.keyword) {
res.locals.query = {
...res.locals.query,
...res.locals.keyword,
};
delete res.locals.keyword;
}
try {
const list = await getElasticSearchResults(res.locals);
res.json(list);
Expand Down
7 changes: 4 additions & 3 deletions apis/product/routes/middleware/listView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../../core/string-conveter';

const addFilter = (filter = [], query) => {
if ('range' in query) {
if ('range' in query || 'term' in query) {
return [...filter, query];
}
return [...filter, { bool: query }];
Expand Down Expand Up @@ -106,12 +106,13 @@ const addOrderToOption = ({ query: { sort } }, res, next) => {
next();
};

// TODO ν‚€μ›Œλ“œ 검색(ν† ν¬λ‚˜μ΄μ €...)
// TODO ν‚€μ›Œλ“œ 검색
const addKeywordTofilter = ({ query: { keyword } }, res, next) => {
if (keyword) {
res.locals.keyword = {
const query = {
term: { title: keyword },
};
res.locals.filter = addFilter(res.locals.filter, query);
}
next();
};
Expand Down

0 comments on commit bc0257a

Please sign in to comment.