diff --git a/Cargo.toml b/Cargo.toml index 79edb10..cc6194b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "teocloud_teo_docs_search_engine" -version = "0.0.3" +version = "0.0.4" [lib] crate-type = ["cdylib"] diff --git a/package.json b/package.json index 5d58ed4..9e704ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@teocloud/teo-docs-search-engine", - "version": "0.0.3", + "version": "0.0.4", "main": "index.js", "types": "index.d.ts", "napi": { diff --git a/src/lib.rs b/src/lib.rs index 5a57531..0d52426 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,9 +34,10 @@ static SCHEMA: Lazy = Lazy::new(|| { static INDEX: Lazy = Lazy::new(|| { let path = current_dir().unwrap(); let tmp_dir = path.join(".fulltextcache"); - if !tmp_dir.exists() { - fs::create_dir(&tmp_dir).unwrap(); + if tmp_dir.exists() { + fs::remove_dir(&tmp_dir).unwrap(); } + fs::create_dir(&tmp_dir).unwrap(); let index = Index::create_in_dir(&tmp_dir, SCHEMA.clone()).unwrap(); index });