ZhangZhihui's Blog  

Full text search

 

Searching with LIKE:

LIKE is case-sensitive.

 

 

iLIKE is case-insensitive.

 

TSVECTOR, TSQUERY, ts_rank():

 

 

 

 

 

 

 

 

 

 

 

 

Websearch:

 

 

select plainto_tsquery('star wars') plain,
       phraseto_tsquery('star wars') phrase,
       websearch_to_tsquery('star wars') web1,
       websearch_to_tsquery('star wars or trek') web2,
       websearch_to_tsquery('star wars or star trek') web3,
       websearch_to_tsquery('"star wars"') web4,
       websearch_to_tsquery('"star wars" clone') web5,
       websearch_to_tsquery('"star wars" -clone') web6;
-[ RECORD 1 ]----------------------------
plain : 'star' & 'war'
phrase: 'star' <-> 'war'
web1  : 'star' & 'war'
web2  : 'star' & 'war' | 'trek'
web3  : 'star' & 'war' | 'star' & 'trek'
web4  : 'star' <-> 'war'
web5  : 'star' <-> 'war' & 'clone'
web6  : 'star' <-> 'war' & !'clone'

 

Ranking:

show default_text_search_config;
 default_text_search_config 
----------------------------
 pg_catalog.english

 

 

 

 

 

 

Indexing full text search:

     ERROR: generation expression is not immutable

 

 

 

 

Highlighting:

 

 

posted on 2024-12-10 08:52  ZhangZhihuiAAA  阅读(1)  评论(0编辑  收藏  举报