Skip to content

Commit

Permalink
Merge pull request #181 from KU-niverse/fix/search
Browse files Browse the repository at this point in the history
Fix: Full-text search 적용
  • Loading branch information
youngsupchoi authored May 28, 2024
2 parents b9b7899 + dd5450a commit bc210ff
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions models/wikiModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ class Wiki_docs {
const [rows] = await pool.query(
`
SELECT wiki_docs.*, IF(wiki_favorites.user_id IS NOT NULL, 1, 0) AS is_favorite
FROM wiki_docs
LEFT JOIN (
SELECT user_id, doc_id
FROM wiki_favorites
WHERE user_id = ? -- 여기에 현재 사용자의 ID를 삽입
) AS wiki_favorites
ON wiki_docs.id = wiki_favorites.doc_id
WHERE wiki_docs.title LIKE ?;
FROM wiki_docs
LEFT JOIN (
SELECT user_id, doc_id
FROM wiki_favorites
WHERE user_id = ? -- 여기에 현재 사용자의 ID를 삽입
) AS wiki_favorites
ON wiki_docs.id = wiki_favorites.doc_id
WHERE MATCH(wiki_docs.title, wiki_docs.recent_filtered_content) AGAINST (? IN NATURAL LANGUAGE MODE);
`,
[user_id, `%${title}%`]
[user_id, title]
);

return rows;
Expand Down

0 comments on commit bc210ff

Please sign in to comment.