14 SELECT ' 1'::tsvector;
20 SELECT ' 1 '::tsvector;
26 SELECT '1 2'::tsvector;
32 SELECT '''1 2'''::tsvector;
38 SELECT E'''1 \\''2'''::tsvector;
44 SELECT E'''1 \\''2''3'::tsvector;
50 SELECT E'''1 \\''2'' 3'::tsvector;
56 SELECT E'''1 \\''2'' '' 3'' 4 '::tsvector;
62 SELECT $$'\\as' ab\c ab\\c AB\\\c ab\\\\c$$::tsvector;
64 ----------------------------------------
65 'AB\\c' '\\as' 'ab\\\\c' 'ab\\c' 'abc'
68 SELECT tsvectorin(tsvectorout($$'\\as' ab\c ab\\c AB\\\c ab\\\\c$$::tsvector));
70 ----------------------------------------
71 'AB\\c' '\\as' 'ab\\\\c' 'ab\\c' 'abc'
74 SELECT '''w'':4A,3B,2C,1D,5 a:8';
76 -----------------------
80 SELECT 'a:3A b:2a'::tsvector || 'ba:1234 a:1B';
82 ----------------------------
83 'a':3A,4B 'b':2A 'ba':1237
86 SELECT setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c');
88 ----------------------------------------------------------
89 'a':1C,3C 'asd':1C 'w':5C,6C,12C,13C 'zxc':81C,222C,567C
92 SELECT strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector);
105 SELECT '1 '::tsquery;
111 SELECT ' 1'::tsquery;
117 SELECT ' 1 '::tsquery;
123 SELECT '''1 2'''::tsquery;
129 SELECT E'''1 \\''2'''::tsquery;
135 SELECT '!1'::tsquery;
141 SELECT '1|2'::tsquery;
147 SELECT '1|!2'::tsquery;
153 SELECT '!1|2'::tsquery;
159 SELECT '!1|!2'::tsquery;
165 SELECT '!(!1|!2)'::tsquery;
171 SELECT '!(!1|2)'::tsquery;
177 SELECT '!(1|!2)'::tsquery;
183 SELECT '!(1|2)'::tsquery;
189 SELECT '1&2'::tsquery;
195 SELECT '!1&2'::tsquery;
201 SELECT '1&!2'::tsquery;
207 SELECT '!1&!2'::tsquery;
213 SELECT '(1&2)'::tsquery;
219 SELECT '1&(2)'::tsquery;
225 SELECT '!(1)&2'::tsquery;
231 SELECT '!(1&2)'::tsquery;
237 SELECT '1|2&3'::tsquery;
243 SELECT '1|(2&3)'::tsquery;
249 SELECT '(1|2)&3'::tsquery;
251 ---------------------
255 SELECT '1|2&!3'::tsquery;
261 SELECT '1|!2&3'::tsquery;
267 SELECT '!1|2&3'::tsquery;
273 SELECT '!1|(2&3)'::tsquery;
279 SELECT '!(1|2)&3'::tsquery;
281 ----------------------
285 SELECT '(!1|2)&3'::tsquery;
287 ----------------------
291 SELECT '1|(2|(4|(5|6)))'::tsquery;
293 -----------------------------------------
294 '1' | ( '2' | ( '4' | ( '5' | '6' ) ) )
297 SELECT '1|2|4|5|6'::tsquery;
299 -----------------------------------------
300 ( ( ( '1' | '2' ) | '4' ) | '5' ) | '6'
303 SELECT '1&(2&(4&(5&6)))'::tsquery;
305 -----------------------------
306 '1' & '2' & '4' & '5' & '6'
309 SELECT '1&2&4&5&6'::tsquery;
311 -----------------------------
312 '1' & '2' & '4' & '5' & '6'
315 SELECT '1&(2&(4&(5|6)))'::tsquery;
317 ---------------------------------
318 '1' & '2' & '4' & ( '5' | '6' )
321 SELECT '1&(2&(4&(5|!6)))'::tsquery;
323 ----------------------------------
324 '1' & '2' & '4' & ( '5' | !'6' )
327 SELECT E'1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::tsquery;
329 ------------------------------------------
330 '1' & '2' & ' 4' & ( '|5' | '6 '' !|&' )
333 SELECT $$'\\as'$$::tsquery;
339 SELECT 'a:* & nbb:*ac | doo:a* | goo'::tsquery;
341 ------------------------------------------
342 ( 'a':* & 'nbb':*AC | 'doo':*A ) | 'goo'
345 SELECT 'a' < 'b & c'::tsquery as "true";
351 SELECT 'a' > 'b & c'::tsquery as "false";
357 SELECT 'a | f' < 'b & c'::tsquery as "true";
363 SELECT 'a | ff' < 'b & c'::tsquery as "false";
369 SELECT 'a | f | g' < 'b & c'::tsquery as "false";
375 SELECT numnode( 'new'::tsquery );
381 SELECT numnode( 'new & york'::tsquery );
387 SELECT numnode( 'new & york | qwery'::tsquery );
393 SELECT 'foo & bar'::tsquery && 'asd';
395 -----------------------
396 'foo' & 'bar' & 'asd'
399 SELECT 'foo & bar'::tsquery || 'asd & fg';
401 ------------------------------
402 'foo' & 'bar' | 'asd' & 'fg'
405 SELECT 'foo & bar'::tsquery || !!'asd & fg'::tsquery;
407 -----------------------------------
408 'foo' & 'bar' | !( 'asd' & 'fg' )
411 SELECT 'foo & bar'::tsquery && 'asd | fg';
413 ----------------------------------
414 'foo' & 'bar' & ( 'asd' | 'fg' )
417 -- tsvector-tsquery operations
418 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca' as "true";
424 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:B' as "true";
430 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:A' as "true";
436 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:C' as "false";
442 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:CB' as "true";
448 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & c:*C' as "false";
454 SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & c:*CB' as "true";
460 SELECT 'a b:89 ca:23A,64b cb:80c d:34c'::tsvector @@ 'd:AC & c:*C' as "true";
466 SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*C' as "true";
472 SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*B' as "true";
478 SELECT 'supernova'::tsvector @@ 'super'::tsquery AS "false";
484 SELECT 'supeanova supernova'::tsvector @@ 'super'::tsquery AS "false";
490 SELECT 'supeznova supernova'::tsvector @@ 'super'::tsquery AS "false";
496 SELECT 'supernova'::tsvector @@ 'super:*'::tsquery AS "true";
502 SELECT 'supeanova supernova'::tsvector @@ 'super:*'::tsquery AS "true";
508 SELECT 'supeznova supernova'::tsvector @@ 'super:*'::tsquery AS "true";
514 SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a | s');
520 SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s');
526 SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s:*');
532 SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | sa:*');
538 SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a | s');
544 SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a | s');
550 SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a & s');
556 SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a & s');
562 SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a & s');
568 SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a | s');
574 SELECT ts_rank_cd(' a:1 sa:2C d g'::tsvector, 'a | s');
580 SELECT ts_rank_cd(' a:1 sa:2C d g'::tsvector, 'a | s:*');
586 SELECT ts_rank_cd(' a:1 sa:2C d g'::tsvector, 'a | sa:*');
592 SELECT ts_rank_cd(' a:1 sa:3C sab:2c d g'::tsvector, 'a | sa:*');
598 SELECT ts_rank_cd(' a:1 s:2B d g'::tsvector, 'a | s');
604 SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a | s');
610 SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a & s');
616 SELECT ts_rank_cd(' a:1 s:2B d g'::tsvector, 'a & s');
622 SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a & s');