From 1ce5f0a920584e8681caa2c51011e72ac9c6299f Mon Sep 17 00:00:00 2001 From: itepechi <72330683+itepechi@users.noreply.github.com> Date: Sun, 6 Aug 2023 08:08:56 +0900 Subject: [PATCH] Add a guide to customize the behavior of PGroonga --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index a77aca475..57fcb3ffc 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,41 @@ podman restart akkoma-web You can revert the applied changes at any time by replacing `migrate` with `rollback`. +#### Change PGroonga indexing options + +By default, PGroonga uses a bigram tokenizer with prefix matching enabled. + +If you're not happy with this, you can change the behavior using the `database set_pgroonga_options` command. + +If you want to support Japanese in your instance and do not want to match "東京都" (Tokyo-to) with "京都" (Kyoto), pass `TokenMecab` as the tokenizer. + +```sh +podman exec -it akkoma-web \ + pleroma_ctl \ + database \ + set_pgroonga_options "tokenizer='TokenMecab'" +``` + +If you want to disable prefix matching, e.g. you want "akko" to match "Akko is cute!" but not "Akkoma is cool!", pass `hash_table` as the lexicon type. + +```sh +podman exec -it akkoma-web \ + pleroma_ctl \ + database \ + set_pgroonga_options "lexicon_type='hash_table'" +``` + +If you want to set multiple options, simply concatenate them with a comma. + +_Do not add spaces after commas. **Elixir will complain!**_ + +```sh +podman exec -it akkoma-web \ + pleroma_ctl \ + database \ + set_pgroonga_options "tokenizer='TokenMecab',lexicon_type='hash_table'" +``` + --- ## Akkoma