IntDict - tsearch2 dictionary for integers. Motivation for this dictionary is to control indexing of integers (signed and unsigned), and, consequently, to minimize the number of unique words, which, in turn, greatly affects to performance of searching. Notes about developing this dictionary using dictionary template generator (Gendict) are available from http://www.sai.msu.su/~megera/wiki/Gendict Dictionary accepts two init options: * MAXLEN parameter specifies maximum length of the number considered as a 'good' integer. Default value is 6. * REJECTLONG parameter specifies if 'long' integer should be indexed or treated as stop word. o If REJECTLONG=false (default), than dictionary returns prefixed part of integer number with length MAXLEN. o If REJECTLONG=true, than dictionary consider integer as a stop word. Examples: * 12345678902132435454 - 'garbage' * 123456 - 'good' integer number suitable for indexing Usage: 1. Compile and install 2. Load dictionary ( assume tsearch2 is already loaded) psql qq < dict_intdict.sql 3. Test it qq=# select dict_name, dict_initoption from pg_ts_dict where dict_name='intdict'; dict_name | dict_initoption -----------+--------------------------- intdict | MAXLEN=6,REJECTLONG=false qq=# select lexize('intdict','12345678'); lexize ---------- {123456} qq=# select lexize('intdict','123'); lexize -------- {123} 4. Specify intdict dictionary to process int and uint tokens ( for simplicity, I did that for all configurations) qq=# select * from pg_ts_cfgmap where tok_alias ~ 'int'; ts_name | tok_alias | dict_name -----------------+-----------+----------- default | int | {simple} default | uint | {simple} default_russian | int | {simple} default_russian | uint | {simple} simple | int | {simple} simple | uint | {simple} qq=# update pg_ts_cfgmap set dict_name='{intdict}' where tok_alias ~ 'int'; UPDATE 6 qq=# select * from pg_ts_cfgmap where tok_alias ~ 'int'; ts_name | tok_alias | dict_name -----------------+-----------+----------- default | int | {intdict} default | uint | {intdict} default_russian | int | {intdict} default_russian | uint | {intdict} simple | int | {intdict} simple | uint | {intdict} That's all.