view · edit · sidebar · attach · print · history

Setup

Please locate source files from /var/www/oddb.org/ext/fulltext/data/dicts/{german|french}/xxx inte following locations.
And check file permission.

  • /usr/share/postgresql/tsearch_data/german_fulltext.dict
  • /usr/share/postgresql/tsearch_data/german_fulltext.affix
  • /usr/share/postgresql/tsearch_data/german_fulltext.stop
  • /usr/share/postgresql/tsearch_data/french_fulltext.dict
  • /usr/share/postgresql/tsearch_data/french_fulltext.affix
  • /usr/share/postgresql/tsearch_data/french_fulltext.stop

Build Dictionary

via ODBA

Please implement command for these dictionary creation methods.

ODBA.storage.remove_dictionary('german')
ODBA.storage.remove_dictionary('french')
ODBA.storage.generate_dictionary('german')
ODBA.storage.generate_dictionary('french')

see methods.

ODBA::Storage#remove_dictionary(language)
ODBA::Storage#generate_dictionary(language, data_path='/usr/share/postgresql/tsearch_data/', file='fulltext')
ODBA::Storage#create_dictionary_map(language)

in oddb.org

In oddb.org, Please run this command via bin/admin.

ch.oddb> generate_dictionaries

SQL

Or please create dictionaries with SQL, directly. like this.

z.B. default_german

# load extension
CREATE EXTENSION tsearch2;

# add permission
GRANT ALL ON pg_ts_config to USER_NAME;
GRANT ALL ON pg_ts_config_map to USER_NAME;
GRANT ALL ON pg_ts_dict to USER_NAME;
GRANT ALL ON pg_ts_parser to USER_NAME;

# create configuration
CREATE TEXT SEARCH CONFIGURATION public.default_german ( COPY = pg_catalog.german );

# create ispell dictionary (with above source files)
CREATE TEXT SEARCH DICTIONARY german_ispell (
  TEMPLATE  = ispell,
  DictFile  = german_fulltext,
  AffFile   = german_fulltext,
  StopWords = german_fulltext
);

# setup tokens with ispell and stem dictionaries.
ALTER TEXT SEARCH CONFIGURATION default_german
ALTER MAPPING FOR
  asciiword, asciihword, hword_asciipart,
  word, hword, hword_part, hword_numpart,
  numword, numhword
WITH german_ispell, german_stem;

# setup some tokens with simple dictionary.
ALTER TEXT SEARCH CONFIGURATION default_german
ALTER MAPPING FOR
  host, file, int, uint, version
WITH simple;

# drop some tokens from default setting
ALTER TEXT SEARCH CONFIGURATION default_german
DROP MAPPING FOR
  email, url, url_path, sfloat, float;

Then please make sure dictionary configuration with ts_debug() like this.

db=# select * from ts_debug('default_german', 'En Güte zu Hause! Guten Appetit in die Schule');
   alias   |    description    |  token  |        dictionaries         |  dictionary   |     lexemes      
-----------+-------------------+---------+-----------------------------+---------------+------------------
 asciiword | Word, all ASCII   | En      | {german_ispell,german_stem} | german_stem   | {en}
 blank     | Space symbols     |         | {}                          |               | 
 word      | Word, all letters | Güte    | {german_ispell,german_stem} | german_stem   | {gut}
 blank     | Space symbols     |         | {}                          |               | 
 asciiword | Word, all ASCII   | zu      | {german_ispell,german_stem} | german_ispell | {}
 blank     | Space symbols     |         | {}                          |               | 
 asciiword | Word, all ASCII   | Hause   | {german_ispell,german_stem} | german_ispell | {hausen,hau,sen}
 blank     | Space symbols     | !       | {}                          |               | 
 asciiword | Word, all ASCII   | Guten   | {german_ispell,german_stem} | german_ispell | {gut}
 blank     | Space symbols     |         | {}                          |               | 
 asciiword | Word, all ASCII   | Appetit | {german_ispell,german_stem} | german_ispell | {appetit}
 blank     | Space symbols     |         | {}                          |               | 
 asciiword | Word, all ASCII   | in      | {german_ispell,german_stem} | german_ispell | {}
 blank     | Space symbols     |         | {}                          |               | 
 asciiword | Word, all ASCII   | die     | {german_ispell,german_stem} | german_ispell | {}
 blank     | Space symbols     |         | {}                          |               | 
 asciiword | Word, all ASCII   | Schule  | {german_ispell,german_stem} | german_ispell | {schule,schulen}
(17 rows)
view · edit · sidebar · attach · print · history
Page last modified on December 12, 2017, at 01:30 PM