Postgresql ts_headline 설명 : 포스트그레스큐엘 함수
1. 함수의 목적
Postgresql ts_headline 함수는 text_search 기능에 관련된 함수로서, text로 입력된 문자열에서 tsvector가 입력된 인수와 일치하는 항목을 찾아 abbreviated form으로 표시한 문자열을 text로 반환한다.
2. 샘플을 통한 개념 퀵뷰
SELECT ts_headline('The fat cat ate the rat.', 'cat') ;
ts_headline
----------------------
The fat <b>cat</b> ate the rat.
3. 사용방법
ts_headline ( [ config regconfig, ] document text, query tsquery [, options text ] )
ts_headline ( [ config regconfig, ] document json, query tsquery [, options text ] )
ts_headline ( [ config regconfig, ] document jsonb, query tsquery [, options text ] )
4. 함수 PARAMETER 설명
[config regconfig] - 선택인수
사용할 설정을 입력한다. 생략시 기본 설정이 사용된다.
[document text]
정규화할 text를 입력한다.
[document json]
정규화할 json을 입력한다.
[document jsonb]
정규화할 jsonb를 입력한다.
[query tsquery]
찾을 조건을 tsquery로 입력한다.
5. 다양한 샘플 표현
1) jsonb 형식을 스트링을 입력과 english 설정 사용
SELECT ts_headline('english','{"cat":"raining cats and dogs"}'::jsonb, 'cat') ;
▶▶ Posgresql 내장함수 모음 : atotw.tistory.com/category/IT/Postgresql%20DBMS