1 -- directory paths are passed to us in environment variables
2 \getenv abs_srcdir PG_ABS_SRCDIR
4 -- Sanity checks for text search catalogs
6 -- NB: we assume the oidjoins test will have caught any dangling links,
7 -- that is OID or REGPROC fields that are not zero and do not match some
8 -- row in the linked-to table. However, if we want to enforce that a link
9 -- field can't be 0, we have to check it here.
10 -- Find unexpected zero link entries
13 WHERE prsnamespace = 0 OR prsstart = 0 OR prstoken = 0 OR prsend = 0 OR
14 -- prsheadline is optional
22 WHERE dictnamespace = 0 OR dictowner = 0 OR dicttemplate = 0;
29 WHERE tmplnamespace = 0 OR tmpllexize = 0; -- tmplinit is optional
36 WHERE cfgnamespace = 0 OR cfgowner = 0 OR cfgparser = 0;
41 SELECT mapcfg, maptokentype, mapseqno
43 WHERE mapcfg = 0 OR mapdict = 0;
44 mapcfg | maptokentype | mapseqno
45 --------+--------------+----------
48 -- Look for pg_ts_config_map entries that aren't one of parser's token types
50 ( SELECT oid AS cfgid, (ts_token_type(cfgparser)).tokid AS tokid
51 FROM pg_ts_config ) AS tt
52 RIGHT JOIN pg_ts_config_map AS m
53 ON (tt.cfgid=m.mapcfg AND tt.tokid=m.maptokentype)
55 tt.cfgid IS NULL OR tt.tokid IS NULL;
56 cfgid | tokid | mapcfg | maptokentype | mapseqno | mapdict
57 -------+-------+--------+--------------+----------+---------
60 -- Load some test data
61 CREATE TABLE test_tsvector(
65 \set filename :abs_srcdir '/data/tsearch.data'
66 COPY test_tsvector FROM :'filename';
67 ANALYZE test_tsvector;
68 -- test basic text search behavior without indexes, then with
69 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
75 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
81 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
87 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
93 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
99 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
105 SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
111 SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
117 SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
123 SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
129 SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh';
135 SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl';
141 SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt';
147 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh';
153 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh';
159 SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl';
165 SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt';
171 SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)';
177 SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)';
183 SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)';
189 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A';
195 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D';
201 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A';
207 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D';
213 create index wowidx on test_tsvector using gist (a);
214 SET enable_seqscan=OFF;
215 SET enable_indexscan=ON;
216 SET enable_bitmapscan=OFF;
217 explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
219 -------------------------------------------------------
221 -> Index Scan using wowidx on test_tsvector
222 Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
225 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
231 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
237 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
243 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
249 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
255 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
261 SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
267 SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
273 SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
279 SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
285 SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh';
291 SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl';
297 SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt';
303 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh';
309 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh';
315 SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl';
321 SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt';
327 SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)';
333 SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)';
339 SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)';
345 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A';
351 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D';
357 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A';
363 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D';
369 SET enable_indexscan=OFF;
370 SET enable_bitmapscan=ON;
371 explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
373 -------------------------------------------------------------
375 -> Bitmap Heap Scan on test_tsvector
376 Recheck Cond: (a @@ '''wr'' | ''qh'''::tsquery)
377 -> Bitmap Index Scan on wowidx
378 Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
381 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
387 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
393 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
399 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
405 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
411 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
417 SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
423 SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
429 SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
435 SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
441 SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh';
447 SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl';
453 SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt';
459 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh';
465 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh';
471 SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl';
477 SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt';
483 SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)';
489 SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)';
495 SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)';
501 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A';
507 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D';
513 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A';
519 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D';
525 -- Test siglen parameter of GiST tsvector_ops
526 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(foo=1));
527 ERROR: unrecognized parameter "foo"
528 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=0));
529 ERROR: value 0 out of bounds for option "siglen"
530 DETAIL: Valid values are between "1" and "2024".
531 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=2048));
532 ERROR: value 2048 out of bounds for option "siglen"
533 DETAIL: Valid values are between "1" and "2024".
534 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=100,foo='bar'));
535 ERROR: unrecognized parameter "foo"
536 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=100, siglen = 200));
537 ERROR: parameter "siglen" specified more than once
538 CREATE INDEX wowidx2 ON test_tsvector USING gist (a tsvector_ops(siglen=1));
540 Table "public.test_tsvector"
541 Column | Type | Collation | Nullable | Default
542 --------+----------+-----------+----------+---------
547 "wowidx2" gist (a tsvector_ops (siglen='1'))
550 EXPLAIN (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
552 -------------------------------------------------------------
554 -> Bitmap Heap Scan on test_tsvector
555 Recheck Cond: (a @@ '''wr'' | ''qh'''::tsquery)
556 -> Bitmap Index Scan on wowidx2
557 Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
560 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
566 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
572 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
578 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
584 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
590 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
596 SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
602 SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
608 SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
614 SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
620 SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh';
626 SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl';
632 SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt';
638 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh';
644 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh';
650 SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl';
656 SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt';
662 SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)';
668 SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)';
674 SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)';
680 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A';
686 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D';
692 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A';
698 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D';
705 CREATE INDEX wowidx ON test_tsvector USING gist (a tsvector_ops(siglen=484));
707 Table "public.test_tsvector"
708 Column | Type | Collation | Nullable | Default
709 --------+----------+-----------+----------+---------
713 "wowidx" gist (a tsvector_ops (siglen='484'))
715 EXPLAIN (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
717 -------------------------------------------------------------
719 -> Bitmap Heap Scan on test_tsvector
720 Recheck Cond: (a @@ '''wr'' | ''qh'''::tsquery)
721 -> Bitmap Index Scan on wowidx
722 Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
725 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
731 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
737 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
743 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
749 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
755 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
761 SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
767 SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
773 SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
779 SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
785 SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh';
791 SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl';
797 SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt';
803 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh';
809 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh';
815 SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl';
821 SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt';
827 SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)';
833 SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)';
839 SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)';
845 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A';
851 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D';
857 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A';
863 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D';
869 RESET enable_seqscan;
870 RESET enable_indexscan;
871 RESET enable_bitmapscan;
873 CREATE INDEX wowidx ON test_tsvector USING gin (a);
874 SET enable_seqscan=OFF;
875 -- GIN only supports bitmapscan, so no need to test plain indexscan
876 explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
878 -------------------------------------------------------------
880 -> Bitmap Heap Scan on test_tsvector
881 Recheck Cond: (a @@ '''wr'' | ''qh'''::tsquery)
882 -> Bitmap Index Scan on wowidx
883 Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
886 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
892 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
898 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
904 SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
910 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
916 SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
922 SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
928 SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
934 SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
940 SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
946 SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh';
952 SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl';
958 SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt';
964 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh';
970 SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh';
976 SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl';
982 SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt';
988 SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)';
994 SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)';
1000 SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)';
1006 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A';
1012 SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D';
1018 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A';
1024 SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D';
1030 -- Test optimization of non-empty GIN_SEARCH_MODE_ALL queries
1032 SELECT count(*) FROM test_tsvector WHERE a @@ '!qh';
1034 -----------------------------------------------------
1036 -> Bitmap Heap Scan on test_tsvector
1037 Recheck Cond: (a @@ '!''qh'''::tsquery)
1038 -> Bitmap Index Scan on wowidx
1039 Index Cond: (a @@ '!''qh'''::tsquery)
1042 SELECT count(*) FROM test_tsvector WHERE a @@ '!qh';
1049 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr' AND a @@ '!qh';
1051 ------------------------------------------------------------------------------------
1053 -> Bitmap Heap Scan on test_tsvector
1054 Recheck Cond: ((a @@ '''wr'''::tsquery) AND (a @@ '!''qh'''::tsquery))
1055 -> Bitmap Index Scan on wowidx
1056 Index Cond: ((a @@ '''wr'''::tsquery) AND (a @@ '!''qh'''::tsquery))
1059 SELECT count(*) FROM test_tsvector WHERE a @@ 'wr' AND a @@ '!qh';
1065 RESET enable_seqscan;
1066 INSERT INTO test_tsvector VALUES ('???', 'DFG:1A,2B,6C,10 FGH');
1067 SELECT * FROM ts_stat('SELECT a FROM test_tsvector') ORDER BY ndoc DESC, nentry DESC, word LIMIT 10;
1068 word | ndoc | nentry
1069 ------+------+--------
1082 SELECT * FROM ts_stat('SELECT a FROM test_tsvector', 'AB') ORDER BY ndoc DESC, nentry DESC, word;
1083 word | ndoc | nentry
1084 ------+------+--------
1088 --dictionaries and to_tsvector
1089 SELECT ts_lexize('english_stem', 'skies');
1095 SELECT ts_lexize('english_stem', 'identity');
1101 SELECT * FROM ts_token_type('default');
1102 tokid | alias | description
1103 -------+-----------------+------------------------------------------
1104 1 | asciiword | Word, all ASCII
1105 2 | word | Word, all letters
1106 3 | numword | Word, letters and digits
1107 4 | email | Email address
1110 7 | sfloat | Scientific notation
1111 8 | version | Version number
1112 9 | hword_numpart | Hyphenated word part, letters and digits
1113 10 | hword_part | Hyphenated word part, all letters
1114 11 | hword_asciipart | Hyphenated word part, all ASCII
1115 12 | blank | Space symbols
1117 14 | protocol | Protocol head
1118 15 | numhword | Hyphenated word, letters and digits
1119 16 | asciihword | Hyphenated word, all ASCII
1120 17 | hword | Hyphenated word, all letters
1121 18 | url_path | URL path
1122 19 | file | File or path name
1123 20 | float | Decimal notation
1124 21 | int | Signed integer
1125 22 | uint | Unsigned integer
1126 23 | entity | XML entity
1129 SELECT * FROM ts_parse('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net teodor@123-stack.net 123_teodor@stack.net 123-teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
1130 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
1131 <i <b> wow < jqw <> qwerty');
1133 -------+--------------------------------------
1144 5 | aew.werc.ewr/?ad=qwe&dw
1148 5 | 1aew.werc.ewr/?ad=qwe&dw
1155 5 | 3aew.werc.ewr/?ad=qwe&dw
1163 5 | 5aew.werc.ewr:8100/?
1164 6 | 5aew.werc.ewr:8100
1173 5 | 6aew.werc.ewr:8100/?ad=qwe&dw
1174 6 | 6aew.werc.ewr:8100
1177 5 | 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32
1178 6 | 7aew.werc.ewr:8100
1179 18 | /?ad=qwe&dw=%20%32
1195 4 | teodor@stack.net
1197 4 | teodor@123-stack.net
1199 4 | 123_teodor@stack.net
1201 4 | 123-teodor@stack.net
1227 13 | <a href="qwe<qwe>">
1232 19 | /awdf/dwqe/4325
1277 SELECT to_tsvector('english', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net teodor@123-stack.net 123_teodor@stack.net 123-teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
1278 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
1279 <i <b> wow < jqw <> qwerty');
1281 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1282 '+4.0e-10':28 '-4.2':63,65 '/?':18 '/?ad=qwe&dw':7,10,14,24 '/?ad=qwe&dw=%20%32':27 '/awdf/dwqe/4325':51 '/usr/local/fff':50 '/wqe-324/ewr':54 '123-teodor@stack.net':38 '123_teodor@stack.net':37 '1aew.werc.ewr':9 '1aew.werc.ewr/?ad=qwe&dw':8 '234':66 '234.435':32 '2aew.werc.ewr':11 '345':1 '3aew.werc.ewr':13 '3aew.werc.ewr/?ad=qwe&dw':12 '4.2':59,60,61 '455':33 '4aew.werc.ewr':15 '5.005':34 '5aew.werc.ewr:8100':17 '5aew.werc.ewr:8100/?':16 '6aew.werc.ewr:8100':23 '6aew.werc.ewr:8100/?ad=qwe&dw':22 '7aew.werc.ewr:8100':26 '7aew.werc.ewr:8100/?ad=qwe&dw=%20%32':25 'ad':19 'aew.werc.ewr':6 'aew.werc.ewr/?ad=qwe&dw':5 'asdf':42 'dw':21 'efd.r':3 'ewr1':48 'ewri2':49 'gist.c':57 'gist.h':55 'gist.h.c':56 'hjwer':47 'jf':44 'jqw':69 'qwe':2,20,29,30,40 'qwe-wer':39 'qwer':43 'qwerti':70 'qwqwe':31 'readlin':58,62,64 'rewt/ewr':52 'sdjk':45 'teodor@123-stack.net':36 'teodor@stack.net':35 'wefjn':53 'wer':41 'wow':68 'www.com':4
1285 SELECT length(to_tsvector('english', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net teodor@123-stack.net 123_teodor@stack.net 123-teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
1286 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
1287 <i <b> wow < jqw <> qwerty'));
1294 SELECT * from ts_debug('english', '<myns:foo-bar_baz.blurfl>abc&nm1;def©ghiõjkl</myns:foo-bar_baz.blurfl>');
1295 alias | description | token | dictionaries | dictionary | lexemes
1296 -----------+-----------------+----------------------------+----------------+--------------+---------
1297 tag | XML tag | <myns:foo-bar_baz.blurfl> | {} | |
1298 asciiword | Word, all ASCII | abc | {english_stem} | english_stem | {abc}
1299 entity | XML entity | &nm1; | {} | |
1300 asciiword | Word, all ASCII | def | {english_stem} | english_stem | {def}
1301 entity | XML entity | © | {} | |
1302 asciiword | Word, all ASCII | ghi | {english_stem} | english_stem | {ghi}
1303 entity | XML entity | õ | {} | |
1304 asciiword | Word, all ASCII | jkl | {english_stem} | english_stem | {jkl}
1305 tag | XML tag | </myns:foo-bar_baz.blurfl> | {} | |
1308 -- check parsing of URLs
1309 SELECT * from ts_debug('english', 'http://www.harewoodsolutions.co.uk/press.aspx</span>');
1310 alias | description | token | dictionaries | dictionary | lexemes
1311 ----------+---------------+----------------------------------------+--------------+------------+------------------------------------------
1312 protocol | Protocol head | http:// | {} | |
1313 url | URL | www.harewoodsolutions.co.uk/press.aspx | {simple} | simple | {www.harewoodsolutions.co.uk/press.aspx}
1314 host | Host | www.harewoodsolutions.co.uk | {simple} | simple | {www.harewoodsolutions.co.uk}
1315 url_path | URL path | /press.aspx | {simple} | simple | {/press.aspx}
1316 tag | XML tag | </span> | {} | |
1319 SELECT * from ts_debug('english', 'http://aew.wer0c.ewr/id?ad=qwe&dw<span>');
1320 alias | description | token | dictionaries | dictionary | lexemes
1321 ----------+---------------+----------------------------+--------------+------------+------------------------------
1322 protocol | Protocol head | http:// | {} | |
1323 url | URL | aew.wer0c.ewr/id?ad=qwe&dw | {simple} | simple | {aew.wer0c.ewr/id?ad=qwe&dw}
1324 host | Host | aew.wer0c.ewr | {simple} | simple | {aew.wer0c.ewr}
1325 url_path | URL path | /id?ad=qwe&dw | {simple} | simple | {/id?ad=qwe&dw}
1326 tag | XML tag | <span> | {} | |
1329 SELECT * from ts_debug('english', 'http://5aew.werc.ewr:8100/?');
1330 alias | description | token | dictionaries | dictionary | lexemes
1331 ----------+---------------+----------------------+--------------+------------+------------------------
1332 protocol | Protocol head | http:// | {} | |
1333 url | URL | 5aew.werc.ewr:8100/? | {simple} | simple | {5aew.werc.ewr:8100/?}
1334 host | Host | 5aew.werc.ewr:8100 | {simple} | simple | {5aew.werc.ewr:8100}
1335 url_path | URL path | /? | {simple} | simple | {/?}
1338 SELECT * from ts_debug('english', '5aew.werc.ewr:8100/?xx');
1339 alias | description | token | dictionaries | dictionary | lexemes
1340 ----------+-------------+------------------------+--------------+------------+--------------------------
1341 url | URL | 5aew.werc.ewr:8100/?xx | {simple} | simple | {5aew.werc.ewr:8100/?xx}
1342 host | Host | 5aew.werc.ewr:8100 | {simple} | simple | {5aew.werc.ewr:8100}
1343 url_path | URL path | /?xx | {simple} | simple | {/?xx}
1346 SELECT token, alias,
1347 dictionaries, dictionaries is null as dnull, array_dims(dictionaries) as ddims,
1348 lexemes, lexemes is null as lnull, array_dims(lexemes) as ldims
1349 from ts_debug('english', 'a title');
1350 token | alias | dictionaries | dnull | ddims | lexemes | lnull | ldims
1351 -------+-----------+----------------+-------+-------+---------+-------+-------
1352 a | asciiword | {english_stem} | f | [1:1] | {} | f |
1353 | blank | {} | f | | | t |
1354 title | asciiword | {english_stem} | f | [1:1] | {titl} | f | [1:1]
1358 SELECT to_tsquery('english', 'qwe & sKies ');
1364 SELECT to_tsquery('simple', 'qwe & sKies ');
1370 SELECT to_tsquery('english', '''the wether'':dc & '' sKies '':BC ');
1372 ------------------------
1373 'wether':CD & 'sky':BC
1376 SELECT to_tsquery('english', 'asd&(and|fghj)');
1382 SELECT to_tsquery('english', '(asd&and)|fghj');
1388 SELECT to_tsquery('english', '(asd&!and)|fghj');
1394 SELECT to_tsquery('english', '(the|and&(i&1))&fghj');
1400 SELECT plainto_tsquery('english', 'the and z 1))& fghj');
1402 --------------------
1406 SELECT plainto_tsquery('english', 'foo bar') && plainto_tsquery('english', 'asd');
1408 -----------------------
1409 'foo' & 'bar' & 'asd'
1412 SELECT plainto_tsquery('english', 'foo bar') || plainto_tsquery('english', 'asd fg');
1414 ------------------------------
1415 'foo' & 'bar' | 'asd' & 'fg'
1418 SELECT plainto_tsquery('english', 'foo bar') || !!plainto_tsquery('english', 'asd fg');
1420 -----------------------------------
1421 'foo' & 'bar' | !( 'asd' & 'fg' )
1424 SELECT plainto_tsquery('english', 'foo bar') && 'asd | fg';
1426 ----------------------------------
1427 'foo' & 'bar' & ( 'asd' | 'fg' )
1430 -- Check stop word deletion, a and s are stop-words
1431 SELECT to_tsquery('english', '!(a & !b) & c');
1437 SELECT to_tsquery('english', '!(a & !b)');
1443 SELECT to_tsquery('english', '(1 <-> 2) <-> a');
1449 SELECT to_tsquery('english', '(1 <-> a) <-> 2');
1455 SELECT to_tsquery('english', '(a <-> 1) <-> 2');
1461 SELECT to_tsquery('english', 'a <-> (1 <-> 2)');
1467 SELECT to_tsquery('english', '1 <-> (a <-> 2)');
1473 SELECT to_tsquery('english', '1 <-> (2 <-> a)');
1479 SELECT to_tsquery('english', '(1 <-> 2) <3> a');
1485 SELECT to_tsquery('english', '(1 <-> a) <3> 2');
1491 SELECT to_tsquery('english', '(a <-> 1) <3> 2');
1497 SELECT to_tsquery('english', 'a <3> (1 <-> 2)');
1503 SELECT to_tsquery('english', '1 <3> (a <-> 2)');
1509 SELECT to_tsquery('english', '1 <3> (2 <-> a)');
1515 SELECT to_tsquery('english', '(1 <3> 2) <-> a');
1521 SELECT to_tsquery('english', '(1 <3> a) <-> 2');
1527 SELECT to_tsquery('english', '(a <3> 1) <-> 2');
1533 SELECT to_tsquery('english', 'a <-> (1 <3> 2)');
1539 SELECT to_tsquery('english', '1 <-> (a <3> 2)');
1545 SELECT to_tsquery('english', '1 <-> (2 <3> a)');
1551 SELECT to_tsquery('english', '((a <-> 1) <-> 2) <-> s');
1557 SELECT to_tsquery('english', '(2 <-> (a <-> 1)) <-> s');
1563 SELECT to_tsquery('english', '((1 <-> a) <-> 2) <-> s');
1569 SELECT to_tsquery('english', '(2 <-> (1 <-> a)) <-> s');
1575 SELECT to_tsquery('english', 's <-> ((a <-> 1) <-> 2)');
1581 SELECT to_tsquery('english', 's <-> (2 <-> (a <-> 1))');
1587 SELECT to_tsquery('english', 's <-> ((1 <-> a) <-> 2)');
1593 SELECT to_tsquery('english', 's <-> (2 <-> (1 <-> a))');
1599 SELECT to_tsquery('english', '((a <-> 1) <-> s) <-> 2');
1605 SELECT to_tsquery('english', '(s <-> (a <-> 1)) <-> 2');
1611 SELECT to_tsquery('english', '((1 <-> a) <-> s) <-> 2');
1617 SELECT to_tsquery('english', '(s <-> (1 <-> a)) <-> 2');
1623 SELECT to_tsquery('english', '2 <-> ((a <-> 1) <-> s)');
1629 SELECT to_tsquery('english', '2 <-> (s <-> (a <-> 1))');
1635 SELECT to_tsquery('english', '2 <-> ((1 <-> a) <-> s)');
1641 SELECT to_tsquery('english', '2 <-> (s <-> (1 <-> a))');
1647 SELECT to_tsquery('english', 'foo <-> (a <-> (the <-> bar))');
1653 SELECT to_tsquery('english', '((foo <-> a) <-> the) <-> bar');
1659 SELECT to_tsquery('english', 'foo <-> a <-> the <-> bar');
1665 SELECT phraseto_tsquery('english', 'PostgreSQL can be extended by the user in many ways');
1667 -----------------------------------------------------------
1668 'postgresql' <3> 'extend' <3> 'user' <2> 'mani' <-> 'way'
1671 SELECT ts_rank_cd(to_tsvector('english', '
1672 Day after day, day after day,
1673 We stuck, nor breath nor motion,
1674 As idle as a painted Ship
1675 Upon a painted Ocean.
1676 Water, water, every where
1677 And all the boards did shrink;
1678 Water, water, every where,
1679 Nor any drop to drink.
1680 S. T. Coleridge (1772-1834)
1681 '), to_tsquery('english', 'paint&water'));
1687 SELECT ts_rank_cd(to_tsvector('english', '
1688 Day after day, day after day,
1689 We stuck, nor breath nor motion,
1690 As idle as a painted Ship
1691 Upon a painted Ocean.
1692 Water, water, every where
1693 And all the boards did shrink;
1694 Water, water, every where,
1695 Nor any drop to drink.
1696 S. T. Coleridge (1772-1834)
1697 '), to_tsquery('english', 'breath&motion&water'));
1703 SELECT ts_rank_cd(to_tsvector('english', '
1704 Day after day, day after day,
1705 We stuck, nor breath nor motion,
1706 As idle as a painted Ship
1707 Upon a painted Ocean.
1708 Water, water, every where
1709 And all the boards did shrink;
1710 Water, water, every where,
1711 Nor any drop to drink.
1712 S. T. Coleridge (1772-1834)
1713 '), to_tsquery('english', 'ocean'));
1719 SELECT ts_rank_cd(to_tsvector('english', '
1720 Day after day, day after day,
1721 We stuck, nor breath nor motion,
1722 As idle as a painted Ship
1723 Upon a painted Ocean.
1724 Water, water, every where
1725 And all the boards did shrink;
1726 Water, water, every where,
1727 Nor any drop to drink.
1728 S. T. Coleridge (1772-1834)
1729 '), to_tsquery('english', 'painted <-> Ship'));
1735 SELECT ts_rank_cd(strip(to_tsvector('both stripped')),
1736 to_tsquery('both & stripped'));
1742 SELECT ts_rank_cd(to_tsvector('unstripped') || strip(to_tsvector('stripped')),
1743 to_tsquery('unstripped & stripped'));
1750 SELECT ts_headline('english', '
1751 Day after day, day after day,
1752 We stuck, nor breath nor motion,
1753 As idle as a painted Ship
1754 Upon a painted Ocean.
1755 Water, water, every where
1756 And all the boards did shrink;
1757 Water, water, every where,
1758 Nor any drop to drink.
1759 S. T. Coleridge (1772-1834)
1760 ', to_tsquery('english', 'paint&water'));
1762 -----------------------------------------
1763 <b>painted</b> Ocean. +
1764 <b>Water</b>, <b>water</b>, every where+
1765 And all the boards did shrink; +
1766 <b>Water</b>, <b>water</b>, every
1769 SELECT ts_headline('english', '
1770 Day after day, day after day,
1771 We stuck, nor breath nor motion,
1772 As idle as a painted Ship
1773 Upon a painted Ocean.
1774 Water, water, every where
1775 And all the boards did shrink;
1776 Water, water, every where,
1777 Nor any drop to drink.
1778 S. T. Coleridge (1772-1834)
1779 ', to_tsquery('english', 'breath&motion&water'));
1781 ----------------------------------
1782 <b>breath</b> nor <b>motion</b>,+
1783 As idle as a painted Ship +
1784 Upon a painted Ocean. +
1785 <b>Water</b>, <b>water</b>
1788 SELECT ts_headline('english', '
1789 Day after day, day after day,
1790 We stuck, nor breath nor motion,
1791 As idle as a painted Ship
1792 Upon a painted Ocean.
1793 Water, water, every where
1794 And all the boards did shrink;
1795 Water, water, every where,
1796 Nor any drop to drink.
1797 S. T. Coleridge (1772-1834)
1798 ', to_tsquery('english', 'ocean'));
1800 ----------------------------------
1802 Water, water, every where +
1803 And all the boards did shrink;+
1804 Water, water, every where
1807 SELECT ts_headline('english', '
1808 Day after day, day after day,
1809 We stuck, nor breath nor motion,
1810 As idle as a painted Ship
1811 Upon a painted Ocean.
1812 Water, water, every where
1813 And all the boards did shrink;
1814 Water, water, every where,
1815 Nor any drop to drink.
1816 S. T. Coleridge (1772-1834)
1817 ', to_tsquery('english', 'day & drink'));
1819 ------------------------------------
1821 We stuck, nor breath nor motion,+
1822 As idle as a painted Ship +
1823 Upon a painted Ocean. +
1824 Water, water, every where +
1825 And all the boards did shrink; +
1826 Water, water, every where, +
1830 SELECT ts_headline('english', '
1831 Day after day, day after day,
1832 We stuck, nor breath nor motion,
1833 As idle as a painted Ship
1834 Upon a painted Ocean.
1835 Water, water, every where
1836 And all the boards did shrink;
1837 Water, water, every where,
1838 Nor any drop to drink.
1839 S. T. Coleridge (1772-1834)
1840 ', to_tsquery('english', 'day | drink'));
1842 -----------------------------------------------------------
1843 <b>Day</b> after <b>day</b>, <b>day</b> after <b>day</b>,+
1844 We stuck, nor breath nor motion, +
1845 As idle as a painted
1848 SELECT ts_headline('english', '
1849 Day after day, day after day,
1850 We stuck, nor breath nor motion,
1851 As idle as a painted Ship
1852 Upon a painted Ocean.
1853 Water, water, every where
1854 And all the boards did shrink;
1855 Water, water, every where,
1856 Nor any drop to drink.
1857 S. T. Coleridge (1772-1834)
1858 ', to_tsquery('english', 'day | !drink'));
1860 -----------------------------------------------------------
1861 <b>Day</b> after <b>day</b>, <b>day</b> after <b>day</b>,+
1862 We stuck, nor breath nor motion, +
1863 As idle as a painted
1866 SELECT ts_headline('english', '
1867 Day after day, day after day,
1868 We stuck, nor breath nor motion,
1869 As idle as a painted Ship
1870 Upon a painted Ocean.
1871 Water, water, every where
1872 And all the boards did shrink;
1873 Water, water, every where,
1874 Nor any drop to drink.
1875 S. T. Coleridge (1772-1834)
1876 ', to_tsquery('english', 'painted <-> Ship & drink'));
1878 ----------------------------------
1879 <b>painted</b> <b>Ship</b> +
1880 Upon a <b>painted</b> Ocean. +
1881 Water, water, every where +
1882 And all the boards did shrink;+
1883 Water, water, every where, +
1884 Nor any drop to <b>drink</b>
1887 SELECT ts_headline('english', '
1888 Day after day, day after day,
1889 We stuck, nor breath nor motion,
1890 As idle as a painted Ship
1891 Upon a painted Ocean.
1892 Water, water, every where
1893 And all the boards did shrink;
1894 Water, water, every where,
1895 Nor any drop to drink.
1896 S. T. Coleridge (1772-1834)
1897 ', to_tsquery('english', 'painted <-> Ship | drink'));
1899 ---------------------------------
1900 <b>painted</b> <b>Ship</b> +
1901 Upon a <b>painted</b> Ocean. +
1902 Water, water, every where +
1903 And all the boards did shrink
1906 SELECT ts_headline('english', '
1907 Day after day, day after day,
1908 We stuck, nor breath nor motion,
1909 As idle as a painted Ship
1910 Upon a painted Ocean.
1911 Water, water, every where
1912 And all the boards did shrink;
1913 Water, water, every where,
1914 Nor any drop to drink.
1915 S. T. Coleridge (1772-1834)
1916 ', to_tsquery('english', 'painted <-> Ship | !drink'));
1918 ---------------------------------
1919 <b>painted</b> <b>Ship</b> +
1920 Upon a <b>painted</b> Ocean. +
1921 Water, water, every where +
1922 And all the boards did shrink
1925 SELECT ts_headline('english', '
1926 Day after day, day after day,
1927 We stuck, nor breath nor motion,
1928 As idle as a painted Ship
1929 Upon a painted Ocean.
1930 Water, water, every where
1931 And all the boards did shrink;
1932 Water, water, every where,
1933 Nor any drop to drink.
1934 S. T. Coleridge (1772-1834)
1935 ', phraseto_tsquery('english', 'painted Ocean'));
1937 ----------------------------------
1938 <b>painted</b> <b>Ocean</b>. +
1939 Water, water, every where +
1940 And all the boards did shrink;+
1944 SELECT ts_headline('english', '
1945 Day after day, day after day,
1946 We stuck, nor breath nor motion,
1947 As idle as a painted Ship
1948 Upon a painted Ocean.
1949 Water, water, every where
1950 And all the boards did shrink;
1951 Water, water, every where,
1952 Nor any drop to drink.
1953 S. T. Coleridge (1772-1834)
1954 ', phraseto_tsquery('english', 'idle as a painted Ship'));
1956 ---------------------------------------------
1957 <b>idle</b> as a <b>painted</b> <b>Ship</b>+
1958 Upon a <b>painted</b> Ocean. +
1959 Water, water, every where +
1963 SELECT ts_headline('english',
1964 'Lorem ipsum urna. Nullam nullam ullamcorper urna.',
1965 to_tsquery('english','Lorem') && phraseto_tsquery('english','ullamcorper urna'),
1966 'MaxWords=100, MinWords=1');
1968 -------------------------------------------------------------------------------
1969 <b>Lorem</b> ipsum <b>urna</b>. Nullam nullam <b>ullamcorper</b> <b>urna</b>
1972 SELECT ts_headline('english',
1973 'Lorem ipsum urna. Nullam nullam ullamcorper urna.',
1974 phraseto_tsquery('english','ullamcorper urna'),
1975 'MaxWords=100, MinWords=5');
1977 -------------------------------------------------------------
1978 <b>urna</b>. Nullam nullam <b>ullamcorper</b> <b>urna</b>.
1981 SELECT ts_headline('english', '
1983 <!-- some comment -->
1985 Sea view wow <u>foo bar</u> <i>qq</i>
1986 <a href="http://www.google.com/foo.bar.html" target="_blank">YES </a>
1993 to_tsquery('english', 'sea&foo'), 'HighlightAll=true');
1995 -----------------------------------------------------------------------------
1998 <!-- some comment --> +
2000 <b>Sea</b> view wow <u><b>foo</b> bar</u> <i>qq</i> +
2001 <a href="http://www.google.com/foo.bar.html" target="_blank">YES </a>+
2004 document.write(15); +
2010 SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 <-> 3', 'MaxWords=2, MinWords=1');
2016 SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 & 3', 'MaxWords=4, MinWords=1');
2018 ---------------------
2022 SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 <-> 3', 'MaxWords=4, MinWords=1');
2028 --Check if headline fragments work
2029 SELECT ts_headline('english', '
2030 Day after day, day after day,
2031 We stuck, nor breath nor motion,
2032 As idle as a painted Ship
2033 Upon a painted Ocean.
2034 Water, water, every where
2035 And all the boards did shrink;
2036 Water, water, every where,
2037 Nor any drop to drink.
2038 S. T. Coleridge (1772-1834)
2039 ', to_tsquery('english', 'ocean'), 'MaxFragments=1');
2041 ------------------------------------
2043 We stuck, nor breath nor motion,+
2044 As idle as a painted Ship +
2045 Upon a painted <b>Ocean</b>. +
2046 Water, water, every where +
2047 And all the boards did shrink; +
2048 Water, water, every where, +
2052 --Check if more than one fragments are displayed
2053 SELECT ts_headline('english', '
2054 Day after day, day after day,
2055 We stuck, nor breath nor motion,
2056 As idle as a painted Ship
2057 Upon a painted Ocean.
2058 Water, water, every where
2059 And all the boards did shrink;
2060 Water, water, every where,
2061 Nor any drop to drink.
2062 S. T. Coleridge (1772-1834)
2063 ', to_tsquery('english', 'Coleridge & stuck'), 'MaxFragments=2');
2065 ----------------------------------------------
2066 after day, day after day, +
2067 We <b>stuck</b>, nor breath nor motion, +
2068 As idle as a painted Ship +
2069 Upon a painted Ocean. +
2070 Water, water, every where +
2071 And all the boards did shrink; +
2072 Water, water, every where ... drop to drink.+
2073 S. T. <b>Coleridge</b>
2076 --Fragments when there all query words are not in the document
2077 SELECT ts_headline('english', '
2078 Day after day, day after day,
2079 We stuck, nor breath nor motion,
2080 As idle as a painted Ship
2081 Upon a painted Ocean.
2082 Water, water, every where
2083 And all the boards did shrink;
2084 Water, water, every where,
2085 Nor any drop to drink.
2086 S. T. Coleridge (1772-1834)
2087 ', to_tsquery('english', 'ocean & seahorse'), 'MaxFragments=1');
2089 ------------------------------------
2091 Day after day, day after day, +
2092 We stuck, nor breath nor motion,+
2096 --FragmentDelimiter option
2097 SELECT ts_headline('english', '
2098 Day after day, day after day,
2099 We stuck, nor breath nor motion,
2100 As idle as a painted Ship
2101 Upon a painted Ocean.
2102 Water, water, every where
2103 And all the boards did shrink;
2104 Water, water, every where,
2105 Nor any drop to drink.
2106 S. T. Coleridge (1772-1834)
2107 ', to_tsquery('english', 'Coleridge & stuck'), 'MaxFragments=2,FragmentDelimiter=***');
2109 --------------------------------------------
2110 after day, day after day, +
2111 We <b>stuck</b>, nor breath nor motion, +
2112 As idle as a painted Ship +
2113 Upon a painted Ocean. +
2114 Water, water, every where +
2115 And all the boards did shrink; +
2116 Water, water, every where***drop to drink.+
2117 S. T. <b>Coleridge</b>
2120 --Fragments with phrase search
2121 SELECT ts_headline('english',
2122 'Lorem ipsum urna. Nullam nullam ullamcorper urna.',
2123 to_tsquery('english','Lorem') && phraseto_tsquery('english','ullamcorper urna'),
2124 'MaxFragments=100, MaxWords=100, MinWords=1');
2126 -------------------------------------------------------------------------------
2127 <b>Lorem</b> ipsum <b>urna</b>. Nullam nullam <b>ullamcorper</b> <b>urna</b>
2130 -- Edge cases with empty query
2131 SELECT ts_headline('english',
2132 '', to_tsquery('english', ''));
2133 NOTICE: text-search query doesn't contain lexemes: ""
2139 SELECT ts_headline('english',
2140 'foo bar', to_tsquery('english', ''));
2141 NOTICE: text-search query doesn't contain lexemes: ""
2147 --Rewrite sub system
2148 CREATE TABLE test_tsquery (txtkeyword TEXT, txtsample TEXT);
2150 ALTER TABLE test_tsquery ADD COLUMN keyword tsquery;
2151 UPDATE test_tsquery SET keyword = to_tsquery('english', txtkeyword);
2152 ALTER TABLE test_tsquery ADD COLUMN sample tsquery;
2153 UPDATE test_tsquery SET sample = to_tsquery('english', txtsample::text);
2154 SELECT COUNT(*) FROM test_tsquery WHERE keyword < 'new <-> york';
2160 SELECT COUNT(*) FROM test_tsquery WHERE keyword <= 'new <-> york';
2166 SELECT COUNT(*) FROM test_tsquery WHERE keyword = 'new <-> york';
2172 SELECT COUNT(*) FROM test_tsquery WHERE keyword >= 'new <-> york';
2178 SELECT COUNT(*) FROM test_tsquery WHERE keyword > 'new <-> york';
2184 CREATE UNIQUE INDEX bt_tsq ON test_tsquery (keyword);
2185 SET enable_seqscan=OFF;
2186 SELECT COUNT(*) FROM test_tsquery WHERE keyword < 'new <-> york';
2192 SELECT COUNT(*) FROM test_tsquery WHERE keyword <= 'new <-> york';
2198 SELECT COUNT(*) FROM test_tsquery WHERE keyword = 'new <-> york';
2204 SELECT COUNT(*) FROM test_tsquery WHERE keyword >= 'new <-> york';
2210 SELECT COUNT(*) FROM test_tsquery WHERE keyword > 'new <-> york';
2216 RESET enable_seqscan;
2217 SELECT ts_rewrite('foo & bar & qq & new & york', 'new & york'::tsquery, 'big & apple | nyc | new & york & city');
2219 ------------------------------------------------------------------------------
2220 'foo' & 'bar' & 'qq' & ( 'city' & 'new' & 'york' | 'nyc' | 'big' & 'apple' )
2223 SELECT ts_rewrite(ts_rewrite('new & !york ', 'york', '!jersey'),
2224 'jersey', 'mexico');
2226 --------------------
2230 SELECT ts_rewrite('moscow', 'SELECT keyword, sample FROM test_tsquery'::text );
2232 ---------------------
2236 SELECT ts_rewrite('moscow & hotel', 'SELECT keyword, sample FROM test_tsquery'::text );
2238 -----------------------------------
2239 'hotel' & ( 'moskva' | 'moscow' )
2242 SELECT ts_rewrite('bar & qq & foo & (new <-> york)', 'SELECT keyword, sample FROM test_tsquery'::text );
2244 -------------------------------------------------------------------------------------
2245 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | 'big' <-> 'appl' | 'new' <-> 'york' )
2248 SELECT ts_rewrite( 'moscow', 'SELECT keyword, sample FROM test_tsquery');
2250 ---------------------
2254 SELECT ts_rewrite( 'moscow & hotel', 'SELECT keyword, sample FROM test_tsquery');
2256 -----------------------------------
2257 'hotel' & ( 'moskva' | 'moscow' )
2260 SELECT ts_rewrite( 'bar & qq & foo & (new <-> york)', 'SELECT keyword, sample FROM test_tsquery');
2262 -------------------------------------------------------------------------------------
2263 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | 'big' <-> 'appl' | 'new' <-> 'york' )
2266 SELECT ts_rewrite('1 & (2 <-> 3)', 'SELECT keyword, sample FROM test_tsquery'::text );
2272 SELECT ts_rewrite('1 & (2 <2> 3)', 'SELECT keyword, sample FROM test_tsquery'::text );
2278 SELECT ts_rewrite('5 <-> (1 & (2 <-> 3))', 'SELECT keyword, sample FROM test_tsquery'::text );
2280 -------------------------
2281 '5' <-> ( '2' <-> '4' )
2284 SELECT ts_rewrite('5 <-> (6 | 8)', 'SELECT keyword, sample FROM test_tsquery'::text );
2286 -----------------------
2287 '5' <-> ( '6' | '8' )
2290 -- Check empty substitution
2291 SELECT ts_rewrite(to_tsquery('5 & (6 | 5)'), to_tsquery('5'), to_tsquery(''));
2292 NOTICE: text-search query doesn't contain lexemes: ""
2298 SELECT ts_rewrite(to_tsquery('!5'), to_tsquery('5'), to_tsquery(''));
2299 NOTICE: text-search query doesn't contain lexemes: ""
2305 SELECT keyword FROM test_tsquery WHERE keyword @> 'new';
2311 SELECT keyword FROM test_tsquery WHERE keyword @> 'moscow';
2317 SELECT keyword FROM test_tsquery WHERE keyword <@ 'new';
2322 SELECT keyword FROM test_tsquery WHERE keyword <@ 'moscow';
2328 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query;
2330 ---------------------
2334 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query;
2336 -----------------------------------
2337 'hotel' & ( 'moskva' | 'moscow' )
2340 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & qq & foo & (new <-> york)') AS query;
2342 -------------------------------------------------------------------------------------
2343 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | 'big' <-> 'appl' | 'new' <-> 'york' )
2346 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query;
2348 ---------------------
2352 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query;
2354 -----------------------------------
2355 'hotel' & ( 'moskva' | 'moscow' )
2358 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & qq & foo & (new <-> york)') AS query;
2360 -------------------------------------------------------------------------------------
2361 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | 'big' <-> 'appl' | 'new' <-> 'york' )
2364 CREATE INDEX qq ON test_tsquery USING gist (keyword tsquery_ops);
2365 SET enable_seqscan=OFF;
2366 SELECT keyword FROM test_tsquery WHERE keyword @> 'new';
2372 SELECT keyword FROM test_tsquery WHERE keyword @> 'moscow';
2378 SELECT keyword FROM test_tsquery WHERE keyword <@ 'new';
2383 SELECT keyword FROM test_tsquery WHERE keyword <@ 'moscow';
2389 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query;
2391 ---------------------
2395 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query;
2397 -----------------------------------
2398 'hotel' & ( 'moskva' | 'moscow' )
2401 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & qq & foo & (new <-> york)') AS query;
2403 -------------------------------------------------------------------------------------
2404 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | 'big' <-> 'appl' | 'new' <-> 'york' )
2407 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query;
2409 ---------------------
2413 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query;
2415 -----------------------------------
2416 'hotel' & ( 'moskva' | 'moscow' )
2419 SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & qq & foo & (new <-> york)') AS query;
2421 -------------------------------------------------------------------------------------
2422 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | 'big' <-> 'appl' | 'new' <-> 'york' )
2425 SELECT ts_rewrite(tsquery_phrase('foo', 'foo'), 'foo', 'bar | baz');
2427 -----------------------------------------
2428 ( 'bar' | 'baz' ) <-> ( 'bar' | 'baz' )
2431 SELECT to_tsvector('foo bar') @@
2432 ts_rewrite(tsquery_phrase('foo', 'foo'), 'foo', 'bar | baz');
2438 SELECT to_tsvector('bar baz') @@
2439 ts_rewrite(tsquery_phrase('foo', 'foo'), 'foo', 'bar | baz');
2445 RESET enable_seqscan;
2447 SET default_text_search_config=simple;
2448 SELECT to_tsvector('SKIES My booKs');
2450 ----------------------------
2451 'books':3 'my':2 'skies':1
2454 SELECT plainto_tsquery('SKIES My booKs');
2456 --------------------------
2457 'skies' & 'my' & 'books'
2460 SELECT to_tsquery('SKIES & My | booKs');
2462 --------------------------
2463 'skies' & 'my' | 'books'
2466 SET default_text_search_config=english;
2467 SELECT to_tsvector('SKIES My booKs');
2473 SELECT plainto_tsquery('SKIES My booKs');
2479 SELECT to_tsquery('SKIES & My | booKs');
2486 CREATE TRIGGER tsvectorupdate
2487 BEFORE UPDATE OR INSERT ON test_tsvector
2488 FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(a, 'pg_catalog.english', t);
2489 SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
2495 INSERT INTO test_tsvector (t) VALUES ('345 qwerty');
2496 SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
2502 UPDATE test_tsvector SET t = null WHERE t = '345 qwerty';
2503 SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
2509 INSERT INTO test_tsvector (t) VALUES ('345 qwerty');
2510 SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
2516 -- Test inlining of immutable constant functions
2517 -- to_tsquery(text) is not immutable, so it won't be inlined
2519 select * from test_tsquery, to_tsquery('new') q where txtsample @@ q;
2521 ------------------------------------------------
2523 Join Filter: (test_tsquery.txtsample @@ q.q)
2524 -> Function Scan on to_tsquery q
2525 -> Seq Scan on test_tsquery
2528 -- to_tsquery(regconfig, text) is an immutable function.
2529 -- That allows us to get rid of using function scan and join at all.
2531 select * from test_tsquery, to_tsquery('english', 'new') q where txtsample @@ q;
2533 ---------------------------------------------
2534 Seq Scan on test_tsquery
2535 Filter: (txtsample @@ '''new'''::tsquery)
2538 -- test finding items in GIN's pending list
2539 create temp table pendtest (ts tsvector);
2540 create index pendtest_idx on pendtest using gin(ts);
2541 insert into pendtest values (to_tsvector('Lore ipsam'));
2542 insert into pendtest values (to_tsvector('Lore ipsum'));
2543 select * from pendtest where 'ipsu:*'::tsquery @@ ts;
2545 --------------------
2549 select * from pendtest where 'ipsa:*'::tsquery @@ ts;
2551 --------------------
2555 select * from pendtest where 'ips:*'::tsquery @@ ts;
2557 --------------------
2562 select * from pendtest where 'ipt:*'::tsquery @@ ts;
2567 select * from pendtest where 'ipi:*'::tsquery @@ ts;
2572 --check OP_PHRASE on index
2573 create temp table phrase_index_test(fts tsvector);
2574 insert into phrase_index_test values ('A fat cat has just eaten a rat.');
2575 insert into phrase_index_test values (to_tsvector('english', 'A fat cat has just eaten a rat.'));
2576 create index phrase_index_test_idx on phrase_index_test using gin(fts);
2577 set enable_seqscan = off;
2578 select * from phrase_index_test where fts @@ phraseto_tsquery('english', 'fat cat');
2580 -----------------------------------
2581 'cat':3 'eaten':6 'fat':2 'rat':8
2584 set enable_seqscan = on;
2585 -- test websearch_to_tsquery function
2586 select websearch_to_tsquery('simple', 'I have a fat:*ABCD cat');
2587 websearch_to_tsquery
2588 ---------------------------------------------
2589 'i' & 'have' & 'a' & 'fat' & 'abcd' & 'cat'
2592 select websearch_to_tsquery('simple', 'orange:**AABBCCDD');
2593 websearch_to_tsquery
2594 -----------------------
2595 'orange' & 'aabbccdd'
2598 select websearch_to_tsquery('simple', 'fat:A!cat:B|rat:C<');
2599 websearch_to_tsquery
2600 -----------------------------------------
2601 'fat' & 'a' & 'cat' & 'b' & 'rat' & 'c'
2604 select websearch_to_tsquery('simple', 'fat:A : cat:B');
2605 websearch_to_tsquery
2606 ---------------------------
2607 'fat' & 'a' & 'cat' & 'b'
2610 select websearch_to_tsquery('simple', 'fat*rat');
2611 websearch_to_tsquery
2612 ----------------------
2616 select websearch_to_tsquery('simple', 'fat-rat');
2617 websearch_to_tsquery
2618 -------------------------------
2619 'fat-rat' <-> 'fat' <-> 'rat'
2622 select websearch_to_tsquery('simple', 'fat_rat');
2623 websearch_to_tsquery
2624 ----------------------
2628 -- weights are completely ignored
2629 select websearch_to_tsquery('simple', 'abc : def');
2630 websearch_to_tsquery
2631 ----------------------
2635 select websearch_to_tsquery('simple', 'abc:def');
2636 websearch_to_tsquery
2637 ----------------------
2641 select websearch_to_tsquery('simple', 'a:::b');
2642 websearch_to_tsquery
2643 ----------------------
2647 select websearch_to_tsquery('simple', 'abc:d');
2648 websearch_to_tsquery
2649 ----------------------
2653 select websearch_to_tsquery('simple', ':');
2654 NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
2655 websearch_to_tsquery
2656 ----------------------
2660 -- these operators are ignored
2661 select websearch_to_tsquery('simple', 'abc & def');
2662 websearch_to_tsquery
2663 ----------------------
2667 select websearch_to_tsquery('simple', 'abc | def');
2668 websearch_to_tsquery
2669 ----------------------
2673 select websearch_to_tsquery('simple', 'abc <-> def');
2674 websearch_to_tsquery
2675 ----------------------
2679 -- parens are ignored, too
2680 select websearch_to_tsquery('simple', 'abc (pg or class)');
2681 websearch_to_tsquery
2682 ------------------------
2683 'abc' & 'pg' | 'class'
2686 select websearch_to_tsquery('simple', '(foo bar) or (ding dong)');
2687 websearch_to_tsquery
2688 ---------------------------------
2689 'foo' & 'bar' | 'ding' & 'dong'
2692 -- NOT is ignored in quotes
2693 select websearch_to_tsquery('english', 'My brand new smartphone');
2694 websearch_to_tsquery
2695 -------------------------------
2696 'brand' & 'new' & 'smartphon'
2699 select websearch_to_tsquery('english', 'My brand "new smartphone"');
2700 websearch_to_tsquery
2701 ---------------------------------
2702 'brand' & 'new' <-> 'smartphon'
2705 select websearch_to_tsquery('english', 'My brand "new -smartphone"');
2706 websearch_to_tsquery
2707 ---------------------------------
2708 'brand' & 'new' <-> 'smartphon'
2712 select websearch_to_tsquery('simple', 'cat or rat');
2713 websearch_to_tsquery
2714 ----------------------
2718 select websearch_to_tsquery('simple', 'cat OR rat');
2719 websearch_to_tsquery
2720 ----------------------
2724 select websearch_to_tsquery('simple', 'cat "OR" rat');
2725 websearch_to_tsquery
2726 ----------------------
2727 'cat' & 'or' & 'rat'
2730 select websearch_to_tsquery('simple', 'cat OR');
2731 websearch_to_tsquery
2732 ----------------------
2736 select websearch_to_tsquery('simple', 'OR rat');
2737 websearch_to_tsquery
2738 ----------------------
2742 select websearch_to_tsquery('simple', '"fat cat OR rat"');
2743 websearch_to_tsquery
2744 ------------------------------------
2745 'fat' <-> 'cat' <-> 'or' <-> 'rat'
2748 select websearch_to_tsquery('simple', 'fat (cat OR rat');
2749 websearch_to_tsquery
2750 -----------------------
2751 'fat' & 'cat' | 'rat'
2754 select websearch_to_tsquery('simple', 'or OR or');
2755 websearch_to_tsquery
2756 ----------------------
2760 -- OR is an operator here ...
2761 select websearch_to_tsquery('simple', '"fat cat"or"fat rat"');
2762 websearch_to_tsquery
2763 -----------------------------------
2764 'fat' <-> 'cat' | 'fat' <-> 'rat'
2767 select websearch_to_tsquery('simple', 'fat or(rat');
2768 websearch_to_tsquery
2769 ----------------------
2773 select websearch_to_tsquery('simple', 'fat or)rat');
2774 websearch_to_tsquery
2775 ----------------------
2779 select websearch_to_tsquery('simple', 'fat or&rat');
2780 websearch_to_tsquery
2781 ----------------------
2785 select websearch_to_tsquery('simple', 'fat or|rat');
2786 websearch_to_tsquery
2787 ----------------------
2791 select websearch_to_tsquery('simple', 'fat or!rat');
2792 websearch_to_tsquery
2793 ----------------------
2797 select websearch_to_tsquery('simple', 'fat or<rat');
2798 websearch_to_tsquery
2799 ----------------------
2803 select websearch_to_tsquery('simple', 'fat or>rat');
2804 websearch_to_tsquery
2805 ----------------------
2809 select websearch_to_tsquery('simple', 'fat or ');
2810 websearch_to_tsquery
2811 ----------------------
2816 select websearch_to_tsquery('simple', 'abc orange');
2817 websearch_to_tsquery
2818 ----------------------
2822 select websearch_to_tsquery('simple', 'abc OR1234');
2823 websearch_to_tsquery
2824 ----------------------
2828 select websearch_to_tsquery('simple', 'abc or-abc');
2829 websearch_to_tsquery
2830 -------------------------------------
2831 'abc' & 'or-abc' <-> 'or' <-> 'abc'
2834 select websearch_to_tsquery('simple', 'abc OR_abc');
2835 websearch_to_tsquery
2836 ------------------------
2837 'abc' & 'or' <-> 'abc'
2841 select websearch_to_tsquery('english', '"pg_class pg');
2842 websearch_to_tsquery
2843 ---------------------------
2844 'pg' <-> 'class' <-> 'pg'
2847 select websearch_to_tsquery('english', 'pg_class pg"');
2848 websearch_to_tsquery
2849 -------------------------
2850 'pg' <-> 'class' & 'pg'
2853 select websearch_to_tsquery('english', '"pg_class pg"');
2854 websearch_to_tsquery
2855 ---------------------------
2856 'pg' <-> 'class' <-> 'pg'
2859 select websearch_to_tsquery('english', '"pg_class : pg"');
2860 websearch_to_tsquery
2861 ---------------------------
2862 'pg' <-> 'class' <-> 'pg'
2865 select websearch_to_tsquery('english', 'abc "pg_class pg"');
2866 websearch_to_tsquery
2867 -----------------------------------
2868 'abc' & 'pg' <-> 'class' <-> 'pg'
2871 select websearch_to_tsquery('english', '"pg_class pg" def');
2872 websearch_to_tsquery
2873 -----------------------------------
2874 'pg' <-> 'class' <-> 'pg' & 'def'
2877 select websearch_to_tsquery('english', 'abc "pg pg_class pg" def');
2878 websearch_to_tsquery
2879 ----------------------------------------------------
2880 'abc' & 'pg' <-> 'pg' <-> 'class' <-> 'pg' & 'def'
2883 select websearch_to_tsquery('english', ' or "pg pg_class pg" or ');
2884 websearch_to_tsquery
2885 ------------------------------------
2886 'pg' <-> 'pg' <-> 'class' <-> 'pg'
2889 select websearch_to_tsquery('english', '""pg pg_class pg""');
2890 websearch_to_tsquery
2891 --------------------------------
2892 'pg' & 'pg' <-> 'class' & 'pg'
2895 select websearch_to_tsquery('english', 'abc """"" def');
2896 websearch_to_tsquery
2897 ----------------------
2901 select websearch_to_tsquery('english', 'cat -"fat rat"');
2902 websearch_to_tsquery
2903 ------------------------------
2904 'cat' & !( 'fat' <-> 'rat' )
2907 select websearch_to_tsquery('english', 'cat -"fat rat" cheese');
2908 websearch_to_tsquery
2909 ----------------------------------------
2910 'cat' & !( 'fat' <-> 'rat' ) & 'chees'
2913 select websearch_to_tsquery('english', 'abc "def -"');
2914 websearch_to_tsquery
2915 ----------------------
2919 select websearch_to_tsquery('english', 'abc "def :"');
2920 websearch_to_tsquery
2921 ----------------------
2925 select websearch_to_tsquery('english', '"A fat cat" has just eaten a -rat.');
2926 websearch_to_tsquery
2927 ------------------------------------
2928 'fat' <-> 'cat' & 'eaten' & !'rat'
2931 select websearch_to_tsquery('english', '"A fat cat" has just eaten OR !rat.');
2932 websearch_to_tsquery
2933 -----------------------------------
2934 'fat' <-> 'cat' & 'eaten' | 'rat'
2937 select websearch_to_tsquery('english', '"A fat cat" has just (+eaten OR -rat)');
2938 websearch_to_tsquery
2939 ------------------------------------
2940 'fat' <-> 'cat' & 'eaten' | !'rat'
2943 select websearch_to_tsquery('english', 'this is ----fine');
2944 websearch_to_tsquery
2945 ----------------------
2949 select websearch_to_tsquery('english', '(()) )))) this ||| is && -fine, "dear friend" OR good');
2950 websearch_to_tsquery
2951 ----------------------------------------
2952 !'fine' & 'dear' <-> 'friend' | 'good'
2955 select websearch_to_tsquery('english', 'an old <-> cat " is fine &&& too');
2956 websearch_to_tsquery
2957 ------------------------
2958 'old' & 'cat' & 'fine'
2961 select websearch_to_tsquery('english', '"A the" OR just on');
2962 NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
2963 websearch_to_tsquery
2964 ----------------------
2968 select websearch_to_tsquery('english', '"a fat cat" ate a rat');
2969 websearch_to_tsquery
2970 ---------------------------------
2971 'fat' <-> 'cat' & 'ate' & 'rat'
2974 select to_tsvector('english', 'A fat cat ate a rat') @@
2975 websearch_to_tsquery('english', '"a fat cat" ate a rat');
2981 select to_tsvector('english', 'A fat grey cat ate a rat') @@
2982 websearch_to_tsquery('english', '"a fat cat" ate a rat');
2988 -- cases handled by gettoken_tsvector()
2989 select websearch_to_tsquery('''');
2990 NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
2991 websearch_to_tsquery
2992 ----------------------
2996 select websearch_to_tsquery('''abc''''def''');
2997 websearch_to_tsquery
2998 ----------------------
3002 select websearch_to_tsquery('\abc');
3003 websearch_to_tsquery
3004 ----------------------
3008 select websearch_to_tsquery('\');
3009 NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
3010 websearch_to_tsquery
3011 ----------------------