12.12. Migration from Pre-8.3 Text Search
Applications that use the tsearch2 module for text searching will need some adjustments to work with the built-in features:
Some functions have been renamed or had small adjustments in their argument lists, and all of them are now in the
pg_catalog
schema, whereas in a previous installation they would have been inpublic
or another non-system schema. There is a new version of tsearch2 that provides a compatibility layer to solve most problems in this area.The old tsearch2 functions and other objects must be suppressed when loading pg_dump output from a pre-8.3 database. While many of them won't load anyway, a few will and then cause problems. One simple way to deal with this is to load the new tsearch2 module before restoring the dump; then it will block the old objects from being loaded.
Text search configuration setup is completely different now. Instead of manually inserting rows into configuration tables, search is configured through the specialized SQL commands shown earlier in this chapter. There is no automated support for converting an existing custom configuration for 8.3; you're on your own here.
Most types of dictionaries rely on some outside-the-database configuration files. These are largely compatible with pre-8.3 usage, but note the following differences:
Configuration files now must be placed in a single specified directory (
$SHAREDIR/tsearch_data
), and must have a specific extension depending on the type of file, as noted previously in the descriptions of the various dictionary types. This restriction was added to forestall security problems.Configuration files must be encoded in UTF-8 encoding, regardless of what database encoding is used.
In thesaurus configuration files, stop words must be marked with
?
.