Struct elasticsearch_dsl::search::highlight::DefaultHighlighter
source · [−]pub struct DefaultHighlighter { /* private fields */ }
Expand description
Highlighting settings can be set on a global level and overridden at the field level
Implementations
sourceimpl DefaultHighlighter
impl DefaultHighlighter
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Highlighter instance
sourcepub fn boundary_chars(self, boundary_chars: impl Into<String>) -> Self
pub fn boundary_chars(self, boundary_chars: impl Into<String>) -> Self
A string that contains each boundary character. Defaults to .,!? \t\n
.
sourcepub fn boundary_max_scan(self, boundary_max_scan: u32) -> Self
pub fn boundary_max_scan(self, boundary_max_scan: u32) -> Self
How far to scan for boundary characters. Defaults to 20
.
sourcepub fn encoder(self, encoder: Encoder) -> Self
pub fn encoder(self, encoder: Encoder) -> Self
Indicates if the snippet should be HTML encoded.
sourcepub fn force_source(self, force_source: bool) -> Self
pub fn force_source(self, force_source: bool) -> Self
Highlight based on the source even if the field is stored separately. Defaults to false
.
sourcepub fn fragment_size(self, fragment_size: u32) -> Self
pub fn fragment_size(self, fragment_size: u32) -> Self
The size of the highlighted fragment in characters. Defaults to
100
.
sourcepub fn highlight_query(self, highlight_query: impl Into<Query>) -> Self
pub fn highlight_query(self, highlight_query: impl Into<Query>) -> Self
Highlight matches for a query other than the search query. This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.
Warning
Elasticsearch does not validate thathighlight_query
contains the search query in any way so it is possible to define it so legitimate query results are not highlighted. Generally, you should include the search query as part of thehighlight_query
.
sourcepub fn no_match_size(self, no_match_size: u32) -> Self
pub fn no_match_size(self, no_match_size: u32) -> Self
The amount of text you want to return from the beginning of the field if there are no
matching fragments to highlight. Defaults to 0
(nothing is returned).
sourcepub fn number_of_fragments(self, number_of_fragments: u32) -> Self
pub fn number_of_fragments(self, number_of_fragments: u32) -> Self
The maximum number of fragments to return. If the number of fragments is set to 0
, no
fragments are returned. Instead, the entire field contents are highlighted and returned.
This can be handy when you need to highlight short texts such as a title or address, but
fragmentation is not required. If number_of_fragments
is 0
, fragment_size
is ignored.
Defaults to 5
.
sourcepub fn order(self, order: Order) -> Self
pub fn order(self, order: Order) -> Self
Sorts highlighted fragments by score when set to score
. By default,
fragments will be output in the order they appear in the field
(order: none
). Setting this option to score
will output
the most relevant fragments first. Each highlighter applies its own logic to compute
relevancy scores. See the document
How highlighters work internally
for more details how different highlighters find the best fragments.
sourcepub fn require_field_match(self, require_field_match: bool) -> Self
pub fn require_field_match(self, require_field_match: bool) -> Self
By default, only fields that contains a query match are highlighted. Set
require_field_match
to false
to highlight all fields. Defaults to true
.
Set to styled
to use the built-in tag schema or use custom tags
sourcepub fn fvh(self) -> FastVectorHighlighter
pub fn fvh(self) -> FastVectorHighlighter
Converts Highlighter to specific highlighter
sourcepub fn plain(self) -> PlainHighlighter
pub fn plain(self) -> PlainHighlighter
Converts Highlighter to specific highlighter
sourcepub fn unified(self) -> UnifiedHighlighter
pub fn unified(self) -> UnifiedHighlighter
Converts Highlighter to specific highlighter
Trait Implementations
sourceimpl Clone for DefaultHighlighter
impl Clone for DefaultHighlighter
sourcefn clone(&self) -> DefaultHighlighter
fn clone(&self) -> DefaultHighlighter
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DefaultHighlighter
impl Debug for DefaultHighlighter
sourceimpl Default for DefaultHighlighter
impl Default for DefaultHighlighter
sourcefn default() -> DefaultHighlighter
fn default() -> DefaultHighlighter
Returns the “default value” for a type. Read more
sourceimpl From<DefaultHighlighter> for Highlighter
impl From<DefaultHighlighter> for Highlighter
sourcefn from(highlighter: DefaultHighlighter) -> Self
fn from(highlighter: DefaultHighlighter) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<DefaultHighlighter> for DefaultHighlighter
impl PartialEq<DefaultHighlighter> for DefaultHighlighter
sourcefn eq(&self, other: &DefaultHighlighter) -> bool
fn eq(&self, other: &DefaultHighlighter) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &DefaultHighlighter) -> bool
fn ne(&self, other: &DefaultHighlighter) -> bool
This method tests for !=
.
sourceimpl Serialize for DefaultHighlighter
impl Serialize for DefaultHighlighter
impl StructuralPartialEq for DefaultHighlighter
Auto Trait Implementations
impl RefUnwindSafe for DefaultHighlighter
impl Send for DefaultHighlighter
impl Sync for DefaultHighlighter
impl Unpin for DefaultHighlighter
impl UnwindSafe for DefaultHighlighter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more