pub enum FieldType {
Show 14 variants
Text,
Keyword,
Integer,
Long,
Float,
Double,
Boolean,
Date,
DenseVector {
dims: usize,
quantization: QuantizationType,
},
GeoPoint,
Nested,
GeoShape,
TokenCount,
Ip,
}Expand description
The data type of a field in a Luci index.
M0 types cover text, keyword, numeric, boolean, and date. Vector, geospatial, and nested types are added in later milestones.
See [[architecture-api-surface#Schema Definition]].
Variants§
Text
Full-text field, analyzed into tokens for search. Supports match,
match_phrase, and query_string queries.
Keyword
Exact-value string field. Not analyzed. Supports term, terms,
prefix, wildcard, regexp, and exists queries. Stored as
dictionary-encoded columnar data for fast aggregations and sorting.
Integer
32-bit signed integer.
Long
64-bit signed integer.
Float
32-bit IEEE 754 float.
Double
64-bit IEEE 754 double.
Boolean
Boolean value (true / false).
Date
Date/time value. Stored internally as epoch milliseconds (i64). Accepts ISO 8601 strings and epoch millis on input.
DenseVector
Dense vector for kNN search. Fixed dimensionality and quantization
scheme. Both must be set explicitly when constructing the variant
directly; Self::dense_vector builds one with QuantizationType::DEFAULT.
GeoPoint
Geographic point (latitude, longitude).
Nested
Nested object array — each object indexed as a hidden document.
GeoShape
Geographic shape (Polygon, LineString, etc.) for spatial relation queries. Indexed in a packed R-tree for efficient candidate selection.
See [[feature-geo-shape]] and [[geospatial]].
TokenCount
Token count: accepts a string, analyzes it, stores the number of tokens as an integer. Supports range queries and numeric aggregations. In ES this is typically a multi-field; in Luci it’s a standalone field.
Ip
IP address (IPv4 and IPv6). Stored as keyword for term queries and as numeric for range queries. Supports CIDR notation in term queries.
Implementations§
Source§impl FieldType
impl FieldType
Sourcepub fn from_es_name(name: &str) -> Result<Self>
pub fn from_es_name(name: &str) -> Result<Self>
Parse a field type name from an ES-compatible mapping string.
§Errors
Returns LuciError::InvalidQuery for unrecognized type names.
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Whether this type is numeric (supports range queries, numeric sort, and metric aggregations).
Sourcepub fn is_dense_vector(&self) -> bool
pub fn is_dense_vector(&self) -> bool
Whether this type is a dense vector.
Sourcepub fn vector_dims(&self) -> Option<usize>
pub fn vector_dims(&self) -> Option<usize>
Get vector dimensions, or None if not a vector type.
Sourcepub fn vector_quantization(&self) -> Option<QuantizationType>
pub fn vector_quantization(&self) -> Option<QuantizationType>
Get the configured quantization scheme, or None if not a vector type.
Sourcepub fn dense_vector(dims: usize) -> Self
pub fn dense_vector(dims: usize) -> Self
Construct a DenseVector field type with the given dimensionality
and the default quantization. Convenience for tests and code that
doesn’t need to override the default.
Trait Implementations§
impl Eq for FieldType
impl StructuralPartialEq for FieldType
Auto Trait Implementations§
impl Freeze for FieldType
impl RefUnwindSafe for FieldType
impl Send for FieldType
impl Sync for FieldType
impl Unpin for FieldType
impl UnsafeUnpin for FieldType
impl UnwindSafe for FieldType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more