os_query_builder_rs/full_text/intervals/rules/
wildcard.rs1use serde::Serialize;
2
3#[derive(Debug, Default, Clone, Serialize)]
4pub struct WildcardRule {
5 pattern: String,
6 #[serde(skip_serializing_if = "Option::is_none")]
7 analyzer: Option<String>,
8 #[serde(skip_serializing_if = "Option::is_none")]
9 use_field: Option<String>
10}
11
12
13impl WildcardRule {
14
15 pub fn new() -> Self {
16 Self::default()
17 }
18
19 pub fn pattern<T: Into<String> + Serialize>(self, pattern: T) -> Self {
20 Self {
21 pattern: pattern.into(),
22 ..self
23 }
24 }
25
26 pub fn analyzer<T: Into<String> + Serialize>(self, analyzer: T) -> Self {
27 Self {
28 analyzer: Some(analyzer.into()),
29 ..self
30 }
31 }
32
33 pub fn use_field<T: Into<String> + Serialize>(self, use_field: T) -> Self {
34 Self {
35 use_field: Some(use_field.into()),
36 ..self
37 }
38 }
39}