Add a guide to customize the behavior of PGroonga

This commit is contained in:
itepechi 2023-08-06 08:08:56 +09:00
parent 5c19b8820f
commit 1ce5f0a920

View file

@ -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