Skip to content

allow user defined text search config in database

In PostgreSQL, default_text_search_config can be specified globally or per database (or per session which is not useful here), so that it does not need to be specified in every query or function. However, Pleroma currently hardcoded english in search queries, which is not only redundant, but also makes it impossible to specify a different config for non-English instances.

This MR did a few things:

  • removed hardcoded text search config from code
  • added a default config of english at database level in migration script so no impact for existing instances
  • changed option RUM migration scripts so that instance turning ON RUM will not have hardcoded config in trigger to begin with
  • added docs/configuration/howto_search_cjk.md for CJK instances
  • added mix task mix pleroma.database set_text_search_config MY.LANG

Migration

see docs/configuration/howto_search_cjk.md

Notes for Pleroma developers

When modifying or adding full text index in future migration scripts like:

CREATE INDEX objects_fts ON objects USING gin(to_tsvector('english', data->>'content'));

You will have to pull the setting from SHOW default_text_search_config; in your migration script, use that to replace 'english'.

Edited by shevek

Merge request reports