diff --git a/crates/milli/Cargo.toml b/crates/milli/Cargo.toml index 3d08252ac..e3f31f7ff 100644 --- a/crates/milli/Cargo.toml +++ b/crates/milli/Cargo.toml @@ -18,6 +18,7 @@ bincode = "1.3.3" bstr = "1.12.0" bytemuck = { version = "1.23.1", features = ["extern_crate_alloc"] } byteorder = "1.5.0" +cellulite = { git = "https://github.com/irevoire/cellulite", branch = "main"} charabia = { version = "0.9.6", default-features = false } concat-arrays = "0.1.2" convert_case = "0.8.0" @@ -27,6 +28,7 @@ either = { version = "1.15.0", features = ["serde"] } flatten-serde-json = { path = "../flatten-serde-json" } fst = "0.4.7" fxhash = "0.2.1" +geojson = "0.24.2" geoutils = "0.5.1" grenad = { version = "0.5.0", default-features = false, features = [ "rayon", diff --git a/crates/milli/src/index.rs b/crates/milli/src/index.rs index b2ec992ba..ee47f458a 100644 --- a/crates/milli/src/index.rs +++ b/crates/milli/src/index.rs @@ -114,6 +114,7 @@ pub mod db_name { pub const FIELD_ID_DOCID_FACET_STRINGS: &str = "field-id-docid-facet-strings"; pub const VECTOR_EMBEDDER_CATEGORY_ID: &str = "vector-embedder-category-id"; pub const VECTOR_ARROY: &str = "vector-arroy"; + pub const CELLULITE: &str = "cellulite"; pub const DOCUMENTS: &str = "documents"; } const NUMBER_OF_DBS: u32 = 25; @@ -182,6 +183,9 @@ pub struct Index { /// Vector store based on arroy™. pub vector_arroy: arroy::Database, + /// Geo store based on cellulite™. + pub cellulite: cellulite::Database, + /// Maps the document id to the document as an obkv store. pub(crate) documents: Database, } @@ -238,6 +242,7 @@ impl Index { let embedder_category_id = env.create_database(&mut wtxn, Some(VECTOR_EMBEDDER_CATEGORY_ID))?; let vector_arroy = env.create_database(&mut wtxn, Some(VECTOR_ARROY))?; + let cellulite = env.create_database(&mut wtxn, Some(CELLULITE))?; let documents = env.create_database(&mut wtxn, Some(DOCUMENTS))?; @@ -266,6 +271,7 @@ impl Index { field_id_docid_facet_strings, vector_arroy, embedder_category_id, + cellulite, documents, }; if this.get_version(&wtxn)?.is_none() && creation { @@ -1023,6 +1029,13 @@ impl Index { Ok(geo_filter) } + /// Returns true if the geo sorting feature is enabled. + pub fn is_geojson_enabled(&self, rtxn: &RoTxn<'_>) -> Result { + let geojson_filter = + self.filterable_attributes_rules(rtxn)?.iter().any(|field| field.has_geojson()); + Ok(geojson_filter) + } + pub fn asc_desc_fields(&self, rtxn: &RoTxn<'_>) -> Result> { let asc_desc_fields = self .criteria(rtxn)? @@ -1842,6 +1855,7 @@ impl Index { field_id_docid_facet_strings, vector_arroy, embedder_category_id, + cellulite: _, documents, } = self; diff --git a/crates/milli/src/lib.rs b/crates/milli/src/lib.rs index 504b4c68d..a7c99a2f0 100644 --- a/crates/milli/src/lib.rs +++ b/crates/milli/src/lib.rs @@ -85,7 +85,7 @@ pub use self::search::{ }; pub use self::update::ChannelCongestion; -pub type Result = std::result::Result; +pub type Result = std::result::Result; pub type Attribute = u32; pub type BEU16 = heed::types::U16;