pub struct ScoutConfig {
pub driver: String,
pub prefix: String,
pub queue: bool,
pub after_commit: bool,
pub soft_delete: bool,
pub identify: bool,
pub chunk_searchable: usize,
pub chunk_unsearchable: usize,
pub options: HashMap<String, Value>,
}Expand description
驱动配置。
字段对齐 webman-scout 的 Scout 配置形状,其中一部分目前只是配置占位、
驱动不会读取(见各字段说明)。真正生效的是 driver、options 和
各后端构造器写入的连接参数。
Fields§
§driver: String§prefix: String索引名前缀。尚未生效:只有 ScoutConfig::index_name 会读它,
而各驱动都直接使用传入的索引名、不经过该方法。设置它不会给索引加前缀。
queue: bool队列开关。配置占位,当前无写入队列实现(queue 与
after_commit 都属此列)。
after_commit: bool提交后同步。配置占位,见 ScoutConfig::queue。
soft_delete: bool软删除开关。配置占位;软删除能力由 Engine::soft_delete 与
SearchBuilder::with_trashed 控制,与此字段无关。
identify: bool模型 id 识别开关。配置占位,当前无效。
chunk_searchable: usize批量写入分块大小。配置占位;批量接口由调用方自行分块。
chunk_unsearchable: usize批量删除分块大小。配置占位,见 ScoutConfig::chunk_searchable。
options: HashMap<String, Value>驱动专属参数,会被读取:键形如 elasticsearch.host /
database.url / algolia.app_id,由 EngineManager
在构造驱动时取用。
Implementations§
Source§impl ScoutConfig
impl ScoutConfig
pub fn collection() -> Self
pub fn elasticsearch(host: impl Into<String>, api_key: Option<String>) -> Self
pub fn opensearch(host: impl Into<String>, api_key: Option<String>) -> Self
pub fn meilisearch(host: impl Into<String>, api_key: impl Into<String>) -> Self
pub fn typesense(host: impl Into<String>, api_key: impl Into<String>) -> Self
pub fn algolia(app_id: impl Into<String>, api_key: impl Into<String>) -> Self
pub fn database(url: impl Into<String>, fields: Vec<String>) -> Self
pub fn null() -> Self
pub fn xunsearch(host: impl Into<String>, project: impl Into<String>) -> Self
pub fn insert(&mut self, key: impl Into<String>, value: impl Into<Value>)
pub fn get(&self, key: &str) -> Option<&Value>
Trait Implementations§
Source§impl Clone for ScoutConfig
impl Clone for ScoutConfig
Source§impl Debug for ScoutConfig
impl Debug for ScoutConfig
Source§impl Default for ScoutConfig
impl Default for ScoutConfig
Source§impl<'de> Deserialize<'de> for ScoutConfig
impl<'de> Deserialize<'de> for ScoutConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ScoutConfig
impl RefUnwindSafe for ScoutConfig
impl Send for ScoutConfig
impl Sync for ScoutConfig
impl Unpin for ScoutConfig
impl UnsafeUnpin for ScoutConfig
impl UnwindSafe for ScoutConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more