Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[๐Ÿ”จfix/#160] ์ธํ„ด ๊ณต๊ณ  ๊ฒ€์ƒ‰ ๋กœ์ง ์ˆ˜์ • #161

Merged
merged 2 commits into from
Oct 15, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ public List<InternshipAnnouncement> getMostScrappedInternship() {

@Override
public Page<InternshipAnnouncement> searchInternshipAnnouncement(String keyword, String sortBy, Pageable pageable) {
keyword = keyword.toLowerCase();

List<InternshipAnnouncement> internshipAnnouncements = jpaQueryFactory
.selectFrom(internshipAnnouncement)
.where(contentLike(keyword))
.where(contentLike(keyword, isPureEnglish(keyword)))
.orderBy(sortAnnouncementsByDeadline().asc(), createOrderSpecifier(sortBy))
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
Expand All @@ -75,14 +76,24 @@ public Page<InternshipAnnouncement> searchInternshipAnnouncement(String keyword,
JPAQuery<Long> count = jpaQueryFactory
.select(internshipAnnouncement.count())
.from(internshipAnnouncement)
.where(contentLike(keyword));
.where(contentLike(keyword, isPureEnglish(keyword)));


return PageableExecutionUtils.getPage(internshipAnnouncements, pageable, count::fetchOne);
}

private BooleanExpression contentLike(String keyword) {
return internshipAnnouncement.title.contains(keyword);
private boolean isPureEnglish(String summonerName) {
//๊ณต๋ฐฑ์€ ๋ฌด์‹œ
return summonerName.replaceAll("\\s", "").matches("^[a-zA-Z]+$");
}

private BooleanExpression contentLike(String keyword, boolean isPureEnglish) {
if(isPureEnglish) {
return Expressions.stringTemplate("LOWER({0})", internshipAnnouncement.title).contains(keyword);
} else {
keyword = keyword.replaceAll("\\s", "");
return Expressions.stringTemplate("REPLACE(LOWER({0}), ' ', '')", internshipAnnouncement.title).contains(keyword);
}
Comment on lines +90 to +96
Copy link
Member

@jsoonworld jsoonworld Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ๋กœ์ง ์„ค๊ณ„ ๊ด€๋ จ
    ์ˆœ์ˆ˜ ์˜์–ด ํ‚ค์›Œ๋“œ์™€ ํ•œ๊ธ€ ํ˜น์€ ํ˜ผํ•ฉ ํ‚ค์›Œ๋“œ๋ฅผ ๊ตฌ๋ถ„ํ•˜๋Š” ๋กœ์ง์ด ์ž˜ ์„ค๊ณ„๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!
    isPureEnglish์— ๋”ฐ๋ผ ์กฐ๊ฑด์„ ๋ถ„๋ฆฌํ•˜์—ฌ ๊ฐ๊ฐ์˜ ๊ฒฝ์šฐ์— ๋งž๋Š” ๊ฒ€์ƒ‰ ์ฒ˜๋ฆฌ๋ฅผ ๊ตฌํ˜„ํ•œ ๋ถ€๋ถ„๋„ ๋ช…ํ™•ํ•ด์„œ ์ข‹๋„ค์š”.

์งˆ๋ฌธ:
๋‹ค๋งŒ, ์˜์–ด์ผ ๋•Œ ์™œ ๋„์–ด์“ฐ๊ธฐ๋ฅผ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š๋Š”์ง€์— ๋Œ€ํ•œ ๋ฐฐ๊ฒฝ ์„ค๋ช…์„ ์กฐ๊ธˆ ๋” ๋ถ€ํƒ๋“œ๋ ค๋„ ๋ ๊นŒ์š”?
์˜ˆ๋ฅผ ๋“ค์–ด,

hello world, helloworld

์ด๋Ÿฐ ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์•„์„œ ๊ดœ์ฐฎ์€ ๊ฑธ๊นŒ์š”?

Copy link
Member Author

@JungYoonShin JungYoonShin Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์Œ..๋„์–ด์“ฐ๊ธฐ์— ๋Œ€ํ•ด ์ œ๊ฐ€ ๋ช…ํ™•ํ•œ ๊ธฐ์ค€์„ ๊ฐ€์ง€์ง€ ์•Š์•˜๋˜ ๊ฒƒ ๊ฐ™๋„ค์š”..! ์งˆ๋ฌธ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

์žฅ์ˆœ๋‹˜์ด ๋ง์”€ํ•ด์ฃผ์‹  "hello world", "helloworld"์˜ ๊ฒฝ์šฐ์ฒ˜๋Ÿผ ๋‘ ๋‹จ์–ด๊ฐ„ ๊ฒฐํ•ฉํ•œ ๊ฒฝ์šฐ๋Š” ์ƒ๊ฐ์„ ๋ชปํ–ˆ๊ณ , "Naver", "na ver"์˜ ๊ฒฝ์šฐ์— ์กฐ๊ธˆ ๋” ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ƒ๊ฐํ•˜๋‹ค๋ณด๋‹ˆ ์˜์–ด์˜ ๊ฒฝ์šฐ ๋„์–ด์“ฐ๊ธฐ๋ฅผ ํ—ˆ์šฉํ•˜์ง€ ์•Š๋Š” ๊ฑธ๋กœ ํ–ˆ์Šต๋‹ˆ๋‹ค!

์š” ๊ฒฝ์šฐ๋Š” ๊ธฐํš์ธก์—๊ฒŒ ์—ฌ์ญค๋ณด๋Š” ๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์€๋ฐ ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?! @jsoonworld @junggyo1020

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด์™€ ๊ด€๋ จํ•ด์„œ ๊ธฐํšํŒ€๊ณผ ๋‹ค์‹œ ํ•œ๋ฒˆ ์˜๋…ผํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!

}

//์ •๋ ฌ ์กฐ๊ฑด(5๊ฐ€์ง€, ์ฑ„์šฉ ๋งˆ๊ฐ ์ด๋ฅธ ์ˆœ, ์งง์€ ๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์ˆœ, ๊ธด ๊ทผ๋ฌด ๊ธฐ๊ฐ„ ์ˆœ,
Expand Down
Loading