1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
* opensearch-client
*
* Rust Client for OpenSearch
*
* The version of the OpenAPI document: 3.1.0
* Contact: alberto.paro@gmail.com
* Generated by Paro OpenAPI Generator
*/
use crate::common;
use crate::core;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
pub struct HighlightBase {
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub r#type: Option<core::search::HighlighterType>,
/// Controls which locale is used to search for sentence and word boundaries.
/// This parameter takes the form of a language tag, for example, `"en-US"`, `"fr-FR"`, or `"ja-JP"`.
#[serde(
rename = "boundary_scanner_locale",
default,
skip_serializing_if = "Option::is_none"
)]
pub boundary_scanner_locale: Option<String>,
/// The size of the highlighted fragment in characters.
#[serde(
rename = "fragment_size",
default,
skip_serializing_if = "Option::is_none"
)]
pub fragment_size: Option<u32>,
/// If set to a non-negative value, highlighting stops at this defined maximum limit.
/// The rest of the text is not processed or highlighted, and no error is returned.
/// The `max_analyzer_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which takes precedence when it is set to a lower value than the query setting.
#[serde(
rename = "max_analyzer_offset",
default,
skip_serializing_if = "Option::is_none"
)]
pub max_analyzer_offset: Option<u32>,
/// The maximum number of fragments to return.
/// When the number of fragments is set to `0`, no fragments are returned.
/// Instead, the entirety of a field's contents are highlighted and returned.
/// This is useful when you need to highlight short texts, such as a title or address, in which fragmentation is not required.
/// If `number_of_fragments` is set to `0`, the `fragment_size` is ignored.
#[serde(
rename = "number_of_fragments",
default,
skip_serializing_if = "Option::is_none"
)]
pub number_of_fragments: Option<u32>,
#[serde(
rename = "tags_schema",
default,
skip_serializing_if = "Option::is_none"
)]
pub tags_schema: Option<String>,
/// How far to scan for boundary characters.
#[serde(
rename = "boundary_max_scan",
default,
skip_serializing_if = "Option::is_none"
)]
pub boundary_max_scan: Option<u32>,
/// When used in conjunction with `pre_tags`, defines the HTML tags to use for the highlighted text.
/// By default, highlighted text is wrapped in `<em>` and `</em>` tags.
#[serde(rename = "post_tags", default, skip_serializing_if = "Option::is_none")]
pub post_tags: Option<Vec<String>>,
#[serde(
rename = "highlight_filter",
default,
skip_serializing_if = "Option::is_none"
)]
pub highlight_filter: Option<bool>,
#[serde(
rename = "fragmenter",
default,
skip_serializing_if = "Option::is_none"
)]
pub fragmenter: Option<String>,
/// A string that contains each boundary character.
#[serde(
rename = "boundary_chars",
default,
skip_serializing_if = "Option::is_none"
)]
pub boundary_chars: Option<String>,
/// The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.
#[serde(
rename = "no_match_size",
default,
skip_serializing_if = "Option::is_none"
)]
pub no_match_size: Option<u32>,
/// By default, only fields that contains a query match are highlighted.
/// Set to `false` to highlight all fields.
#[serde(
rename = "require_field_match",
default,
skip_serializing_if = "Option::is_none"
)]
pub require_field_match: Option<bool>,
#[serde(
rename = "fragment_offset",
default,
skip_serializing_if = "Option::is_none"
)]
pub fragment_offset: Option<u32>,
#[serde(
rename = "highlight_query",
default,
skip_serializing_if = "Option::is_none"
)]
pub highlight_query: Option<crate::dsl::Query>,
#[serde(
rename = "max_fragment_length",
default,
skip_serializing_if = "Option::is_none"
)]
pub max_fragment_length: Option<u32>,
#[serde(rename = "options", default, skip_serializing_if = "Option::is_none")]
pub options: Option<serde_json::Value>,
#[serde(
rename = "force_source",
default,
skip_serializing_if = "Option::is_none"
)]
pub force_source: Option<bool>,
#[serde(rename = "order", default, skip_serializing_if = "Option::is_none")]
pub order: Option<String>,
#[serde(
rename = "boundary_scanner",
default,
skip_serializing_if = "Option::is_none"
)]
pub boundary_scanner: Option<String>,
/// Controls the number of matching phrases in a document that are considered.
/// This prevents the `fvh` highlighter from analyzing too many phrases and consuming too much memory.
/// When using `matched_fields`, phrase-limited phrases per matched field are considered. Raising the limit increases the query time and consumes more memory.
/// This setting is only supported by the `fvh` highlighter.
#[serde(
rename = "phrase_limit",
default,
skip_serializing_if = "Option::is_none"
)]
pub phrase_limit: Option<u32>,
/// When used in conjunction with `post_tags`, defines the HTML tags to use for the highlighted text.
/// By default, highlighted text is wrapped in `<em>` and `</em>` tags.
#[serde(rename = "pre_tags", default, skip_serializing_if = "Option::is_none")]
pub pre_tags: Option<Vec<String>>,
}
impl HighlightBase {
pub fn new() -> HighlightBase {
HighlightBase {
r#type: None,
boundary_scanner_locale: None,
fragment_size: None,
max_analyzer_offset: None,
number_of_fragments: None,
tags_schema: None,
boundary_max_scan: None,
post_tags: None,
highlight_filter: None,
fragmenter: None,
boundary_chars: None,
no_match_size: None,
require_field_match: None,
fragment_offset: None,
highlight_query: None,
max_fragment_length: None,
options: None,
force_source: None,
order: None,
boundary_scanner: None,
phrase_limit: None,
pre_tags: None,
}
}
}