@kedem/okdb 3.0.0 → 3.0.1

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +38 -3
  2. package/README.md +68 -36
  3. package/bin/okdb +1 -1
  4. package/docs/auth-and-sync.md +30 -24
  5. package/docs/auth-permissions.md +5 -4
  6. package/docs/c-bridge.md +94 -0
  7. package/docs/change-log.md +78 -35
  8. package/docs/data-model.md +32 -8
  9. package/docs/deployment.md +42 -38
  10. package/docs/diagnostics.md +61 -125
  11. package/docs/embeddings.md +143 -51
  12. package/docs/files.md +53 -18
  13. package/docs/fts.md +48 -23
  14. package/docs/functions.md +107 -56
  15. package/docs/getting-started.md +125 -9
  16. package/docs/http-api.md +68 -11
  17. package/docs/http-cluster.md +80 -88
  18. package/docs/index.md +33 -15
  19. package/docs/indexes.md +53 -17
  20. package/docs/licensing.md +18 -4
  21. package/docs/logging.md +11 -22
  22. package/docs/manifest.json +4 -2
  23. package/docs/migration.md +40 -15
  24. package/docs/pipelines.md +96 -32
  25. package/docs/plugins.md +47 -15
  26. package/docs/process-registry.md +23 -24
  27. package/docs/processors.md +26 -23
  28. package/docs/querying.md +102 -29
  29. package/docs/queue.md +167 -51
  30. package/docs/resolved-fields.md +24 -1
  31. package/docs/subscriptions.md +4 -4
  32. package/docs/sync.md +9 -6
  33. package/docs/time-machine.md +40 -11
  34. package/docs/transactions.md +63 -15
  35. package/docs/ttl.md +34 -13
  36. package/docs/upgrade-2.0.md +32 -15
  37. package/docs/upgrade-2.1.md +10 -12
  38. package/docs/upgrade-3.0.md +144 -0
  39. package/docs/views.md +131 -42
  40. package/index.js +1 -1
  41. package/native/linux-x64-gnu/okdb +0 -0
  42. package/native/linux-x64-gnu/okdb-node.linux-x64-gnu.node +0 -0
  43. package/native-loader.js +1 -1
  44. package/okdb-native.js +1 -1
  45. package/package.json +1 -1
  46. package/types/environment.d.ts +32 -11
  47. package/types/errors.d.ts +20 -0
  48. package/types/features/admin.d.ts +3 -5
  49. package/types/features/api.d.ts +5 -7
  50. package/types/features/embeddings.d.ts +8 -7
  51. package/types/features/engines.d.ts +9 -1
  52. package/types/features/files.d.ts +2 -1
  53. package/types/features/fts.d.ts +3 -3
  54. package/types/features/functions.d.ts +14 -8
  55. package/types/features/pipelines.d.ts +10 -10
  56. package/types/features/queue.d.ts +15 -10
  57. package/types/features/sync.d.ts +7 -0
  58. package/types/features/time-machine.d.ts +3 -0
  59. package/types/index.d.ts +3 -0
  60. package/types/okdb.d.ts +70 -7
  61. package/types/options.d.ts +12 -8
  62. package/docs/OKDB-ARCHITECTURE.md +0 -1061
package/docs/files.md CHANGED
@@ -8,29 +8,37 @@ OKDB includes content-addressable blob storage integrated with the database. Fil
8
8
 
9
9
  ## Uploading a file
10
10
 
11
- `upload()` takes a readable stream and an id you choose:
11
+ `upload()` takes the bytes (a readable stream, a `Buffer`/`Uint8Array`, or a string) and an id you choose:
12
12
 
13
13
  ```javascript
14
- const fs = require('fs');
15
- const { Readable } = require('stream');
14
+ const fs = require('node:fs');
15
+ const path = require('node:path');
16
+
17
+ const localFile = path.join(__dirname, 'alice.jpg');
18
+ fs.writeFileSync(localFile, Buffer.from([0xff, 0xd8, 0xff, 0xe0])); // stand-in image bytes
16
19
 
17
20
  const record = await okdb.files.upload({
18
21
  id: 'avatar-alice', // required — the ~files key
19
- stream: fs.createReadStream('/local/alice.jpg'), // required
22
+ stream: fs.createReadStream(localFile), // required — a stream, Buffer or string
20
23
  mime: 'image/jpeg', // default 'application/octet-stream'
21
24
  path: '/avatars/alice.jpg', // optional, full path incl. filename
22
25
  });
23
26
  // record = { id, hash, size, mime, path, createdAt }
24
27
 
25
28
  // From a Buffer
26
- await okdb.files.upload({ id: 'notes-1', stream: Readable.from([buffer]), mime: 'text/plain', path: '/notes/1.txt' });
29
+ await okdb.files.upload({ id: 'notes-1', stream: Buffer.from('hello'), mime: 'text/plain', path: '/notes/1.txt' });
27
30
  ```
28
31
 
29
32
  The bytes are streamed to disk while hashed, then stored at `<okdb-root>/~blobs/<first2>/<rest>` (the SHA-256 hex). Uploading the same bytes again stores them once — the new record points at the existing blob and its reference count goes up. Uploading again under an existing `id` replaces the file: the record is overwritten and the previous blob's reference is released (its file is deleted once nothing else references it). Re-uploading the same bytes under the same `id` leaves the reference count unchanged.
30
33
 
31
34
  Pass `txn` to make the metadata write part of a transaction: the record is written with the transaction, the reference counts (including the release of a replaced blob) are updated after it commits, and a newly written blob is deleted if it rolls back — a rollback leaves the previous blob untouched.
32
35
 
36
+ <!-- continues -->
37
+
33
38
  ```javascript
39
+ await okdb.registerType('invoices');
40
+ const stream = fs.createReadStream(localFile); // any readable stream
41
+
34
42
  const txn = okdb.transaction();
35
43
  await okdb.files.upload({ id: 'invoice-7', stream, mime: 'application/pdf', path: '/invoices/7.pdf', txn });
36
44
  txn.put('invoices', '7', { file: 'invoice-7', total: 120 });
@@ -41,6 +49,8 @@ await txn.commit();
41
49
 
42
50
  ## Reading a file
43
51
 
52
+ <!-- continues -->
53
+
44
54
  ```javascript
45
55
  // Metadata (sync) — the ~files record or null
46
56
  const meta = okdb.files.get('avatar-alice');
@@ -49,8 +59,8 @@ const meta = okdb.files.get('avatar-alice');
49
59
  const buf = await okdb.files.read('avatar-alice');
50
60
 
51
61
  // Stream it
52
- const { stream, record } = await okdb.files.stream('avatar-alice');
53
- stream.pipe(response);
62
+ const download = await okdb.files.stream('avatar-alice'); // → { stream, record }
63
+ download.stream.pipe(fs.createWriteStream(path.join(__dirname, 'copy.jpg'))); // e.g. pipe into an HTTP response
54
64
  ```
55
65
 
56
66
  `read()` and `stream()` reject with `status: 404` when the id is unknown, or when the record exists but its blob is not on this node (`Blob missing for file: <id>`). `get()`, `read()` and `stream()` never create the `~files` type.
@@ -59,9 +69,14 @@ stream.pipe(response);
59
69
 
60
70
  ## Deleting a file
61
71
 
72
+ <!-- continues -->
73
+
62
74
  ```javascript
63
75
  await okdb.files.remove('avatar-alice');
64
- await okdb.files.remove('invoice-7', { txn }); // inside a transaction
76
+
77
+ const tx = okdb.transaction();
78
+ await okdb.files.remove('invoice-7', { txn: tx }); // inside a transaction
79
+ await tx.commit();
65
80
  ```
66
81
 
67
82
  `remove()` deletes the metadata record and decrements the blob's reference count; the blob file is deleted when no `~files` record references that hash any more. It rejects with `status: 404` when the id is unknown.
@@ -70,6 +85,8 @@ await okdb.files.remove('invoice-7', { txn }); // inside a transaction
70
85
 
71
86
  ## Listing files
72
87
 
88
+ <!-- continues -->
89
+
73
90
  ```javascript
74
91
  // Everything (up to `limit`, default 1000)
75
92
  const all = await okdb.files.listPath('/');
@@ -139,29 +156,30 @@ Each OKDB environment has its own `~files` type (metadata lives in that env), bu
139
156
  - The blob is only deleted when the ref count drops to zero
140
157
 
141
158
  ```javascript
159
+ await okdb.createEnvironment('analytics');
142
160
  const analytics = okdb.env('analytics');
143
- await analytics.files.upload({ id: 'q3', stream, mime: 'text/csv', path: '/exports/q3.csv' });
161
+ await analytics.files.upload({ id: 'q3', stream: 'region,total\nEU,120\n', mime: 'text/csv', path: '/exports/q3.csv' });
144
162
  ```
145
163
 
146
164
  ---
147
165
 
148
166
  ## Storage layout
149
167
 
150
- ```
168
+ ```text
151
169
  <okdb-root>/~blobs/
152
170
  ab/cdef1234... ← blob file (path = first2/rest of SHA-256 hex)
153
171
  ff/0123abcd...
154
172
  tmp/ ← in-flight uploads
155
173
  ```
156
174
 
157
- In LMDB:
175
+ In the database:
158
176
 
159
- ```
177
+ ```text
160
178
  ~files ← metadata records, per env (id → { id, hash, size, mime, path, createdAt })
161
179
  ~file:blob_status ← ref-counting sub-db on the default env (hash → { refs, nodes })
162
180
  ```
163
181
 
164
- Maintenance helpers: `files.getBlobStatus(hash)` → `{ refs, nodes } | null`, `files.listBlobStatus()` (the blob table), `files.gcOrphanedBlobs({ minAgeMs })` (deletes blob files whose ref count is 0 or unknown and that no `~files` record references, skipping blobs modified in the last `minAgeMs` — default 10 minutes — since an upload in flight writes its blob before its record; returns the count).
182
+ Maintenance helpers: `files.getBlobStatus(hash)` → `{ refs, … } | null`, `files.listBlobStatus()` (the blob table), `files.gcOrphanedBlobs({ minAgeMs })` (deletes blob files whose ref count is 0 or unknown and that no `~files` record references, skipping blobs modified in the last `minAgeMs` — default 10 minutes — since an upload in flight writes its blob before its record; returns the count).
165
183
 
166
184
  ---
167
185
 
@@ -181,18 +199,33 @@ So metadata can arrive before the bytes. Until they do, `read()`/`stream()` on t
181
199
  Full-text search and embeddings can index what is **in** the files, not only their paths. Turn it on once per environment:
182
200
 
183
201
  ```javascript
202
+ await okdb.files.upload({
203
+ id: 'report',
204
+ stream: 'Quarterly revenue grew 12%.',
205
+ mime: 'text/plain',
206
+ path: '/docs/report.txt',
207
+ });
208
+
184
209
  await okdb.files.indexContent(); // or env.files.indexContent({ field, maxBytes })
185
210
  ```
186
211
 
187
212
  This declares `content` on `~files` as a [resolved field](./resolved-fields.md): nothing is copied into the database — when an index needs a file's content, okdb reads the blob and runs a matching **extractor** to turn the bytes into text. Then index `~files` like any type:
188
213
 
214
+ <!-- continues -->
215
+
189
216
  ```javascript
190
217
  // Full-text search over path + content
191
218
  await okdb.fts.ensure('~files', 'text', { fields: ['path', 'content'] });
219
+ await okdb.fts.flush('~files');
192
220
  const hits = okdb.ftsQuery('~files', 'text', 'quarterly revenue');
193
- for (const { key, value } of hits) console.log(key, value.path);
221
+ for (const { key, value } of hits) console.log(key, value.path); // report /docs/report.txt
222
+ ```
223
+
224
+ Semantic search over the same content:
194
225
 
195
- // Semantic search
226
+ <!-- not-runnable: needs an ML model -->
227
+
228
+ ```javascript
196
229
  const pipeline = await okdb.embeddings.createPipeline('file-search', {
197
230
  source_type: '~files',
198
231
  field: 'content',
@@ -219,8 +252,9 @@ The setting is durable: every process that opens the store — a restart, a seco
219
252
  Built in: `text/*`, `application/json`, `application/xml`, `application/javascript`, `*+json` and `*+xml` are decoded as UTF-8. Nothing else is built in — okdb ships no PDF/Office parsers. For other formats, register an extractor:
220
253
 
221
254
  ```javascript
222
- // Your choice of parser — okdb has no dependency on it.
223
- const pdfToText = require('./my-pdf-to-text');
255
+ // Your choice of parser — okdb has no dependency on it. Stand-ins for this example:
256
+ const pdfToText = async (buffer) => buffer.toString('latin1');
257
+ const docxToText = async (buffer) => null;
224
258
 
225
259
  okdb.files.registerExtractor('application/pdf', async (buffer, record) => {
226
260
  return await pdfToText(buffer); // string, or null for "no content"
@@ -228,10 +262,11 @@ okdb.files.registerExtractor('application/pdf', async (buffer, record) => {
228
262
 
229
263
  // A wildcard or a predicate on the record also works
230
264
  okdb.files.registerExtractor('application/vnd.openxmlformats-officedocument.*', docxToText);
231
- okdb.files.registerExtractor(
265
+ const unregister = okdb.files.registerExtractor(
232
266
  (record) => record.path.endsWith('.log'),
233
267
  (buf) => buf.toString('latin1'),
234
268
  );
269
+ unregister(); // registerExtractor returns an unregister function
235
270
  ```
236
271
 
237
272
  - `match` is a mime (`'application/pdf'`), a wildcard (`'text/*'`, `'*+json'`), or a predicate `(record) => boolean`. Mime parameters are ignored (`text/plain; charset=utf-8` matches `text/plain`).
package/docs/fts.md CHANGED
@@ -1,12 +1,19 @@
1
1
  # Full-Text Search
2
2
 
3
- OKDB includes a built-in full-text search engine. All FTS data for an environment lives in two shared LMDB environments — one inverted/uncompressed (posting lists + dictionaries), one compressed (forward index). Indexes are differentiated by an auto-increment `ftsId` used as a key prefix inside the shared envs, so adding indexes adds no new files and no per-index LMDB overhead.
3
+ OKDB includes a built-in full-text search engine. All FTS data for an environment lives in two shared stores under `~fts/` — one inverted/uncompressed (posting lists + dictionaries), one compressed (forward index). Indexes are differentiated by an auto-increment `ftsId` used as a key prefix inside the shared stores, so adding indexes adds no new files and no per-index overhead. FTS is part of the free tier.
4
4
 
5
5
  ---
6
6
 
7
7
  ## Registering an FTS index
8
8
 
9
9
  ```javascript
10
+ await okdb.registerType('articles');
11
+ await okdb.put('articles', 'a0', {
12
+ title: 'Embedded database for Node.js',
13
+ body: 'Fast and local.',
14
+ status: 'published',
15
+ });
16
+
10
17
  await okdb.fts.register('articles', 'content', {
11
18
  fields: ['title', 'body'], // fields to index
12
19
  tokenizer: {
@@ -14,21 +21,29 @@ await okdb.fts.register('articles', 'content', {
14
21
  maxTokenLength: 64,
15
22
  keepNumbers: true,
16
23
  toLower: true, // case-insensitive search
24
+ stopwords: ['the', 'a'], // optional — tokens never indexed
17
25
  },
18
26
  });
19
27
  ```
20
28
 
21
- The index builds from existing data immediately after registration. Wait for it:
29
+ The index builds from existing data on registration. Wait for it:
30
+
31
+ <!-- continues -->
22
32
 
23
33
  ```javascript
24
34
  await okdb.fts.ready('articles');
25
35
  ```
26
36
 
37
+ `okdb.fts.ensure(type, name, config)` is the idempotent form: it registers the index if it does not exist and otherwise leaves it as is.
38
+
27
39
  ### Multiple FTS indexes on one type
28
40
 
29
41
  You can have several FTS indexes on the same type, each covering different fields or using different tokenizer settings. All of them share the env-level storage — adding a second index does not double your disk usage.
30
42
 
43
+ <!-- continues -->
44
+
31
45
  ```javascript
46
+ await okdb.registerType('products');
32
47
  await okdb.fts.register('products', 'name', { fields: ['name'] });
33
48
  await okdb.fts.register('products', 'description', {
34
49
  fields: ['description'],
@@ -40,6 +55,8 @@ await okdb.fts.register('products', 'description', {
40
55
 
41
56
  ## Querying
42
57
 
58
+ <!-- continues -->
59
+
43
60
  ```javascript
44
61
  const results = okdb.ftsQuery('articles', 'content', 'embedded database Node.js');
45
62
  for (const { key, value } of results) {
@@ -47,13 +64,13 @@ for (const { key, value } of results) {
47
64
  }
48
65
  ```
49
66
 
50
- `ftsQuery` returns records that contain all of the query tokens by default (AND), as `{ key, value, version, score, numTerms, maxScore }` ordered by relevance, **at most 50 by default** (`options.limit`). Use `options.mode: 'or'` for OR semantics, and `options.prefix: true` for prefix matching. `okdb.fts.search(type, name, text, options?)` is the keys-only form (a `string[]`, same default limit).
67
+ `ftsQuery` returns records that contain all of the query tokens by default (AND), as `{ key, value, version, score, numTerms, maxScore }` ordered by relevance, **at most 50 by default** (`options.limit`). Use `options.mode: 'or'` for OR semantics, and `options.prefix: true` for prefix matching. `okdb.fts.search(type, name, text, options?)` is the keys-only form (a `string[]`, same default limit). Both work on any env: `env.ftsQuery(...)`, or pass the env (object or name) as the last argument of `okdb.fts.search(type, name, text, options, env)`.
51
68
 
52
69
  ### Relevance scoring (BM25)
53
70
 
54
71
  Results are ranked with [Okapi BM25](https://en.wikipedia.org/wiki/Okapi_BM25) (k1 = 1.2, b = 0.75):
55
72
 
56
- ```
73
+ ```text
57
74
  score(doc) = Σ over query tokens idf · tf·(k1+1) / (tf + k1·(1 − b + b·docLength/avgDocLength))
58
75
  idf = ln(1 + (N − df + 0.5) / (df + 0.5))
59
76
  ```
@@ -80,8 +97,10 @@ Pass a sift-compatible filter as the fourth argument to narrow results. The filt
80
97
  pass (or the matches run out), so a selective filter still fills the page — no need to inflate
81
98
  `limit`:
82
99
 
100
+ <!-- continues -->
101
+
83
102
  ```javascript
84
- const results = okdb.ftsQuery('articles', 'content', 'database performance', {
103
+ const published = okdb.ftsQuery('articles', 'content', 'database performance', {
85
104
  status: 'published',
86
105
  });
87
106
  ```
@@ -92,8 +111,10 @@ filter and index constraint the same way (see [Hybrid queries](./querying.md#hyb
92
111
 
93
112
  ### Options
94
113
 
114
+ <!-- continues -->
115
+
95
116
  ```javascript
96
- const results = okdb.ftsQuery('articles', 'content', 'hello world', null, {
117
+ const firstPage = okdb.ftsQuery('articles', 'content', 'hello world', null, {
97
118
  limit: 20,
98
119
  mode: 'and', // 'and' (default) | 'or' — OR ranks docs matching more/rarer tokens first
99
120
  prefix: false, // enable prefix matching on tokens
@@ -104,6 +125,8 @@ const results = okdb.ftsQuery('articles', 'content', 'hello world', null, {
104
125
 
105
126
  ## Index management
106
127
 
128
+ <!-- continues -->
129
+
107
130
  ```javascript
108
131
  // Check if an index exists
109
132
  okdb.fts.has('articles', 'content'); // → boolean
@@ -123,11 +146,11 @@ okdb.fts.list('articles');
123
146
  // Env-level storage summary across all FTS indexes
124
147
  okdb.fts.envSize();
125
148
  // → {
126
- // diskBytes, // ~fts/<env>/ + ~fts/<env>_docs/ data.mdb file sizes
149
+ // diskBytes, // ~fts/<env>/ + ~fts/<env>_docs/ file sizes
127
150
  // payloadBytes, // actual stored bytes (indexes + shared dicts)
128
151
  // indexPayloadBytes, // payload attributable to indexes only
129
152
  // sharedDictBytes, // shared docKey↔docId and token↔tokenId mappings
130
- // slackBytes, // LMDB free pages (reclaimable via env.compact)
153
+ // slackBytes, // free pages (reclaimable via env.compact)
131
154
  // indexes: [{ type, name, sizeBytes }],
132
155
  // }
133
156
 
@@ -142,9 +165,9 @@ await okdb.fts.drop('articles', 'content');
142
165
 
143
166
  ## Storage architecture
144
167
 
145
- OKDB's FTS uses a two-tier inverted index with Roaring bitmaps and ID interning. The names below are the actual LMDB sub-DB names in `~fts/<envName>/data.mdb`:
168
+ OKDB's FTS uses a two-tier inverted index with Roaring bitmaps and ID interning. The names below are the actual sub-database names in `~fts/<envName>/data.mdb`:
146
169
 
147
- ```
170
+ ```text
148
171
  ~fts/<envName>/data.mdb (uncompressed env)
149
172
  post dupSort [ftsId, token] → docId (live "add" tier)
150
173
  postDel dupSort [ftsId, token] → docId (live "delete" tombstones)
@@ -180,16 +203,14 @@ length plus the corpus size `N` and average length.
180
203
 
181
204
  **Reads** merge all three tiers: `frozen ∪ liveAdds − liveDeletes`. Roaring's set operations make this essentially free.
182
205
 
183
- **Writes** only touch the live tier — never the frozen tier. The hot path is one dupSort `putSync` per added token.
206
+ **Writes** only touch the live tier — never the frozen tier. The hot path is one dupSort put per added token.
184
207
 
185
208
  ### Compaction
186
209
 
187
210
  The compactor periodically rolls live entries into the frozen tier. It runs in two situations:
188
211
 
189
212
  1. **Automatically after `fts.flush(type)`** — keeps the live tier small after a known burst of writes.
190
- 2. **Explicitly via `fts.compactStorage(env)` or `env.compact()`** — also reclaims `data.mdb` slack by rewriting the file (LMDB never shrinks files in place; freed pages are reused but the high-water mark stays).
191
-
192
- After a stress run of 13k docs across 5 indexes, `env.compact()` typically reclaims ~75% of the FTS file size in a few seconds, with no impact on search.
213
+ 2. **Explicitly via `fts.compactStorage(env)` or `env.compact()`** — also reclaims `data.mdb` slack by rewriting the file (the storage never shrinks files in place; freed pages are reused but the high-water mark stays). Search keeps answering throughout.
193
214
 
194
215
  ### Storage format versioning
195
216
 
@@ -205,16 +226,19 @@ open, still without clearing. Only participating (`processors: true`) instances
205
226
 
206
227
  ## Async indexing
207
228
 
208
- FTS writes are **always async** — the FTS index is updated by a background processor after each write commits. Secondary indexes (field indexes, geo indexes) update synchronously inside the same LMDB transaction as the write, so they are immediately consistent. FTS isn't.
229
+ FTS writes are **always async** — the FTS index is updated by a background processor after each write commits. Secondary indexes (field indexes, geo indexes) update synchronously inside the same transaction as the write, so they are immediately consistent. FTS isn't.
209
230
 
210
231
  ```javascript
232
+ await okdb.registerType('articles');
233
+ await okdb.fts.register('articles', 'main', { fields: ['title'] });
234
+
211
235
  await okdb.put('articles', 'a1', { title: 'Hello world' });
212
- // At this point a1 is in the primary data but NOT YET in the FTS index.
236
+ // a1 is in the primary data; the FTS index may not have it yet.
213
237
 
214
238
  await okdb.fts.flush('articles');
215
- // Now it is — and the live tier has been compacted into the frozen tier.
239
+ // Now it does — and the live tier has been compacted into the frozen tier.
216
240
 
217
- const results = okdb.fts.search('articles', 'main', 'hello'); // includes a1
241
+ const results = okdb.fts.search('articles', 'main', 'hello'); // → ['a1']
218
242
  ```
219
243
 
220
244
  ### `ready(type)`
@@ -240,10 +264,11 @@ Default behaviour:
240
264
 
241
265
  - Splits on whitespace and punctuation
242
266
  - Lowercases (when `toLower: true`, default)
243
- - Discards tokens shorter than `minTokenLength` (default 2) or longer than `maxTokenLength` (default 64)
244
- - Keeps numbers by default (`keepNumbers: true`)
267
+ - Discards tokens shorter than `minTokenLength` (default 2) and cuts tokens longer than `maxTokenLength` (default 64) to that length
268
+ - Keeps pure-number tokens by default (`keepNumbers: true`)
269
+ - Drops the tokens listed in `stopwords` (default: none)
245
270
 
246
- You can override per-index in the `register()` config.
271
+ There is no stemming and no language-specific rule. You can override these per index in the `register()` config.
247
272
 
248
273
  ---
249
274
 
@@ -256,7 +281,7 @@ FTS environments are not replicated. On a new node they rebuild from synced type
256
281
  ## Example: articles with FTS
257
282
 
258
283
  ```javascript
259
- await okdb.ensureType('articles');
284
+ await okdb.registerType('articles');
260
285
  await okdb.fts.register('articles', 'search', {
261
286
  fields: ['title', 'body', 'tags'],
262
287
  });
@@ -264,7 +289,7 @@ await okdb.fts.ready('articles');
264
289
 
265
290
  await okdb.put('articles', 'a1', {
266
291
  title: 'Getting started with LMDB',
267
- body: 'LMDB is a B+ tree key-value store with MVCC...',
292
+ body: 'LMDB is a B+ tree key-value store with MVCC.',
268
293
  tags: ['database', 'lmdb', 'storage'],
269
294
  });
270
295