From d3c1cde97a1d2d9848a5e9889f228839d9d059ae Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Mon, 10 Jul 2023 20:43:55 +0800 Subject: [PATCH] fix https://github.com/cozodb/cozo/issues/143 --- cozo-core/src/runtime/relation.rs | 1 + cozo-core/src/runtime/tests.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cozo-core/src/runtime/relation.rs b/cozo-core/src/runtime/relation.rs index fd0391fc..932c7aeb 100644 --- a/cozo-core/src/runtime/relation.rs +++ b/cozo-core/src/runtime/relation.rs @@ -1382,6 +1382,7 @@ impl<'a> SessionTx<'a> { if rel.indices.remove(&idx_name.name).is_none() && rel.hnsw_indices.remove(&idx_name.name).is_none() && rel.lsh_indices.remove(&idx_name.name).is_none() + && rel.fts_indices.remove(&idx_name.name).is_none() { #[derive(Debug, Error, Diagnostic)] #[error("index {0} for relation {1} not found")] diff --git a/cozo-core/src/runtime/tests.rs b/cozo-core/src/runtime/tests.rs index 61744122..39e97d84 100644 --- a/cozo-core/src/runtime/tests.rs +++ b/cozo-core/src/runtime/tests.rs @@ -1532,3 +1532,25 @@ fn hnsw_index() { "#).unwrap(); println!("{}", res.into_json()["rows"][0][4]); } + +#[test] +fn fts_drop() { + let db = DbInstance::default(); + db.run_default( + r#" + :create entity {name} + "#, + ) + .unwrap(); + db.run_default( + r#" + ::fts create entity:fts_index { extractor: name, + tokenizer: Simple, filters: [Lowercase] + } + "#, + ) + .unwrap(); + db.run_default(r#" + ::fts drop entity:fts_index + "#).unwrap(); +} \ No newline at end of file