Postgresql ts_rank_cd 설명 : 포스트그레스큐엘 함수
1. 함수의 목적
Postgresql ts_rank_cd 함수는 text_search 기능에 관련된 함수로서, 인수로 주어진 검색어와 tsvector가 커버 밀도 알고리즘(cover density algorithm)을 사용하여 얼마나 잘 매칭되는지 real 형식의 데이터로 반환한다.
2. 샘플을 통한 개념 퀵뷰
SELECT ts_rank_cd(to_tsvector('raining cats and dogs'), 'cat');
ts_rank_cd
----------------------
0.1
3. 사용방법
ts_rank_cd ( [ weights real[], ] vector tsvector, query tsquery [, normalization integer ] )
4. 함수 PARAMETER 설명
[weights real[]] - 선택적 인수
가중치를 real로 입력한다. 배열 형식으로 아래와 같이 입력가능하다.
{word-weight, word-weight, word-weight}
[vector tsvector]
tsvector를 입력한다.
[query tsquery]
검색어를 tsquery로 입력한다.
[normalization integer] : 선택적 인수
다큐먼트 길이가 rank에 주는 영향도를 조절하며 아래의 숫자 중 선택적으로 입력한다.
- 0 (the default) ignores the document length
- 1 divides the rank by 1 + the logarithm of the document length
- 2 divides the rank by the document length
- 4 divides the rank by the mean harmonic distance between extents (this is implemented only by ts_rank_cd)
- 8 divides the rank by the number of unique words in document
- 16 divides the rank by 1 + the logarithm of the number of unique words in document
- 32 divides the rank by itself + 1
5. 다양한 샘플 표현
▶▶ Posgresql 내장함수 모음 : atotw.tistory.com/category/IT/Postgresql%20DBMS