pub struct Enum<S = Root, Sub = WithSubfields> { /* private fields */ }Expand description
An enum field with a declared variant order (- enum: status +
variants: [...]). It is a keyword in every respect — the value ops and
(via keyword) the full keyword surface all apply — but its
.asc() / .desc() sort by the declared order, not alphabetically.
The order is prebaked into the index: the field carries a .sort subfield
whose normalizer maps each variant to its rank, so a bare
Ticket::status().asc() is order-correct with no script. A value not in the
declared set sorts after the known variants.
A bare enum with no declared variants is a plain Keyword instead
(the derive only emits Enum when an order is declared).
Implementations§
Source§impl<S, Sub> Enum<S, Sub>
impl<S, Sub> Enum<S, Sub>
Sourcepub fn keyword(&self) -> Keyword<S, Sub>
pub fn keyword(&self) -> Keyword<S, Sub>
The underlying Keyword handle — the full exact-string surface
(eq/any_of/prefix/wildcard/regexp/fuzzy/exists, plus the
subfield accessors when Sub = WithSubfields). The enum adds only the
order-aware sort on top.
Sourcepub fn eq(&self, value: impl FlussoValue<Keyword>) -> TermQuery<S>
pub fn eq(&self, value: impl FlussoValue<Keyword>) -> TermQuery<S>
Exact match. Accepts a String/&str or a #[derive(FlussoValue)]
keyword enum/newtype — matched against its serde string form.
Sourcepub fn any_of(
&self,
values: impl IntoIterator<Item = impl FlussoValue<Keyword>>,
) -> TermsQuery<S>
pub fn any_of( &self, values: impl IntoIterator<Item = impl FlussoValue<Keyword>>, ) -> TermsQuery<S>
Match any of the given values.