pub trait Searchable {
const INDEX_NAME: &'static str;
const SEARCHABLE_ATTRIBUTES: &'static [&'static str];
const PRIMARY_KEY: &'static str = "id";
const FILTERABLE_ATTRIBUTES: &'static [&'static str] = _;
const SORTABLE_ATTRIBUTES: &'static [&'static str] = _;
const FACETABLE_ATTRIBUTES: &'static [&'static str] = _;
// Required method
fn to_search_doc(&self) -> Value;
}Required Associated Constants§
Sourceconst INDEX_NAME: &'static str
const INDEX_NAME: &'static str
Index name — typically the same as the admin name (“posts”).
Sourceconst SEARCHABLE_ATTRIBUTES: &'static [&'static str]
const SEARCHABLE_ATTRIBUTES: &'static [&'static str]
Which attributes the engine should actually tokenise for full-text queries. Fewer is faster; only include what users would actually type to find this model.
Provided Associated Constants§
Sourceconst PRIMARY_KEY: &'static str = "id"
const PRIMARY_KEY: &'static str = "id"
Primary key field in the serialised document. Meilisearch requires one unique key per doc; for us it’s almost always “id”.
Sourceconst FILTERABLE_ATTRIBUTES: &'static [&'static str] = _
const FILTERABLE_ATTRIBUTES: &'static [&'static str] = _
Fields available for filter=… queries (e.g. published=true).
Sourceconst SORTABLE_ATTRIBUTES: &'static [&'static str] = _
const SORTABLE_ATTRIBUTES: &'static [&'static str] = _
Fields available for sort=….
Sourceconst FACETABLE_ATTRIBUTES: &'static [&'static str] = _
const FACETABLE_ATTRIBUTES: &'static [&'static str] = _
Subset of filterable attributes to request facet counts for.
A UI with a “by author” sidebar wants author here; a raw
created_at timestamp that’s filterable-but-not-faceted does not.
Required Methods§
Sourcefn to_search_doc(&self) -> Value
fn to_search_doc(&self) -> Value
Serialise self into the JSON document shape Meili indexes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.