clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 497144 fiddles created (9372 in the last week).

-- without dedicated schema; not allowed in the fiddle CREATE TEXT SEARCH DICTIONARY english_simple_dict ( TEMPLATE = pg_catalog.simple , STOPWORDS = english ); CREATE TEXT SEARCH CONFIGURATION english_simple (COPY = simple); ALTER TEXT SEARCH CONFIGURATION english_simple ALTER MAPPING FOR asciiword WITH english_simple_dict; -- 1, 'Word, all ASCII'
 hidden batch(es)


CREATE TABLE item (item_id serial PRIMARY KEY, title text NOT NULL); INSERT INTO item(title) VALUES ('This is a title') , ('This is another title and I don''t like Mondays') , ('This is finally a 3rd title, with number 33 and wörd_with_umlaut at user@gmail.com or dba.stackexchange.com');
3 rows affected
 hidden batch(es)


SELECT * FROM ts_stat($$SELECT to_tsvector('english_simple', title) FROM item$$) ORDER BY ndoc DESC LIMIT 50;
word ndoc nentry
title 3 3
user@gmail.com 1 1
umlaut 1 1
number 1 1
mondays 1 1
like 1 1
finally 1 1
dba.stackexchange.com 1 1
another 1 1
3rd 1 1
wörd 1 1
33 1 1
 hidden batch(es)


-- Evan's query SELECT token, count(*) FROM item, ts_debug(title) WHERE alias = 'asciiword' AND cardinality(lexemes) > 0 GROUP BY 1 ORDER BY 2 DESC;
token count
title 3
finally 1
like 1
another 1
number 1
umlaut 1
Mondays 1
 hidden batch(es)


SELECT * FROM ts_token_type('default');
tokid alias description
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 XML 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 XML entity
 hidden batch(es)


SELECT tt.*, m.mapdict::regdictionary AS dictionary FROM pg_ts_config_map m LEFT JOIN ts_token_type(3722) tt ON tt.tokid = m.maptokentype WHERE mapcfg = 'english_simple'::regconfig -- 'english'::regconfig ORDER BY tt.tokid;
tokid alias description dictionary
1 asciiword Word, all ASCII english_simple_dict
2 word Word, all letters simple
3 numword Word, letters and digits simple
4 email Email address simple
5 url URL simple
6 host Host simple
7 sfloat Scientific notation simple
8 version Version number simple
9 hword_numpart Hyphenated word part, letters and digits simple
10 hword_part Hyphenated word part, all letters simple
11 hword_asciipart Hyphenated word part, all ASCII simple
15 numhword Hyphenated word, letters and digits simple
16 asciihword Hyphenated word, all ASCII simple
17 hword Hyphenated word, all letters simple
18 url_path URL path simple
19 file File or path name simple
20 float Decimal notation simple
21 int Signed integer simple
22 uint Unsigned integer simple
 hidden batch(es)