๋กœ์ผ“๐Ÿพ
article thumbnail
๋ฐ˜์‘ํ˜•

ํ‚ค๋ฐ”๋‚˜์—์„œ ์•„๋ž˜ ์ฝ”๋“œ๋กœ ์š”์ฒญ์„ ๋ณด๋‚ด๋ฉด

์•„๋ž˜์™€ ๊ฐ™์€ ์‘๋‹ต์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

analyzer๋Š” ์ปค์Šคํ…€ analyzer ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. tokenizer๋Š” nori๋ฅผ ์‚ฌ์šฉํ•˜์˜€๊ณ , filter๋Š” shingle๋ฅผ ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

 

์ด ๊ฐ’์„ ์ž๋ฐ”์—์„œ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

AnalyzeRequest request = AnalyzeRequest.withIndexAnalyzer("st_pdt", "nori_discard_1", pdt.getS_name()); 
AnalyzeResponse response = client.indices().analyze(request, RequestOptions.DEFAULT);

List<AnalyzeResponse.AnalyzeToken> tokens = response.getTokens();

for(AnalyzeResponse.AnalyzeToken token : tokens) {
	if(token.getType().equals("shingle")) {
		String term = token.getTerm();
	}
}

withIndexAnalyzer์˜ ์ฒซ๋ฒˆ์งธ ์ธ์ž๋Š” "index ์ด๋ฆ„", ๋‘๋ฒˆ์งธ ์ธ์ž๋Š” "analyzer ์ด๋ฆ„", ์„ธ๋ฒˆ์งธ ์ธ์ž๋Š” "analyzer ํ•  ํ…์ŠคํŠธ"์ž…๋‹ˆ๋‹ค.

 

response ๋ฐ›์€ token๋“ค์€ tokens์— ๋‹ด๊น๋‹ˆ๋‹ค. ์ดํ›„ token์€ ์ผ๋ฐ˜ ์ž๋ฐ” ๊ฐ์ฒด์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

* ์ฐธ๊ณ  : ์•„๋ž˜ ๋งํฌ๋Š” ๊ณต์‹ ์ผ๋ผ์Šคํ‹ฑ ์„œ์น˜ ๋ฌธ์„œ์ž…๋‹ˆ๋‹ค. ๋” ๋งŽ์€ ์ •๋ณด๋ฅผ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

Analyze API | Java REST Client [7.14] | Elastic

Asynchronous executionedit Executing a AnalyzeRequest can also be done in an asynchronous fashion so that the client can return directly. Users need to specify how the response or potential failures will be handled by passing the request and a listener to

www.elastic.co

 

๋ฐ˜์‘ํ˜•
profile on loading

Loading...