- Mastering PostgreSQL 12
- Hans Jürgen Sch?nig
- 254字
- 2021-08-20 10:00:33
Debugging your search
Sometimes, it is not quite clear why a query matches a given search string. To debug your query, PostgreSQL offers the ts_debug function. From a user's point of view, it can be used just like to_tsvector. It reveals a lot about the inner workings of the full-text search infrastructure:
test=# \x Expanded display is on.
test=# SELECT * FROM ts_debug('english', 'go to www.postgresql-support.de');
-[ RECORD 1 ]+----------------------------
alias | asciiword description | Word, all ASCII token | go dictionaries | {english_stem}
dictionary | english_stem
lexemes | {go} -[ RECORD 2 ]+----------------------------
alias | blank description | Space symbols
token | dictionaries | {}
dictionary |
lexemes | -[ RECORD 3 ]+----------------------------
alias | asciiword description | Word, all ASCII token | to dictionaries | {english_stem}
dictionary | english_stem
lexemes | {} -[ RECORD 4 ]+----------------------------
alias | blank description | Space symbols
token | dictionaries | {}
dictionary |
lexemes | -[ RECORD 5 ]+---------------------------- alias | host
description | Host token | www.postgresql-support.de
dictionaries | {simple} dictionary | simple lexemes | {www.postgresql-support.de}
ts_debug will list every token found and display information about the token. You will see which token the parser found, the dictionary used, and the type of object. In my example, blanks, words, and hosts have been found. You might also see numbers, email addresses, and a lot more. Depending on the type of string, PostgreSQL will handle things differently. For example, it makes absolutely no sense to stem hostnames and email addresses.
推薦閱讀
- 工業機器人虛擬仿真實例教程:KUKA.Sim Pro(全彩版)
- Big Data Analytics with Hadoop 3
- 數據展現的藝術
- Hands-On Graph Analytics with Neo4j
- Learning Microsoft Azure Storage
- Visual FoxPro 6.0數據庫與程序設計
- 數據運營之路:掘金數據化時代
- 自動生產線的拆裝與調試
- 啊哈C!思考快你一步
- 基于ARM9的小型機器人制作
- 基于RPA技術財務機器人的應用與研究
- 電腦上網入門
- Mastering Predictive Analytics with scikit:learn and TensorFlow
- 漢字錄入技能訓練
- 分布式Java應用