Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/main/resources/mapper/pick/Pick.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@
<!-- 3. pick_option.pick_option_contents 에서 매칭된 경우-->
<select id="findPickSearchDtoByKeywordAndCursor" resultMap="pickSearchDto">
select pick_id,
max_total_score
max(max_total_score) as max_total_score
from (
select p.id as pick_id,
(
coalesce(least(match(p.title) against(#{keyword} in natural language mode), 100000) * 3.0, 0) +
coalesce(
(select max(least(match(po.title) against(#{keyword} in natural language mode), 100000) * 2.0)
from devdevdev.pick_option po
where po.pick_id = p.id), 0
(
select max(least(match(po.title) against(#{keyword} in natural language mode), 100000) * 2.0)
from devdevdev.pick_option po
where po.pick_id = p.id), 0
) +
coalesce(
(select max(least(match(po.pick_option_contents) against(#{keyword} in natural language mode), 100000))
from devdevdev.pick_option po
where po.pick_id = p.id), 0
(
select max(least(match(po.pick_option_contents) against(#{keyword} in natural language mode), 100000))
from devdevdev.pick_option po
where po.pick_id = p.id), 0
)
) as max_total_score
from devdevdev.pick p
where match(p.title) against(#{keyword} in natural language mode)
where match(p.title) against(#{keyword} in boolean mode)
and p.content_status = 'APPROVAL'

union
Expand All @@ -42,7 +44,7 @@
) as max_total_score
from devdevdev.pick p
inner join devdevdev.pick_option po on p.id = po.pick_id
where match(po.title) against(#{keyword} in natural language mode)
where match(po.title) against(#{keyword} in boolean mode)
and p.content_status = 'APPROVAL'
group by p.id

Expand All @@ -56,7 +58,7 @@
) as max_total_score
from devdevdev.pick p
inner join devdevdev.pick_option po on p.id = po.pick_id
where match(po.pick_option_contents) against(#{keyword} in natural language mode)
where match(po.pick_option_contents) against(#{keyword} in boolean mode)
and p.content_status = 'APPROVAL'
group by p.id
) as pick_search_results
Expand All @@ -69,6 +71,7 @@
)
</if>
</where>
group by pick_id
order by max_total_score desc, pick_id desc
limit #{limit}
</select>
Expand Down