Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / test / regress / expected / tsdicts.out
blob3ae6a671dad4dd63deda69b4a41436ba92543aed
1 --Test text search dictionaries and configurations
2 -- Test ISpell dictionary with ispell affix file
3 CREATE TEXT SEARCH DICTIONARY ispell (
4                         Template=ispell,
5                         DictFile=ispell_sample,
6                         AffFile=ispell_sample
7 );
8 SELECT ts_lexize('ispell', 'skies');
9  ts_lexize 
10 -----------
11  {sky}
12 (1 row)
14 SELECT ts_lexize('ispell', 'bookings');
15    ts_lexize    
16 ----------------
17  {booking,book}
18 (1 row)
20 SELECT ts_lexize('ispell', 'booking');
21    ts_lexize    
22 ----------------
23  {booking,book}
24 (1 row)
26 SELECT ts_lexize('ispell', 'foot');
27  ts_lexize 
28 -----------
29  {foot}
30 (1 row)
32 SELECT ts_lexize('ispell', 'foots');
33  ts_lexize 
34 -----------
35  {foot}
36 (1 row)
38 SELECT ts_lexize('ispell', 'rebookings');
39    ts_lexize    
40 ----------------
41  {booking,book}
42 (1 row)
44 SELECT ts_lexize('ispell', 'rebooking');
45    ts_lexize    
46 ----------------
47  {booking,book}
48 (1 row)
50 SELECT ts_lexize('ispell', 'rebook');
51  ts_lexize 
52 -----------
54 (1 row)
56 SELECT ts_lexize('ispell', 'unbookings');
57  ts_lexize 
58 -----------
59  {book}
60 (1 row)
62 SELECT ts_lexize('ispell', 'unbooking');
63  ts_lexize 
64 -----------
65  {book}
66 (1 row)
68 SELECT ts_lexize('ispell', 'unbook');
69  ts_lexize 
70 -----------
71  {book}
72 (1 row)
74 SELECT ts_lexize('ispell', 'footklubber');
75    ts_lexize    
76 ----------------
77  {foot,klubber}
78 (1 row)
80 SELECT ts_lexize('ispell', 'footballklubber');
81                       ts_lexize                       
82 ------------------------------------------------------
83  {footballklubber,foot,ball,klubber,football,klubber}
84 (1 row)
86 SELECT ts_lexize('ispell', 'ballyklubber');
87    ts_lexize    
88 ----------------
89  {ball,klubber}
90 (1 row)
92 SELECT ts_lexize('ispell', 'footballyklubber');
93       ts_lexize      
94 ---------------------
95  {foot,ball,klubber}
96 (1 row)
98 -- Test ISpell dictionary with hunspell affix file
99 CREATE TEXT SEARCH DICTIONARY hunspell (
100                         Template=ispell,
101                         DictFile=ispell_sample,
102                         AffFile=hunspell_sample
104 SELECT ts_lexize('hunspell', 'skies');
105  ts_lexize 
106 -----------
107  {sky}
108 (1 row)
110 SELECT ts_lexize('hunspell', 'bookings');
111    ts_lexize    
112 ----------------
113  {booking,book}
114 (1 row)
116 SELECT ts_lexize('hunspell', 'booking');
117    ts_lexize    
118 ----------------
119  {booking,book}
120 (1 row)
122 SELECT ts_lexize('hunspell', 'foot');
123  ts_lexize 
124 -----------
125  {foot}
126 (1 row)
128 SELECT ts_lexize('hunspell', 'foots');
129  ts_lexize 
130 -----------
131  {foot}
132 (1 row)
134 SELECT ts_lexize('hunspell', 'rebookings');
135    ts_lexize    
136 ----------------
137  {booking,book}
138 (1 row)
140 SELECT ts_lexize('hunspell', 'rebooking');
141    ts_lexize    
142 ----------------
143  {booking,book}
144 (1 row)
146 SELECT ts_lexize('hunspell', 'rebook');
147  ts_lexize 
148 -----------
150 (1 row)
152 SELECT ts_lexize('hunspell', 'unbookings');
153  ts_lexize 
154 -----------
155  {book}
156 (1 row)
158 SELECT ts_lexize('hunspell', 'unbooking');
159  ts_lexize 
160 -----------
161  {book}
162 (1 row)
164 SELECT ts_lexize('hunspell', 'unbook');
165  ts_lexize 
166 -----------
167  {book}
168 (1 row)
170 SELECT ts_lexize('hunspell', 'footklubber');
171    ts_lexize    
172 ----------------
173  {foot,klubber}
174 (1 row)
176 SELECT ts_lexize('hunspell', 'footballklubber');
177                       ts_lexize                       
178 ------------------------------------------------------
179  {footballklubber,foot,ball,klubber,football,klubber}
180 (1 row)
182 SELECT ts_lexize('hunspell', 'ballyklubber');
183    ts_lexize    
184 ----------------
185  {ball,klubber}
186 (1 row)
188 SELECT ts_lexize('hunspell', 'footballyklubber');
189       ts_lexize      
190 ---------------------
191  {foot,ball,klubber}
192 (1 row)
194 -- Synonim dictionary
195 CREATE TEXT SEARCH DICTIONARY synonym (
196                                                 Template=synonym, 
197                                                 Synonyms=synonym_sample
199 SELECT ts_lexize('synonym', 'PoStGrEs');
200  ts_lexize 
201 -----------
202  {pgsql}
203 (1 row)
205 SELECT ts_lexize('synonym', 'Gogle');
206  ts_lexize 
207 -----------
208  {googl}
209 (1 row)
211 -- Create and simple test thesaurus dictionary
212 -- More tests in configuration checks because ts_lexize()
213 -- cannot pass more than one word to thesaurus.
214 CREATE TEXT SEARCH DICTIONARY thesaurus (
215                         Template=thesaurus,
216                                                 DictFile=thesaurus_sample, 
217                                                 Dictionary=english_stem
219 SELECT ts_lexize('thesaurus', 'one');
220  ts_lexize 
221 -----------
222  {1}
223 (1 row)
225 -- Test ispell dictionary in configuration
226 CREATE TEXT SEARCH CONFIGURATION ispell_tst (
227                                                 COPY=english
229 ALTER TEXT SEARCH CONFIGURATION ispell_tst ALTER MAPPING FOR
230         word, numword, asciiword, hword, numhword, asciihword, hword_part, hword_numpart, hword_asciipart
231         WITH ispell, english_stem;
232 SELECT to_tsvector('ispell_tst', 'Booking the skies after rebookings for footballklubber from a foot');
233                                             to_tsvector                                             
234 ----------------------------------------------------------------------------------------------------
235  'ball':7 'book':1,5 'booking':1,5 'foot':7,10 'football':7 'footballklubber':7 'klubber':7 'sky':3
236 (1 row)
238 SELECT to_tsquery('ispell_tst', 'footballklubber');
239                                   to_tsquery                                  
240 ------------------------------------------------------------------------------
241  ( 'footballklubber' | 'foot' & 'ball' & 'klubber' ) | 'football' & 'klubber'
242 (1 row)
244 SELECT to_tsquery('ispell_tst', 'footballyklubber:b & rebookings:A & sky');
245                                to_tsquery                               
246 ------------------------------------------------------------------------
247  'foot':B & 'ball':B & 'klubber':B & ( 'booking':A | 'book':A ) & 'sky'
248 (1 row)
250 -- Test ispell dictionary with hunspell affix in configuration
251 CREATE TEXT SEARCH CONFIGURATION hunspell_tst (
252                                                 COPY=ispell_tst
254 ALTER TEXT SEARCH CONFIGURATION hunspell_tst ALTER MAPPING
255         REPLACE ispell WITH hunspell;
256 SELECT to_tsvector('hunspell_tst', 'Booking the skies after rebookings for footballklubber from a foot');
257                                             to_tsvector                                             
258 ----------------------------------------------------------------------------------------------------
259  'ball':7 'book':1,5 'booking':1,5 'foot':7,10 'football':7 'footballklubber':7 'klubber':7 'sky':3
260 (1 row)
262 SELECT to_tsquery('hunspell_tst', 'footballklubber');
263                                   to_tsquery                                  
264 ------------------------------------------------------------------------------
265  ( 'footballklubber' | 'foot' & 'ball' & 'klubber' ) | 'football' & 'klubber'
266 (1 row)
268 SELECT to_tsquery('hunspell_tst', 'footballyklubber:b & rebookings:A & sky');
269                                to_tsquery                               
270 ------------------------------------------------------------------------
271  'foot':B & 'ball':B & 'klubber':B & ( 'booking':A | 'book':A ) & 'sky'
272 (1 row)
274 -- Test synonym dictionary in configuration
275 CREATE TEXT SEARCH CONFIGURATION synonym_tst (
276                                                 COPY=english
278 ALTER TEXT SEARCH CONFIGURATION synonym_tst ALTER MAPPING FOR 
279         asciiword, hword_asciipart, asciihword 
280         WITH synonym, english_stem;
281 SELECT to_tsvector('synonym_tst', 'Postgresql is often called as postgres or pgsql and pronounced as postgre');
282                     to_tsvector                    
283 ---------------------------------------------------
284  'call':4 'often':3 'pgsql':1,6,8,12 'pronounc':10
285 (1 row)
287 SELECT to_tsvector('synonym_tst', 'Most common mistake is to write Gogle instead of Google');
288                        to_tsvector                        
289 ----------------------------------------------------------
290  'common':2 'googl':7,10 'instead':8 'mistak':3 'write':6
291 (1 row)
293 -- test thesaurus in configuration
294 -- see thesaurus_sample.ths to understand 'odd' resulting tsvector
295 CREATE TEXT SEARCH CONFIGURATION thesaurus_tst (
296                                                 COPY=synonym_tst
298 ALTER TEXT SEARCH CONFIGURATION thesaurus_tst ALTER MAPPING FOR 
299         asciiword, hword_asciipart, asciihword 
300         WITH synonym, thesaurus, english_stem;
301 SELECT to_tsvector('thesaurus_tst', 'one postgres one two one two three one');
302            to_tsvector            
303 ----------------------------------
304  '1':1,5 '12':3 '123':4 'pgsql':2
305 (1 row)
307 SELECT to_tsvector('thesaurus_tst', 'Supernovae star is very new star and usually called supernovae (abbrevation SN)');
308                          to_tsvector                         
309 -------------------------------------------------------------
310  'abbrev':10 'call':8 'new':4 'sn':1,9,11 'star':5 'usual':7
311 (1 row)
313 SELECT to_tsvector('thesaurus_tst', 'Booking tickets is looking like a booking a tickets');
314                       to_tsvector                      
315 -------------------------------------------------------
316  'card':3,10 'invit':2,9 'like':6 'look':5 'order':1,8
317 (1 row)