当前位置:
Postgres 的全文搜索已经足够好了
时间:2025-11-05 02:51:13 出处:域名阅读(143)

复制CREATETABLE author( id SERIAL PRIMARYKEY,文搜 name TEXT NOTNULL); CREATETABLE post( id SERIAL PRIMARYKEY, title TEXT NOTNULL, content TEXT NOTNULL, author_id INTNOTNULLreferences author(id) ); CREATETABLE tag( id SERIAL PRIMARYKEY, name TEXT NOTNULL ); CREATETABLE posts_tags( post_id INTNOTNULLreferences post(id), tag_id INTNOTNULLreferences tag(id) ); INSERTINTO author (id, name) VALUES (1, Pete Graham), (2, Rachid Belaid), (3, Robert Berry); INSERTINTO tag (id, name) VALUES (1, scifi), (2, politics), (3, science); INSERTINTO post (id, title, content, author_id) VALUES (1, Endangered species, Pandas are an endangered species, 1 ), (2, Freedom of Speech, Freedom of speech is a necessary right missing in many countries, 2), (3, Star Wars vs Star Trek, Few words from a big fan, 3); INSERTINTO posts_tags (post_id, tag_id) VALUES (1, 3), (2, 2), (3, 1); 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.
分享到:
温馨提示:以上内容和图片整理于网络,仅供参考,希望对您有帮助!如有侵权行为请联系删除!