@eltjs/vectorizer 0.13.8 → 0.13.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sqlserver/keyword-index.js +18 -12
- package/package.json +15 -15
|
@@ -113,27 +113,33 @@ export class KeywordIndex extends DerivedDataset {
|
|
|
113
113
|
// Makes the catalog when the database has none, and the table and its
|
|
114
114
|
// full-text index again when the table does not keep the hash of this
|
|
115
115
|
// declaration or has no full-text index. A server with no Full-Text Search
|
|
116
|
-
//
|
|
116
|
+
// makes the catalog, which is only metadata, and refuses the full-text
|
|
117
|
+
// index (probed on SQL Server 2022): the member then drops the table that
|
|
118
|
+
// it made just before, so it leaves no keywords table.
|
|
117
119
|
async #declare(session) {
|
|
120
|
+
await session.query(`IF NOT EXISTS (SELECT 1 FROM sys.fulltext_catalogs WHERE [name] = ${literal(this.name)}) CREATE FULLTEXT CATALOG ${this.#catalog}`);
|
|
121
|
+
const [stored] = await session.query(`SELECT (SELECT CAST([value] AS nvarchar(100)) FROM sys.extended_properties WHERE [class] = 1 AND [major_id] = OBJECT_ID(@table) AND [minor_id] = 0 AND [name] = N'elt_declaration') AS [declared],
|
|
122
|
+
(SELECT COUNT(*) FROM sys.fulltext_indexes WHERE [object_id] = OBJECT_ID(@table)) AS [indexed]`, { table: this.#table });
|
|
123
|
+
if (stored?.declared === this.#declared && Number(stored.indexed) === 1)
|
|
124
|
+
return;
|
|
125
|
+
await session.query(`IF EXISTS (SELECT 1 FROM sys.fulltext_indexes WHERE [object_id] = OBJECT_ID(${literal(this.#table)})) DROP FULLTEXT INDEX ON ${this.#table}`);
|
|
126
|
+
await session.query(`DROP TABLE IF EXISTS ${this.#table}`);
|
|
118
127
|
try {
|
|
119
|
-
|
|
128
|
+
for (const statement of this.#declaration)
|
|
129
|
+
await session.query(statement);
|
|
120
130
|
}
|
|
121
131
|
catch (error) {
|
|
122
132
|
if (numberOf(error) !== noFullTextSearch)
|
|
123
133
|
throw error;
|
|
134
|
+
await session.query(`DROP TABLE IF EXISTS ${this.#table}`);
|
|
124
135
|
throw new SqlServerSetupError(`Keyword index ${this.name} needs Full-Text Search, and the server has none: install it (on Linux, the package mssql-server-fts), or use Azure SQL Database, which has it`, { cause: error });
|
|
125
136
|
}
|
|
126
|
-
const [stored] = await session.query(`SELECT (SELECT CAST([value] AS nvarchar(100)) FROM sys.extended_properties WHERE [class] = 1 AND [major_id] = OBJECT_ID(@table) AND [minor_id] = 0 AND [name] = N'elt_declaration') AS [declared],
|
|
127
|
-
(SELECT COUNT(*) FROM sys.fulltext_indexes WHERE [object_id] = OBJECT_ID(@table)) AS [indexed]`, { table: this.#table });
|
|
128
|
-
if (stored?.declared === this.#declared && Number(stored.indexed) === 1)
|
|
129
|
-
return;
|
|
130
|
-
await session.query(`IF EXISTS (SELECT 1 FROM sys.fulltext_indexes WHERE [object_id] = OBJECT_ID(${literal(this.#table)})) DROP FULLTEXT INDEX ON ${this.#table}`);
|
|
131
|
-
await session.query(`DROP TABLE IF EXISTS ${this.#table}`);
|
|
132
|
-
for (const statement of this.#declaration)
|
|
133
|
-
await session.query(statement);
|
|
134
137
|
// Last, so a make that stopped half way is made again by the next
|
|
135
|
-
// refresh.
|
|
136
|
-
|
|
138
|
+
// refresh. The connection sends each parameter as nvarchar(max), which
|
|
139
|
+
// the sql_variant value of a property refuses (error 206), so the hash
|
|
140
|
+
// goes through a variable of a fixed length, as elt-sqlserver's
|
|
141
|
+
// descriptions do.
|
|
142
|
+
await session.query(`DECLARE @value nvarchar(100) = @declared; EXEC sp_addextendedproperty @name = N'elt_declaration', @value = @value, @level0type = N'SCHEMA', @level0name = @schema, @level1type = N'TABLE', @level1name = @table`, { declared: this.#declared, schema: marts, table: this.name });
|
|
137
143
|
}
|
|
138
144
|
// Writes each passage whose text changed and removes each one that no part
|
|
139
145
|
// has, in one MERGE, and gives the parts and the passages.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eltjs/vectorizer",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9",
|
|
4
4
|
"description": "One declaration that keeps the passage contract of @zukhruf/retrieval in step with an elt pipeline: passages with metadata, their vectors with the model identity, and a keyword index.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -50,26 +50,26 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@eltjs/chunking": "^0.13.
|
|
54
|
-
"@eltjs/elt": "^0.13.
|
|
55
|
-
"@eltjs/elt-postgresql": "^0.13.
|
|
56
|
-
"@eltjs/elt-sqlite": "^0.13.
|
|
57
|
-
"@eltjs/elt-sqlserver": "^0.13.
|
|
58
|
-
"@eltjs/embedding": "^0.13.
|
|
59
|
-
"@zukhruf/async": "^0.8.
|
|
60
|
-
"@zukhruf/sqlite-drift": "^0.8.
|
|
61
|
-
"@zukhruf/sqlite-transaction": "^0.8.
|
|
53
|
+
"@eltjs/chunking": "^0.13.9",
|
|
54
|
+
"@eltjs/elt": "^0.13.9",
|
|
55
|
+
"@eltjs/elt-postgresql": "^0.13.9",
|
|
56
|
+
"@eltjs/elt-sqlite": "^0.13.9",
|
|
57
|
+
"@eltjs/elt-sqlserver": "^0.13.9",
|
|
58
|
+
"@eltjs/embedding": "^0.13.9",
|
|
59
|
+
"@zukhruf/async": "^0.8.109",
|
|
60
|
+
"@zukhruf/sqlite-drift": "^0.8.109",
|
|
61
|
+
"@zukhruf/sqlite-transaction": "^0.8.109",
|
|
62
62
|
"ai": "^7.0.165",
|
|
63
63
|
"postgres": "^3.4.9"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@ai-sdk/provider": "^4.0.37",
|
|
67
67
|
"@types/mssql": "^12.3.0",
|
|
68
|
-
"@zukhruf/fs": "^0.8.
|
|
69
|
-
"@zukhruf/retrieval": "^0.8.
|
|
70
|
-
"@zukhruf/sqlite-open": "^0.8.
|
|
71
|
-
"@zukhruf/testing": "^0.8.
|
|
72
|
-
"@zukhruf/vectors": "^0.8.
|
|
68
|
+
"@zukhruf/fs": "^0.8.109",
|
|
69
|
+
"@zukhruf/retrieval": "^0.8.109",
|
|
70
|
+
"@zukhruf/sqlite-open": "^0.8.109",
|
|
71
|
+
"@zukhruf/testing": "^0.8.109",
|
|
72
|
+
"@zukhruf/vectors": "^0.8.109",
|
|
73
73
|
"gpt-tokenizer": "^4.1.2",
|
|
74
74
|
"mssql": "^12.7.4"
|
|
75
75
|
}
|