diff --git a/summa-core/Cargo.toml b/summa-core/Cargo.toml index 3b8d5ae2..136afc22 100644 --- a/summa-core/Cargo.toml +++ b/summa-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "summa-core" -version = "0.17.7" +version = "0.17.8" authors = ["Pasha Podolsky "] edition = "2021" license-file = "LICENSE" diff --git a/summa-embed-py/Cargo.toml b/summa-embed-py/Cargo.toml index 53a72109..b11b64ec 100644 --- a/summa-embed-py/Cargo.toml +++ b/summa-embed-py/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "summa-embed-py" -version = "0.17.7" +version = "0.17.8" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,8 +17,8 @@ pyo3-asyncio = { version = "0.18", features = ["attributes", "tokio-runtime"] } pyo3-log = "0.8" pythonize = "0.18" serde_json = "1.0" -summa-core = { version = "0.17.7", path = "../summa-core", default_features = false, features = ["fs", "hyper-external-request", "tokio-rt"] } -summa-server = { version = "0.17.7", path = "../summa-server", default_features = false } +summa-core = { version = "0.17.8", path = "../summa-core", default_features = false, features = ["fs", "hyper-external-request", "tokio-rt"] } +summa-server = { version = "0.17.8", path = "../summa-server", default_features = false } summa-proto = { workspace = true } tantivy = { workspace = true } tokio = { workspace = true } \ No newline at end of file diff --git a/summa-server/Cargo.toml b/summa-server/Cargo.toml index f7f159ee..453a499d 100644 --- a/summa-server/Cargo.toml +++ b/summa-server/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "summa-server" -version = "0.17.7" +version = "0.17.8" license-file = "LICENSE" description = "Fast full-text search server" homepage = "https://github.com/izihawa/summa" @@ -30,7 +30,7 @@ maintenance = { status = "actively-developed" } tonic-build = { version = "0.9.1", default-features = false, features = ["prost", "transport"] } [dev-dependencies] -summa-core = { version = "0.17.7", path = "../summa-core", features = ["fs", "hyper-external-request", "tokio-rt"] } +summa-core = { version = "0.17.8", path = "../summa-core", features = ["fs", "hyper-external-request", "tokio-rt"] } tempdir = "0.3.7" [dependencies] @@ -59,7 +59,7 @@ serde = { workspace = true } serde_derive = "1.0" serde_json = { workspace = true } serde_yaml = { workspace = true } -summa-core = { version = "0.17.7", path = "../summa-core", features = ["fs", "hyper-external-request", "tokio-rt"] } +summa-core = { version = "0.17.8", path = "../summa-core", features = ["fs", "hyper-external-request", "tokio-rt"] } summa-proto = { workspace = true, features = ["grpc"] } take_mut = { workspace = true } tantivy = { workspace = true } diff --git a/summa-wasm/Cargo.toml b/summa-wasm/Cargo.toml index fc447f69..325b1ea4 100644 --- a/summa-wasm/Cargo.toml +++ b/summa-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "summa-wasm" -version = "0.125.0" +version = "0.125.2" authors = ["Pasha Podolsky "] edition = "2021" license-file = "LICENSE" @@ -26,7 +26,7 @@ prost = { workspace = true } serde = { workspace = true } serde-wasm-bindgen = "0.5" strfmt = { workspace = true } -summa-core = { version = "0.17.7", path = "../summa-core", default_features = false } +summa-core = { version = "0.17.8", path = "../summa-core", default_features = false } summa-proto = { workspace = true } tantivy = { workspace = true, features = ["wasm"] } thiserror = { workspace = true } diff --git a/summa-wasm/package.json b/summa-wasm/package.json index 623d9343..57ae9b11 100644 --- a/summa-wasm/package.json +++ b/summa-wasm/package.json @@ -1,7 +1,7 @@ { "name": "summa-wasm", "description": "WASM-bindings for Summa", - "version": "0.125.0", + "version": "0.125.2", "keywords": [ "search", "database", diff --git a/summa-wasm/src/meta-db.ts b/summa-wasm/src/meta-db.ts index e204dcdf..7b2e310c 100644 --- a/summa-wasm/src/meta-db.ts +++ b/summa-wasm/src/meta-db.ts @@ -3,9 +3,11 @@ import Dexie from "dexie"; export class MetaDb extends Dexie { index_configs!: Dexie.Table; + target_version!: number; constructor(name: string, version: number) { super(name); + this.target_version = version; this.version(version).stores({ index_configs: "index_name", }); @@ -17,6 +19,37 @@ export class MetaDb extends Dexie { return this.index_configs.put(item); }); } + + public open() { + if (this.isOpen()) return super.open(); + return Dexie.Promise.resolve() + .then(() => Dexie.exists(this.name)) + .then((exists) => { + if (!exists) { + // no need to check database version since it doesn't exist + return; + } + + // Open separate instance of dexie to get current database version + return new Dexie(this.name).open() + .then(async db => { + if (db.verno >= this.target_version) { + // database up to date (or newer) + return db.close(); + } + + console.log(`Database schema out of date, resetting all data. (currentVersion: ${db.verno}, expectedVersion: ${this.target_version})`); + await db.delete(); + + // ensure the deletion was successful + const exists = await Dexie.exists(this.name); + if (exists) { + throw new Error('Failed to remove mock backend database.'); + } + }) + }) + .then(() => super.open()); + } } interface IIndexConfig { diff --git a/summa-wasm/src/proto.d.ts b/summa-wasm/src/proto.d.ts index 664355ba..b6548d49 100644 --- a/summa-wasm/src/proto.d.ts +++ b/summa-wasm/src/proto.d.ts @@ -305,9 +305,6 @@ export namespace summa { /** QueryParserConfig query_language */ query_language?: (string|null); - - /** QueryParserConfig ner_matches_promoter */ - ner_matches_promoter?: (summa.proto.INerMatchesPromoter|null); } /** Represents a QueryParserConfig. */ @@ -352,9 +349,6 @@ export namespace summa { /** QueryParserConfig query_language. */ public query_language?: (string|null); - /** QueryParserConfig ner_matches_promoter. */ - public ner_matches_promoter?: (summa.proto.INerMatchesPromoter|null); - /** QueryParserConfig default_mode. */ public default_mode?: ("boolean_should_mode"|"disjuction_max_mode"); diff --git a/summa-wasm/src/proto.js b/summa-wasm/src/proto.js index 5c8761fe..0d01a90d 100644 --- a/summa-wasm/src/proto.js +++ b/summa-wasm/src/proto.js @@ -534,7 +534,6 @@ export const summa = $root.summa = (() => { * @property {Array.|null} [removed_fields] QueryParserConfig removed_fields * @property {Object.|null} [morphology_configs] QueryParserConfig morphology_configs * @property {string|null} [query_language] QueryParserConfig query_language - * @property {summa.proto.INerMatchesPromoter|null} [ner_matches_promoter] QueryParserConfig ner_matches_promoter */ /** @@ -646,14 +645,6 @@ export const summa = $root.summa = (() => { */ QueryParserConfig.prototype.query_language = null; - /** - * QueryParserConfig ner_matches_promoter. - * @member {summa.proto.INerMatchesPromoter|null|undefined} ner_matches_promoter - * @memberof summa.proto.QueryParserConfig - * @instance - */ - QueryParserConfig.prototype.ner_matches_promoter = null; - // OneOf field names bound to virtual getters and setters let $oneOfFields;