diff --git a/src/collection.rs b/src/collection.rs index d70748f..f8c6ed0 100644 --- a/src/collection.rs +++ b/src/collection.rs @@ -27,7 +27,7 @@ use crate::proto::milvus::{ use crate::proto::schema::DataType; use crate::schema::CollectionSchema; use crate::types::*; -use crate::utils::status_to_result; +use crate::utils::{status_to_result, filter_index_info}; use crate::value::Value; use crate::{ client::{AuthInterceptor, Client}, @@ -588,6 +588,7 @@ impl Client { where S: Into, { + let field_name:String = field_name.into(); let res = self .client .clone() @@ -595,15 +596,14 @@ impl Client { base: Some(MsgBase::new(MsgType::DescribeIndex)), db_name: "".to_string(), collection_name: collection_name.into(), - field_name: field_name.into(), + field_name: field_name.clone(), index_name: "".to_string(), timestamp: 0, }) .await? .into_inner(); status_to_result(&res.status)?; - - Ok(res.index_descriptions.into_iter().map(Into::into).collect()) + Ok(filter_index_info(res.index_descriptions.into_iter().map(Into::into).collect(), field_name)) } pub async fn drop_index(&self, collection_name: S, field_name: S) -> Result<()> diff --git a/src/index/mod.rs b/src/index/mod.rs index 3eac2af..a74d9be 100644 --- a/src/index/mod.rs +++ b/src/index/mod.rs @@ -30,16 +30,16 @@ pub enum IndexType { RHNSWFlat, #[strum(serialize = "RHNSW_PQ")] RHNSWPQ, - #[strum(serialize = "RHNSW_SQ")] - RHNSWSQ, #[strum(serialize = "IVF_HNSW")] IvfHNSW, #[strum(serialize = "ANNOY")] ANNOY, - #[strum(serialize = "NGT_PANNG")] - NGTPANNG, - #[strum(serialize = "NGT_ONNG")] - NGTONNG, + #[strum(serialize = "INVERTED")] + INVERTED, + #[strum(serialize = "STL_SORT")] + StlSort, + #[strum(serialize = "Trie")] + Trie, } #[derive(Debug, Clone, Copy, EnumString, Display)] @@ -51,6 +51,7 @@ pub enum MetricType { TANIMOTO, SUBSTRUCTURE, SUPERSTRUCTURE, + SCALAR, } #[derive(Debug, Clone)] diff --git a/src/utils.rs b/src/utils.rs index 8382c68..5a376c2 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -15,8 +15,7 @@ // limitations under the License. use crate::{ - error::Error, - proto::common::{ErrorCode, Status}, + error::Error, index::IndexInfo, proto::common::{ErrorCode, Status} }; pub fn status_to_result(status: &Option) -> Result<(), Error> { @@ -35,3 +34,13 @@ pub fn status_to_result(status: &Option) -> Result<(), Error> { ))), } } + +pub fn filter_index_info(infos: Vec, field_name: String) -> Vec{ + let mut result:Vec = Vec::new(); + for info in infos{ + if field_name == "" || info.field_name() == field_name{ + result.push(info) + } + }; + result +} \ No newline at end of file