๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ–ฅ๏ธ ์ตœ์ข…ํ”„๋กœ์ ํŠธ/๐Ÿ› ๏ธ ํŠธ๋Ÿฌ๋ธ”์ŠˆํŒ…4

[ํŠธ๋Ÿฌ๋ธ”์ŠˆํŒ…] N-gram๊ณผ Edge-Ngram์„ ํ•จ๊ป˜ ์ผ๋”๋‹ˆ? ๊ฒ€์ƒ‰ ์ •ํ™•๋„ ๋ฌธ์ œ์™€ ํ•ด๊ฒฐ ๊ณผ์ • ๐Ÿ’ฅ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ? N-gram + Edge-Ngram์ด ๋งŒ๋“  ๋ฌธ์ œ  ๐Ÿ” ๋ฐœ์ƒํ•œ ๋ฌธ์ œ์ฒ˜์Œ์—๋Š” ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์„ ๊ฐ•ํ™”ํ•˜๊ธฐ ์œ„ํ•ด ๋ถ€๋ถ„ ๊ฒ€์ƒ‰(N-gram)๊ณผ ์ž๋™ ์™„์„ฑ(Edge-Ngram) ๋‘ ๊ธฐ๋Šฅ์„ ๋™์‹œ์— Elasticsearch์— ์ ์šฉํ–ˆ๋‹ค.๊ฒ€์ƒ‰์–ด๊ฐ€ ์ค‘๊ฐ„์— ํฌํ•จ๋œ ๋‹จ์–ด๋„ ์ฐพ๊ณ , ๋™์‹œ์— ์ž…๋ ฅํ•œ ๊ธ€์ž์˜ ์•ž๋ถ€๋ถ„์œผ๋กœ ์ž๋™ ์™„์„ฑ๊นŒ์ง€ ๋˜๋„๋ก ํ•œ ๊ฒƒ์ด์—ˆ๋‹ค.ํ•˜์ง€๋งŒ... ์‹ค์ œ ๊ฒ€์ƒ‰์—์„œ ์˜ˆ์ƒํ•˜์ง€ ๋ชปํ•œ ๊ฒฐ๊ณผ๊ฐ€ ๋“ฑ์žฅํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ๋‹ค. ๐Ÿ“Œ ์˜ˆ์‹œ 1) ๊ฒ€์ƒ‰์–ด: ๋ฏธ๋…ธ ๋ฏธ๋…ธ๊ฐ€ ํฌํ•จ๋œ ์ •ํ™•ํ•œ ๋‹จ์–ด๋ฅผ ์ฐพ๊ณ  ์‹ถ์—ˆ์ง€๋งŒ,N-gram๊ณผ Edge-Ngram์ด ํ•จ๊ป˜ ์ ์šฉ๋œ ํ•„๋“œ๊ฐ€ ์กฐํšŒ ๊ฒฐ๊ณผ๋ฅผ ๋งŒ๋“ค์–ด๋ƒˆ๋‹ค.๊ฒฐ๊ณผ์ ์œผ๋กœ ๊ด€๋ จ ์—†๋Š” ํ‚ค์›Œ๋“œ๊นŒ์ง€ ํฌํ•จ๋œ ๊ฒฐ๊ณผ๊ฐ€ ๋…ธ์ถœ๋˜์—ˆ๋‹ค. ๐Ÿ“Œ ์˜ˆ์‹œ 2) ๊ฒ€์ƒ‰์–ด: ์นด๋“œ์นด๋“œ๋ฅผ ๊ฒ€์ƒ‰ํ–ˆ์„ ๋•Œ, ์นด๋“œ์™€ ๋ฌด๊ด€ํ•œ ์นด๋กœ ์‹œ์ž‘ํ•˜๋Š” ๋‹จ์–ด.. 2025. 4. 3.
[ํŠธ๋Ÿฌ๋ธ”์ŠˆํŒ…] @Setting์„ ์ผ๋Š”๋ฐ ์™œ ์ธ๋ฑ์Šค๊ฐ€ ์•ˆ ๋ ๊นŒ? ๐Ÿงจ Elasticsearch ์ธ๋ฑ์Šค ์„ค์ •์ด ์•ˆ ๋œ๋‹ค?! @Setting ์‹คํŒจ ๊ธฐ๋ก  ๐Ÿ’ฅ๋ฌธ์ œ ์ƒํ™ฉSpring Boot + Spring Data Elasticsearch ํ™˜๊ฒฝ์—์„œElasticsearch์—์„œ ๊ฒ€์ƒ‰ ์„ฑ๋Šฅ ๊ฐœ์„ ์„ ์œ„ํ•ด n-gram, edge-ngram ๊ธฐ๋ฐ˜ ์ธ๋ฑ์Šค ์„ค์ •์„ ์ ์šฉํ•˜๋ ค๊ณ  ํ–ˆ๋‹ค.์•„๋ž˜์™€ ๊ฐ™์ด job-opening-settings.json์„ ์ž‘์„ฑํ•˜๊ณ ,Spring Data Elasticsearch์˜ @Setting ์–ด๋…ธํ…Œ์ด์…˜์„ ํ†ตํ•ด ์ž๋™์œผ๋กœ ์ธ๋ฑ์Šค๋ฅผ ์ƒ์„ฑํ•˜๋ ค๊ณ  ํ–ˆ๋‹ค.๋”๋ณด๊ธฐ  job-opening-settings.json { "settings": { "analysis": { "filter": { "ngram_filter": { "type": "ng.. 2025. 4. 2.
[ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ… ] Elasticsearch ์ธ๋ฑ์Šค ์‚ฝ์ž… ๋ฐ ์กฐํšŒ ์‹คํŒจ ๋ฌธ์ œ ํ•ด๊ฒฐ๊ธฐ (์ธ๋ฑ์Šค, ๋งคํ•‘, ID ์ค‘๋ณต) Elasticsearch ๋ฐ์ดํ„ฐ ์‚ฝ์ž… ๋ฐ ์กฐํšŒ ๋ฌธ์ œ ํ•ด๊ฒฐ ๊ณผ์ • Elasticsearch์— CSV ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฝ์ž…ํ•˜๊ณ  ์กฐํšŒํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ฐ์ดํ„ฐ๊ฐ€ ์กฐํšŒ๋˜์ง€ ์•Š์•„ ์›์ธ์„ ๋ถ„์„ํ•˜๊ณ  ํ•ด๊ฒฐํ–ˆ๋˜ ๊ณผ์ •์„ ์ •๋ฆฌํ•ด ๋ดค๋‹ค.๋ฐœ์ƒํ•œ ๋ฌธ์ œ์™€ ์›์ธ ๋ถ„์„1.  ์ธ๋ฑ์Šค ๋„ค์ด๋ฐ ๋ถˆ์ผ์น˜ ๋ฌธ์ œ๋ฌธ์ œ ์ƒํ™ฉElasticsearch์—์„œ ์ธ๋ฑ์Šค๋ฅผ ์ƒ์„ฑํ•  ๋•Œ๋Š” "job-opening"์œผ๋กœ ์„ค์ •ํ–ˆ์ง€๋งŒ, ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•  ๋•Œ๋Š” "job_opening"์œผ๋กœ ์กฐํšŒํ•˜๋Š” ์‹ค์ˆ˜๋ฅผ ๋ฒ”ํ–ˆ๋‹ค.Kibana์—์„œ ์กฐํšŒ ์‹œ ๋ฐ์ดํ„ฐ๊ฐ€ ๋‚˜ํƒ€๋‚˜์ง€ ์•Š์•˜๋‹ค.ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ์ธ๋ฑ์Šค๋ช…์„ ์ƒ์ˆ˜(static final)๋กœ ์ •์˜ํ•˜์—ฌ, ์ƒ์„ฑ๊ณผ ์กฐํšŒ ์‹œ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ–ˆ๋‹ค.public static final String INDEX_NAME = "job-opening"; 2. ๋™์  ๋งคํ•‘(@Postconstr.. 2025. 2. 25.
[ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ… ] Elasticsearch keyword ํ•„๋“œ์˜ ์ค‘์š”์„ฑ (term ์ฟผ๋ฆฌ๊ฐ€ ์•ˆ๋  ๋•Œ) Elasticsearch์—์„œ term ์ฟผ๋ฆฌ๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ ํ•ด๊ฒฐ ๋ฌธ์ œ ์ƒํ™ฉ์ฑ„์šฉ ๊ณต๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒํ•˜๋Š” ๊ธฐ๋Šฅ์„ Spring API์™€ Elasticsearch๋ฅผ ์—ฐ๋™ํ•˜์—ฌ ๊ตฌํ˜„ํ•˜๋˜ ์ค‘, ์ž๊ฒฉ ์š”๊ฑด(requiredSkills)์„ term ์ฟผ๋ฆฌ๋ฅผ ํ†ตํ•ด ํ•„ํ„ฐ๋งํ–ˆ๋”๋‹ˆ ๋ฐ์ดํ„ฐ๊ฐ€ ์ „ํ˜€ ์กฐํšŒ๋˜์ง€ ์•Š๋Š” ํ˜„์ƒ์ด ๋ฐœ์ƒํ–ˆ๋‹ค.๊ธฐ์กด ์ฟผ๋ฆฌ// ์ž๊ฒฉ ์š”๊ฑด ํ•„ํ„ฐ๋งif (requestDto.getRequiredSkill() != null) { boolQueryBuilder.filter(f -> f .term(t -> t .field("requiredSkills") .value(requestDto.getRequiredSkill()) ) );}์›์ธ ๋ถ„์„๋จผ์ € Ela.. 2025. 2. 25.