fix(search): set gin_fuzzy_search_limit only for search queries
The limit was a connection parameter, so it applied to every GIN index scan, not only full-text search: recipient lookups and Oban job queries could return incomplete, random results. Set it with SET LOCAL around the search query only, configurable under Pleroma.Search.DatabaseSearch. The default stays 500 for search: measured on a 74M-object database, higher limits or none make searches for common words exceed the query timeout. Remote fetches for URL queries run outside the transaction. Based on Akkoma 811f0a468. Co-authored-by: Oneric <oneric@oneric.stub>
This commit is contained in:
parent
24038667b2
commit
fa8541309c
6 changed files with 98 additions and 17 deletions
|
|
@ -3565,6 +3565,21 @@ config :pleroma, :config_description, [
|
|||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: Pleroma.Search.DatabaseSearch,
|
||||
type: :group,
|
||||
description: "Built-in database search settings.",
|
||||
children: [
|
||||
%{
|
||||
key: :gin_fuzzy_search_limit,
|
||||
type: :integer,
|
||||
description:
|
||||
"Limits how many matches PostgreSQL considers in GIN full-text search queries (see `gin_fuzzy_search_limit` in the PostgreSQL docs). Only set for search queries. Keeps search fast on large databases, but results become incomplete and change between requests. Set to `nil` for exact results, which is fine on small instances. Default: 500.",
|
||||
suggestions: [500, nil]
|
||||
}
|
||||
]
|
||||
},
|
||||
%{
|
||||
group: :pleroma,
|
||||
key: Pleroma.Search.Meilisearch,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue