mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Replace the now-incompatible-with-core contrib/tsearch2 module with a
compatibility package. This supports importing dumps from past versions using tsearch2, and provides the old names and API for most functions that were changed. (rewrite(ARRAY[...]) is a glaring omission, though.) Pavel Stehule and Tom Lane
This commit is contained in:
@ -382,9 +382,9 @@ select numnode( 'new & york | qwery'::tsquery );
|
||||
create table test_tsquery (txtkeyword text, txtsample text);
|
||||
\set ECHO none
|
||||
alter table test_tsquery add column keyword tsquery;
|
||||
update test_tsquery set keyword = to_tsquery('default', txtkeyword);
|
||||
update test_tsquery set keyword = to_tsquery('english', txtkeyword);
|
||||
alter table test_tsquery add column sample tsquery;
|
||||
update test_tsquery set sample = to_tsquery('default', txtsample::text);
|
||||
update test_tsquery set sample = to_tsquery('english', txtsample::text);
|
||||
create unique index bt_tsq on test_tsquery (keyword);
|
||||
select count(*) from test_tsquery where keyword < 'new & york';
|
||||
count
|
||||
@ -451,7 +451,7 @@ set enable_seqscan=on;
|
||||
select rewrite('foo & bar & qq & new & york', 'new & york'::tsquery, 'big & apple | nyc | new & york & city');
|
||||
rewrite
|
||||
----------------------------------------------------------------------------------
|
||||
'qq' & 'foo' & 'bar' & ( 'city' & 'york' & 'new' | ( 'nyc' | 'apple' & 'big' ) )
|
||||
'foo' & 'bar' & 'qq' & ( 'city' & 'new' & 'york' | ( 'nyc' | 'big' & 'apple' ) )
|
||||
(1 row)
|
||||
|
||||
select rewrite('moscow', 'select keyword, sample from test_tsquery'::text );
|
||||
@ -463,31 +463,13 @@ select rewrite('moscow', 'select keyword, sample from test_tsquery'::text );
|
||||
select rewrite('moscow & hotel', 'select keyword, sample from test_tsquery'::text );
|
||||
rewrite
|
||||
-----------------------------------
|
||||
( 'moskva' | 'moscow' ) & 'hotel'
|
||||
'hotel' & ( 'moskva' | 'moscow' )
|
||||
(1 row)
|
||||
|
||||
select rewrite('bar & new & qq & foo & york', 'select keyword, sample from test_tsquery'::text );
|
||||
rewrite
|
||||
-------------------------------------------------------------------------------------
|
||||
'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY['moscow', keyword, sample] ) from test_tsquery;
|
||||
rewrite
|
||||
---------------------
|
||||
'moskva' | 'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY['moscow & hotel', keyword, sample] ) from test_tsquery;
|
||||
rewrite
|
||||
-----------------------------------
|
||||
( 'moskva' | 'moscow' ) & 'hotel'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY['bar & new & qq & foo & york', keyword, sample] ) from test_tsquery;
|
||||
rewrite
|
||||
-------------------------------------------------------------------------------------
|
||||
'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
|
||||
'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | ( 'big' & 'appl' | 'new' & 'york' ) )
|
||||
(1 row)
|
||||
|
||||
select keyword from test_tsquery where keyword @> 'new';
|
||||
@ -513,42 +495,6 @@ select keyword from test_tsquery where keyword <@ 'moscow';
|
||||
'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where keyword <@ query;
|
||||
rewrite
|
||||
---------------------
|
||||
'moskva' | 'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where keyword <@ query;
|
||||
rewrite
|
||||
-----------------------------------
|
||||
( 'moskva' | 'moscow' ) & 'hotel'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar & new & qq & foo & york') as query where keyword <@ query;
|
||||
rewrite
|
||||
-------------------------------------------------------------------------------------
|
||||
'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where query @> keyword;
|
||||
rewrite
|
||||
---------------------
|
||||
'moskva' | 'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where query @> keyword;
|
||||
rewrite
|
||||
-----------------------------------
|
||||
( 'moskva' | 'moscow' ) & 'hotel'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar & new & qq & foo & york') as query where query @> keyword;
|
||||
rewrite
|
||||
-------------------------------------------------------------------------------------
|
||||
'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
|
||||
(1 row)
|
||||
|
||||
create index qq on test_tsquery using gist (keyword gist_tp_tsquery_ops);
|
||||
set enable_seqscan='off';
|
||||
select keyword from test_tsquery where keyword @> 'new';
|
||||
@ -574,42 +520,6 @@ select keyword from test_tsquery where keyword <@ 'moscow';
|
||||
'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where keyword <@ query;
|
||||
rewrite
|
||||
---------------------
|
||||
'moskva' | 'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where keyword <@ query;
|
||||
rewrite
|
||||
-----------------------------------
|
||||
( 'moskva' | 'moscow' ) & 'hotel'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar & new & qq & foo & york') as query where keyword <@ query;
|
||||
rewrite
|
||||
-------------------------------------------------------------------------------------
|
||||
'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow') as query where query @> keyword;
|
||||
rewrite
|
||||
---------------------
|
||||
'moskva' | 'moscow'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'moscow & hotel') as query where query @> keyword;
|
||||
rewrite
|
||||
-----------------------------------
|
||||
( 'moskva' | 'moscow' ) & 'hotel'
|
||||
(1 row)
|
||||
|
||||
select rewrite( ARRAY[query, keyword, sample] ) from test_tsquery, to_tsquery('default', 'bar & new & qq & foo & york') as query where query @> keyword;
|
||||
rewrite
|
||||
-------------------------------------------------------------------------------------
|
||||
'citi' & 'foo' & ( 'qq' | 'bar' ) & ( 'nyc' | ( 'appl' & 'big' | 'york' & 'new' ) )
|
||||
(1 row)
|
||||
|
||||
set enable_seqscan='on';
|
||||
select lexize('simple', 'ASD56 hsdkf');
|
||||
lexize
|
||||
@ -617,38 +527,38 @@ select lexize('simple', 'ASD56 hsdkf');
|
||||
{"asd56 hsdkf"}
|
||||
(1 row)
|
||||
|
||||
select lexize('en_stem', 'SKIES Problems identity');
|
||||
select lexize('english_stem', 'SKIES Problems identity');
|
||||
lexize
|
||||
--------------------------
|
||||
{"skies problems ident"}
|
||||
(1 row)
|
||||
|
||||
select * from token_type('default');
|
||||
tokid | alias | descr
|
||||
-------+--------------+-----------------------------------
|
||||
1 | lword | Latin word
|
||||
2 | nlword | Non-latin word
|
||||
3 | word | Word
|
||||
4 | email | Email
|
||||
5 | url | URL
|
||||
6 | host | Host
|
||||
7 | sfloat | Scientific notation
|
||||
8 | version | VERSION
|
||||
9 | part_hword | Part of hyphenated word
|
||||
10 | nlpart_hword | Non-latin part of hyphenated word
|
||||
11 | lpart_hword | Latin part of hyphenated word
|
||||
12 | blank | Space symbols
|
||||
13 | tag | HTML Tag
|
||||
14 | protocol | Protocol head
|
||||
15 | hword | Hyphenated word
|
||||
16 | lhword | Latin hyphenated word
|
||||
17 | nlhword | Non-latin hyphenated word
|
||||
18 | uri | URI
|
||||
19 | file | File or path name
|
||||
20 | float | Decimal notation
|
||||
21 | int | Signed integer
|
||||
22 | uint | Unsigned integer
|
||||
23 | entity | HTML Entity
|
||||
tokid | alias | descr
|
||||
-------+-----------------+------------------------------------------
|
||||
1 | asciiword | Word, all ASCII
|
||||
2 | word | Word, all letters
|
||||
3 | numword | Word, letters and digits
|
||||
4 | email | Email address
|
||||
5 | url | URL
|
||||
6 | host | Host
|
||||
7 | sfloat | Scientific notation
|
||||
8 | version | Version number
|
||||
9 | hword_numpart | Hyphenated word part, letters and digits
|
||||
10 | hword_part | Hyphenated word part, all letters
|
||||
11 | hword_asciipart | Hyphenated word part, all ASCII
|
||||
12 | blank | Space symbols
|
||||
13 | tag | HTML tag
|
||||
14 | protocol | Protocol head
|
||||
15 | numhword | Hyphenated word, letters and digits
|
||||
16 | asciihword | Hyphenated word, all ASCII
|
||||
17 | hword | Hyphenated word, all letters
|
||||
18 | url_path | URL path
|
||||
19 | file | File or path name
|
||||
20 | float | Decimal notation
|
||||
21 | int | Signed integer
|
||||
22 | uint | Unsigned integer
|
||||
23 | entity | HTML entity
|
||||
(23 rows)
|
||||
|
||||
select * from 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 qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
|
||||
@ -768,15 +678,11 @@ select * from parse('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc
|
||||
12 | .
|
||||
20 | 4.2
|
||||
12 | ,
|
||||
15 | readline-4.2
|
||||
11 | readline
|
||||
12 | -
|
||||
20 | 4.2
|
||||
1 | readline
|
||||
20 | -4.2
|
||||
12 |
|
||||
15 | readline-4.2
|
||||
11 | readline
|
||||
12 | -
|
||||
20 | 4.2
|
||||
1 | readline
|
||||
20 | -4.2
|
||||
12 | .
|
||||
22 | 234
|
||||
12 |
|
||||
@ -793,23 +699,23 @@ select * from parse('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc
|
||||
12 |
|
||||
12 | <>
|
||||
1 | qwerty
|
||||
(135 rows)
|
||||
(131 rows)
|
||||
|
||||
SELECT to_tsvector('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 qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
|
||||
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 qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
|
||||
/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
|
||||
<i <b> wow < jqw <> qwerty');
|
||||
to_tsvector
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
'ad':17 'dw':19 'jf':39 '234':63 '345':1 '4.2':54,55,56,59,62 '455':31 'jqw':66 'qwe':2,18,27,28,35 'wer':36 'wow':65 'asdf':37 'ewr1':43 'qwer':38 'sdjk':40 '5.005':32 'efd.r':3 'ewri2':44 'hjwer':42 'qwqwe':29 'wefjn':48 'gist.c':52 'gist.h':50 'qwerti':67 '234.435':30 'qwe-wer':34 'readlin':53,58,61 'www.com':4 '+4.0e-10':26 'gist.h.c':51 'rewt/ewr':47 '/?ad=qwe&dw':7,10,14,22 '/wqe-324/ewr':49 'aew.werc.ewr':6 'readline-4.2':57,60 '1aew.werc.ewr':9 '2aew.werc.ewr':11 '3aew.werc.ewr':13 '4aew.werc.ewr':15 '/usr/local/fff':45 '/awdf/dwqe/4325':46 'teodor@stack.net':33 '/?ad=qwe&dw=%20%32':25 '5aew.werc.ewr:8100':16 '6aew.werc.ewr:8100':21 '7aew.werc.ewr:8100':24 'aew.werc.ewr/?ad=qwe&dw':5 '1aew.werc.ewr/?ad=qwe&dw':8 '3aew.werc.ewr/?ad=qwe&dw':12 '6aew.werc.ewr:8100/?ad=qwe&dw':20 '7aew.werc.ewr:8100/?ad=qwe&dw=%20%32':23
|
||||
to_tsvector
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
'ad':17 'dw':19 'jf':39 '234':61 '345':1 '4.2':54,55,56 '455':31 'jqw':64 'qwe':2,18,27,28,35 'wer':36 'wow':63 '-4.2':58,60 'asdf':37 'ewr1':43 'qwer':38 'sdjk':40 '5.005':32 'efd.r':3 'ewri2':44 'hjwer':42 'qwqwe':29 'wefjn':48 'gist.c':52 'gist.h':50 'qwerti':65 '234.435':30 'qwe-wer':34 'readlin':53,57,59 'www.com':4 '+4.0e-10':26 'gist.h.c':51 'rewt/ewr':47 '/?ad=qwe&dw':7,10,14,22 '/wqe-324/ewr':49 'aew.werc.ewr':6 '1aew.werc.ewr':9 '2aew.werc.ewr':11 '3aew.werc.ewr':13 '4aew.werc.ewr':15 '/usr/local/fff':45 '/awdf/dwqe/4325':46 'teodor@stack.net':33 '/?ad=qwe&dw=%20%32':25 '5aew.werc.ewr:8100':16 '6aew.werc.ewr:8100':21 '7aew.werc.ewr:8100':24 'aew.werc.ewr/?ad=qwe&dw':5 '1aew.werc.ewr/?ad=qwe&dw':8 '3aew.werc.ewr/?ad=qwe&dw':12 '6aew.werc.ewr:8100/?ad=qwe&dw':20 '7aew.werc.ewr:8100/?ad=qwe&dw=%20%32':23
|
||||
(1 row)
|
||||
|
||||
SELECT length(to_tsvector('default', '345 qw'));
|
||||
SELECT length(to_tsvector('english', '345 qw'));
|
||||
length
|
||||
--------
|
||||
2
|
||||
(1 row)
|
||||
|
||||
SELECT length(to_tsvector('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 qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
|
||||
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 qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
|
||||
/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
|
||||
<i <b> wow < jqw <> qwerty'));
|
||||
length
|
||||
@ -817,7 +723,7 @@ SELECT length(to_tsvector('default', '345 qwe@efd.r '' http://www.com/ http://ae
|
||||
51
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', 'qwe & sKies ');
|
||||
select to_tsquery('english', 'qwe & sKies ');
|
||||
to_tsquery
|
||||
---------------
|
||||
'qwe' & 'sky'
|
||||
@ -829,61 +735,61 @@ select to_tsquery('simple', 'qwe & sKies ');
|
||||
'qwe' & 'skies'
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', '''the wether'':dc & '' sKies '':BC ');
|
||||
select to_tsquery('english', '''the wether'':dc & '' sKies '':BC ');
|
||||
to_tsquery
|
||||
------------------------
|
||||
'wether':CD & 'sky':BC
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', 'asd&(and|fghj)');
|
||||
select to_tsquery('english', 'asd&(and|fghj)');
|
||||
to_tsquery
|
||||
----------------
|
||||
'asd' & 'fghj'
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', '(asd&and)|fghj');
|
||||
select to_tsquery('english', '(asd&and)|fghj');
|
||||
to_tsquery
|
||||
----------------
|
||||
'asd' | 'fghj'
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', '(asd&!and)|fghj');
|
||||
select to_tsquery('english', '(asd&!and)|fghj');
|
||||
to_tsquery
|
||||
----------------
|
||||
'asd' | 'fghj'
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', '(the|and&(i&1))&fghj');
|
||||
select to_tsquery('english', '(the|and&(i&1))&fghj');
|
||||
to_tsquery
|
||||
--------------
|
||||
'1' & 'fghj'
|
||||
(1 row)
|
||||
|
||||
select plainto_tsquery('default', 'the and z 1))& fghj');
|
||||
select plainto_tsquery('english', 'the and z 1))& fghj');
|
||||
plainto_tsquery
|
||||
--------------------
|
||||
'z' & '1' & 'fghj'
|
||||
(1 row)
|
||||
|
||||
select plainto_tsquery('default', 'foo bar') && plainto_tsquery('default', 'asd');
|
||||
select plainto_tsquery('english', 'foo bar') && plainto_tsquery('english', 'asd');
|
||||
?column?
|
||||
-----------------------
|
||||
'foo' & 'bar' & 'asd'
|
||||
(1 row)
|
||||
|
||||
select plainto_tsquery('default', 'foo bar') || plainto_tsquery('default', 'asd fg');
|
||||
select plainto_tsquery('english', 'foo bar') || plainto_tsquery('english', 'asd fg');
|
||||
?column?
|
||||
------------------------------
|
||||
'foo' & 'bar' | 'asd' & 'fg'
|
||||
(1 row)
|
||||
|
||||
select plainto_tsquery('default', 'foo bar') || !!plainto_tsquery('default', 'asd fg');
|
||||
select plainto_tsquery('english', 'foo bar') || !!plainto_tsquery('english', 'asd fg');
|
||||
?column?
|
||||
-----------------------------------
|
||||
'foo' & 'bar' | !( 'asd' & 'fg' )
|
||||
(1 row)
|
||||
|
||||
select plainto_tsquery('default', 'foo bar') && 'asd | fg';
|
||||
select plainto_tsquery('english', 'foo bar') && 'asd | fg';
|
||||
?column?
|
||||
----------------------------------
|
||||
'foo' & 'bar' & ( 'asd' | 'fg' )
|
||||
@ -995,7 +901,7 @@ SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
|
||||
39
|
||||
(1 row)
|
||||
|
||||
select set_curcfg('default');
|
||||
select set_curcfg('english');
|
||||
set_curcfg
|
||||
------------
|
||||
|
||||
@ -1024,11 +930,7 @@ SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
|
||||
0
|
||||
(1 row)
|
||||
|
||||
drop trigger tsvectorupdate on test_tsvector;
|
||||
create function wow(text) returns text as 'select $1 || '' copyright''; ' language sql;
|
||||
create trigger tsvectorupdate before update or insert on test_tsvector
|
||||
for each row execute procedure tsearch2(a, wow, t);
|
||||
insert into test_tsvector (t) values ('345 qwerty');
|
||||
insert into test_tsvector (t) values ('345 qwerty copyright');
|
||||
select count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
|
||||
count
|
||||
-------
|
||||
@ -2135,7 +2037,6 @@ select * from stat('select a from test_tsvector') order by ndoc desc, nentry des
|
||||
8w | 2 | 2
|
||||
9f | 2 | 2
|
||||
9y | 2 | 2
|
||||
copyright | 2 | 2
|
||||
foo | 1 | 3
|
||||
bar | 1 | 2
|
||||
0e | 1 | 1
|
||||
@ -2227,6 +2128,7 @@ select * from stat('select a from test_tsvector') order by ndoc desc, nentry des
|
||||
9h | 1 | 1
|
||||
9r | 1 | 1
|
||||
9w | 1 | 1
|
||||
copyright | 1 | 1
|
||||
qwerti | 1 | 1
|
||||
(1146 rows)
|
||||
|
||||
@ -2257,11 +2159,11 @@ select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry
|
||||
word | ndoc | nentry
|
||||
-----------+------+--------
|
||||
a | 2 | 2
|
||||
copyright | 2 | 2
|
||||
foo | 1 | 3
|
||||
bar | 1 | 2
|
||||
345 | 1 | 1
|
||||
b | 1 | 1
|
||||
copyright | 1 | 1
|
||||
qq | 1 | 1
|
||||
qwerti | 1 | 1
|
||||
(8 rows)
|
||||
@ -2271,22 +2173,15 @@ select * from stat('select a from test_tsvector','ad') order by ndoc desc, nentr
|
||||
-----------+------+--------
|
||||
a | 2 | 4
|
||||
b | 2 | 4
|
||||
copyright | 2 | 2
|
||||
foo | 1 | 3
|
||||
bar | 1 | 2
|
||||
345 | 1 | 1
|
||||
copyright | 1 | 1
|
||||
qq | 1 | 1
|
||||
qwerti | 1 | 1
|
||||
(8 rows)
|
||||
|
||||
select reset_tsearch();
|
||||
NOTICE: TSearch cache cleaned
|
||||
reset_tsearch
|
||||
---------------
|
||||
|
||||
(1 row)
|
||||
|
||||
select to_tsquery('default', 'skies & books');
|
||||
select to_tsquery('english', 'skies & books');
|
||||
to_tsquery
|
||||
----------------
|
||||
'sky' & 'book'
|
||||
@ -2334,48 +2229,6 @@ Upon a woman s face. E. J. Pratt (1882 1964)
|
||||
0.2
|
||||
(1 row)
|
||||
|
||||
select get_covers(to_tsvector('Erosion It took the sea a thousand years,
|
||||
A thousand years to trace
|
||||
The granite features of this cliff
|
||||
In crag and scarp and base.
|
||||
It took the sea an hour one night
|
||||
An hour of storm to place
|
||||
The sculpture of these granite seams,
|
||||
Upon a woman s face. E. J. Pratt (1882 1964)
|
||||
'), to_tsquery('sea&thousand&years'));
|
||||
get_covers
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
eros took {1 sea thousand year }1 {2 thousand year trace granit featur cliff crag scarp base took sea }2 hour one night hour storm place sculptur granit seam upon woman face e j pratt 1882 1964
|
||||
(1 row)
|
||||
|
||||
select get_covers(to_tsvector('Erosion It took the sea a thousand years,
|
||||
A thousand years to trace
|
||||
The granite features of this cliff
|
||||
In crag and scarp and base.
|
||||
It took the sea an hour one night
|
||||
An hour of storm to place
|
||||
The sculpture of these granite seams,
|
||||
Upon a woman s face. E. J. Pratt (1882 1964)
|
||||
'), to_tsquery('granite&sea'));
|
||||
get_covers
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
eros took {1 sea thousand year thousand year trace {2 granit }1 featur cliff crag scarp base took {3 sea }2 hour one night hour storm place sculptur granit }3 seam upon woman face e j pratt 1882 1964
|
||||
(1 row)
|
||||
|
||||
select get_covers(to_tsvector('Erosion It took the sea a thousand years,
|
||||
A thousand years to trace
|
||||
The granite features of this cliff
|
||||
In crag and scarp and base.
|
||||
It took the sea an hour one night
|
||||
An hour of storm to place
|
||||
The sculpture of these granite seams,
|
||||
Upon a woman s face. E. J. Pratt (1882 1964)
|
||||
'), to_tsquery('sea'));
|
||||
get_covers
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
eros took {1 sea }1 thousand year thousand year trace granit featur cliff crag scarp base took {2 sea }2 hour one night hour storm place sculptur granit seam upon woman face e j pratt 1882 1964
|
||||
(1 row)
|
||||
|
||||
select headline('Erosion It took the sea a thousand years,
|
||||
A thousand years to trace
|
||||
The granite features of this cliff
|
||||
@ -2456,15 +2309,19 @@ to_tsquery('sea&foo'), 'HighlightAll=true');
|
||||
(1 row)
|
||||
|
||||
--check debug
|
||||
select * from ts_debug('Tsearch module for PostgreSQL 7.3.3');
|
||||
ts_name | tok_type | description | token | dict_name | tsvector
|
||||
---------+----------+-------------+------------+-----------+--------------
|
||||
default | lword | Latin word | Tsearch | {en_stem} | 'tsearch'
|
||||
default | lword | Latin word | module | {en_stem} | 'modul'
|
||||
default | lword | Latin word | for | {en_stem} |
|
||||
default | lword | Latin word | PostgreSQL | {en_stem} | 'postgresql'
|
||||
default | version | VERSION | 7.3.3 | {simple} | '7.3.3'
|
||||
(5 rows)
|
||||
select * from public.ts_debug('Tsearch module for PostgreSQL 7.3.3');
|
||||
ts_name | tok_type | description | token | dict_name | tsvector
|
||||
---------+-----------+-----------------+------------+----------------+--------------
|
||||
english | asciiword | Word, all ASCII | Tsearch | {english_stem} | 'tsearch'
|
||||
english | blank | Space symbols | | {} |
|
||||
english | asciiword | Word, all ASCII | module | {english_stem} | 'modul'
|
||||
english | blank | Space symbols | | {} |
|
||||
english | asciiword | Word, all ASCII | for | {english_stem} |
|
||||
english | blank | Space symbols | | {} |
|
||||
english | asciiword | Word, all ASCII | PostgreSQL | {english_stem} | 'postgresql'
|
||||
english | blank | Space symbols | | {} |
|
||||
english | version | Version number | 7.3.3 | {simple} | '7.3.3'
|
||||
(9 rows)
|
||||
|
||||
--check ordering
|
||||
insert into test_tsvector values (null, null);
|
||||
@ -2480,10 +2337,10 @@ select a is null, a from test_tsvector order by a;
|
||||
f |
|
||||
f |
|
||||
f |
|
||||
f | '345':1 'qwerti':2 'copyright':3
|
||||
f | 'qq':7 'bar':2,8 'foo':1,3,6 'copyright':9
|
||||
f | 'a':1A,2,3B 'b':5A,6A,7C,8
|
||||
f | 'a':1A,2,3C 'b':5A,6B,7C,8B
|
||||
f | 'qq':7 'bar':2,8 'foo':1,3,6
|
||||
f | '345':1 'qwerti':2 'copyright':3
|
||||
f | '7w' 'ch' 'd7' 'eo' 'gw' 'i4' 'lq' 'o6' 'qt' 'y0'
|
||||
f | 'ar' 'ei' 'kq' 'ma' 'qa' 'qh' 'qq' 'qz' 'rx' 'st'
|
||||
f | 'gs' 'i6' 'i9' 'j2' 'l0' 'oq' 'qx' 'sc' 'xe' 'yu'
|
||||
|
Reference in New Issue
Block a user