Compare commits

...

4 Commits

Author SHA1 Message Date
itepechi 4733438d3e Change wording 2023-08-06 08:15:04 +09:00
itepechi 1ce5f0a920 Add a guide to customize the behavior of PGroonga 2023-08-06 08:08:56 +09:00
itepechi 5c19b8820f Fix instructions for switching to PGroonga 2023-08-06 08:08:05 +09:00
itepechi 059f3c4299 Fix grammar 2023-08-06 08:05:02 +09:00
1 changed files with 50 additions and 23 deletions

View File

@ -117,7 +117,7 @@ podman exec -it akkoma-web \
--migrations-path priv/repo/optional_migrations/pgroonga
```
You can revert the applied changes anytime by replacing `migrate` with `rollback`.
You can revert the applied changes at any time by replacing `migrate` with `rollback`.
### 5. Test your setup
@ -161,13 +161,24 @@ Follow the printed link to set your password.
#### Switch to PGroonga
Before moving forward, make sure you have stopped the backend for safety.
Before proceeding, make sure that `config :pleroma, :database, pgroonga_enabled` is set to `false`.
```sh
podman stop akkoma-web
```ex
config :pleroma, :database,
rum_enabled: false,
pgroonga_enabled: false
```
After stopping the backend, change `config :pleroma, :database, pgroonga_enabled` to `true`.
Then, run the command below to apply optional migrations to switch to PGroonga.
```sh
podman exec -it akkoma-web \
pleroma_ctl \
migrate \
--migrations-path priv/repo/optional_migrations/pgroonga
```
After running the migration, change `config :pleroma, :database, pgroonga_enabled` to `true`.
```ex
config :pleroma, :database,
@ -175,31 +186,47 @@ config :pleroma, :database,
pgroonga_enabled: true # set this option to true
```
If you have command history enabled in your shell, all you need to do is remove the `--name NAME` option and add `pleroma_ctl migrate --migrations-path priv/repo/optional_migrations/pgroonga` to the end of the command.
Don't forget to restart your backend for the changes to take effect.
```sh
podman run -d \
--pod akkoma-pod \
--restart unless-stopped \ # this option is optional (bruh)
# --name akkoma-web \ # make sure to remove this option to avoid name conflict
-e DB_NAME=YOUR_DB_NAME \
-e DB_USER=YOUR_DB_USER \
-e DB_PASS=YOUR_DB_PASS \
-v ${PWD}/static/:/var/lib/akkoma/static/:Z \
-v ${PWD}/uploads/:/var/lib/akkoma/uploads/:Z \
-v ${PWD}/etc/:/etc/akkoma/:Z \
akkoma \
pleroma_ctl \
migrate \
--migrations-path priv/repo/optional_migrations/pgroonga
podman restart akkoma-web
```
You can revert the applied changes anytime by replacing `migrate` with `rollback`.
You can revert the applied changes at any time by replacing `migrate` with `rollback`.
Don't forget to start the container you stopped at the beginning of this guide.
#### 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 "東京都" (Tokyo-to) to match "京都" (Kyoto), pass `TokenMecab` as the tokenizer.
```sh
podman start akkoma-web
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 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 or Elixir will complain. **You have been warned!**_
```sh
podman exec -it akkoma-web \
pleroma_ctl \
database \
set_pgroonga_options "tokenizer='TokenMecab',lexicon_type='hash_table'"
```
---