Skip to main content

cloudillo_search/
settings.rs

1// SPDX-FileCopyrightText: Szilárd Hajba
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4//! Search subsystem settings registration
5
6use crate::prelude::*;
7use cloudillo_core::settings::types::{
8	PermissionLevel, SettingDefinition, SettingScope, SettingValue, SettingsRegistry,
9};
10
11/// Register all search settings
12pub fn register_settings(registry: &mut SettingsRegistry) -> ClResult<()> {
13	// Which of the two FTS indexes a tenant's rows live in. See
14	// `crate::reindex::index_stamp` for how a flip is applied.
15	registry.register(
16		SettingDefinition::builder("search.store_text")
17			.description(
18				"Store the extracted plain text of documents and actions alongside the search \
19				 index. Full-text search works either way; turning this off drops the stored copy \
20				 to save disk, at the cost of highlighted result snippets. Changing it requires a \
21				 reindex (POST /api/search/reindex).",
22			)
23			.default(SettingValue::Bool(true))
24			.scope(SettingScope::Tenant)
25			// Owner / community leader — matches `require_leader` on the prescribed reindex.
26			.permission(PermissionLevel::User)
27			.build()?,
28	)?;
29
30	Ok(())
31}
32
33// vim: ts=4