@delali/narsil 0.3.1-next.128 → 0.3.1-next.130

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 (108) hide show
  1. package/dist/adapters/filesystem.mjs +1 -1
  2. package/dist/adapters/indexeddb.mjs +1 -1
  3. package/dist/browser/chunk-26A5JFT2.mjs +89 -0
  4. package/dist/browser/{chunk-4Y2EGA3U.mjs → chunk-2Y3CO4EQ.mjs} +878 -310
  5. package/dist/browser/{chunk-2CBQ2PCC.mjs → chunk-AIIJDWMG.mjs} +1 -1
  6. package/dist/browser/{chunk-P7C2S5JX.mjs → chunk-D7WQF6DV.mjs} +2 -2
  7. package/dist/browser/{chunk-V5DCQIOT.mjs → chunk-M5UAAXGU.mjs} +2 -2
  8. package/dist/browser/{chunk-B65QVTST.mjs → chunk-NSCSR6MA.mjs} +24 -9
  9. package/dist/browser/{chunk-LJS6PREA.mjs → chunk-UDGB2MWT.mjs} +7 -28
  10. package/dist/browser/{chunk-6POI2KNI.mjs → chunk-VBBLTD7O.mjs} +4 -3
  11. package/dist/browser/chunk-VEGHFP2P.mjs +30 -0
  12. package/dist/browser/{durability-wiring-PUC4QSCR.mjs → durability-wiring-FNZSRH4N.mjs} +8 -6
  13. package/dist/browser/{module-ACWDC7YI.mjs → module-4HIMOQM5.mjs} +6 -5
  14. package/dist/browser/phrase-module-WESYVU7K.mjs +327 -0
  15. package/dist/browser/{restore-queue-MLUEUEAN.mjs → restore-queue-GEZ54CA5.mjs} +1 -1
  16. package/dist/browser/{runtime-BX6XRFYR.mjs → runtime-3X7ZJ5T3.mjs} +2 -1
  17. package/dist/browser/{snapshot-U5Y346XG.mjs → snapshot-V7VF6BN6.mjs} +25 -10
  18. package/dist/browser/{write-GZHR6AVG.mjs → write-YIC2MKRY.mjs} +7 -5
  19. package/dist/{capabilities-9YwwCcqP.d.ts → capabilities-Bl8G9taj.d.ts} +10 -3
  20. package/dist/{chunk-VK45J47R.mjs → chunk-2C3WXBQS.mjs} +1 -1
  21. package/dist/{chunk-QSCVJJW5.mjs → chunk-2JWNJSNE.mjs} +8 -8
  22. package/dist/{chunk-IBGMFR5Y.mjs → chunk-2MKX2SCO.mjs} +481 -121
  23. package/dist/{chunk-P34VZEXB.mjs → chunk-2SEL6SBS.mjs} +4 -95
  24. package/dist/{chunk-7ZZQNOIY.mjs → chunk-2WBY4Y4M.mjs} +1 -1
  25. package/dist/{chunk-HFJXEFFV.mjs → chunk-4GDLFDPZ.mjs} +3 -3
  26. package/dist/chunk-4UMZ7KQL.mjs +17 -0
  27. package/dist/{chunk-ZR63OGT2.mjs → chunk-5LX6MOIB.mjs} +2 -2
  28. package/dist/{chunk-UKXMSO5H.mjs → chunk-6M6SDH3S.mjs} +189 -45
  29. package/dist/{chunk-IR4KQ4WB.mjs → chunk-6SSVIW7Y.mjs} +49 -31
  30. package/dist/{chunk-4IHMMDRF.mjs → chunk-7OIQ2SIO.mjs} +4 -4
  31. package/dist/{chunk-6ODIY6ZB.mjs → chunk-7XY6VD7B.mjs} +1 -1
  32. package/dist/{chunk-OBWUWZRA.mjs → chunk-CZ7ISLXA.mjs} +3 -0
  33. package/dist/{chunk-OFYKBKKV.mjs → chunk-D5TFRB5G.mjs} +3 -15
  34. package/dist/{chunk-KCQG2PJT.mjs → chunk-EUCX5K74.mjs} +4 -4
  35. package/dist/{chunk-HWQDZB2U.mjs → chunk-F6AAXI7T.mjs} +3 -3
  36. package/dist/{chunk-E74YLAIG.mjs → chunk-FQBFZAWG.mjs} +4 -1
  37. package/dist/{chunk-U6NGTWI3.mjs → chunk-HCGJKDZV.mjs} +1 -1
  38. package/dist/{chunk-SJEIIR56.mjs → chunk-JJ6EUMXB.mjs} +2 -2
  39. package/dist/{chunk-N57XXGPG.mjs → chunk-JT3YZGCE.mjs} +23 -4
  40. package/dist/chunk-JUKYYXSP.mjs +93 -0
  41. package/dist/{chunk-JIXO442E.mjs → chunk-K77FJXKS.mjs} +26 -10
  42. package/dist/{chunk-4PQNDHSA.mjs → chunk-NMXRXFGZ.mjs} +2 -2
  43. package/dist/{chunk-6PN3U6XW.mjs → chunk-NNO7CO3A.mjs} +1 -1
  44. package/dist/{chunk-542TD4BL.mjs → chunk-PATMDIMN.mjs} +1 -1
  45. package/dist/{chunk-DG62H7OD.mjs → chunk-PU6SKH7O.mjs} +2 -2
  46. package/dist/chunk-Q2AP2FSN.mjs +15 -0
  47. package/dist/{chunk-22CK2LQO.mjs → chunk-QQTXT65X.mjs} +6 -5
  48. package/dist/{chunk-LXWDQLTW.mjs → chunk-RNSC4NFI.mjs} +1 -1
  49. package/dist/{chunk-JEXJDCQH.mjs → chunk-RWESFSJI.mjs} +28 -13
  50. package/dist/{chunk-SEG4CL6W.mjs → chunk-SOHMMNCH.mjs} +4 -4
  51. package/dist/{chunk-OGFSUXYY.mjs → chunk-SZGRYEIC.mjs} +4 -4
  52. package/dist/{chunk-LOBYK2FG.mjs → chunk-T4OFG4IQ.mjs} +20 -9
  53. package/dist/{chunk-ENBN5VQ6.mjs → chunk-TGHNXN7W.mjs} +150 -52
  54. package/dist/{chunk-Z4DZ4KK2.mjs → chunk-UJWGQIXU.mjs} +1 -0
  55. package/dist/{chunk-ANFNYCQG.mjs → chunk-WVRDRLIC.mjs} +6 -6
  56. package/dist/{chunk-62IPM62F.mjs → chunk-X5CNUKD5.mjs} +2 -2
  57. package/dist/{chunk-IE43SRL3.mjs → chunk-XABMCBHA.mjs} +12 -6
  58. package/dist/{chunk-OCB7TMUQ.mjs → chunk-Y2U5VVWX.mjs} +1 -1
  59. package/dist/{chunk-MFPJVITN.mjs → chunk-Y4BVTQ53.mjs} +2 -2
  60. package/dist/{chunk-N6J6EJW3.mjs → chunk-YBWSV5DV.mjs} +2 -2
  61. package/dist/{chunk-FUUP45IS.mjs → chunk-ZR4VM4A6.mjs} +1 -1
  62. package/dist/{client-CsuhZ13c.d.ts → client-Cx-TiqPE.d.ts} +19 -3
  63. package/dist/client.d.ts +8 -8
  64. package/dist/client.mjs +10 -2
  65. package/dist/{config-CtTfxbpV.d.ts → config-CzB9YvF_.d.ts} +2 -2
  66. package/dist/{config-DLVnlByZ.d.ts → config-hOWGBeC6.d.ts} +7 -5
  67. package/dist/direct-executor-HQ4QVDX7.mjs +28 -0
  68. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  69. package/dist/distribution/coordinator/etcd.mjs +18 -1
  70. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  71. package/dist/distribution/coordinator/in-memory.mjs +33 -1
  72. package/dist/distribution/transport/grpc.mjs +1 -1
  73. package/dist/distribution.d.ts +71 -43
  74. package/dist/distribution.mjs +411 -127
  75. package/dist/{durability-wiring-UGGUNATA.mjs → durability-wiring-S7OX2MAI.mjs} +28 -26
  76. package/dist/embeddings/openai.mjs +2 -2
  77. package/dist/{engine-Bq5wz6c1.d.ts → engine-B_W9sdZK.d.ts} +38 -8
  78. package/dist/{events-x2aVu0_o.d.ts → events-DErop1LM.d.ts} +23 -2
  79. package/dist/{index-Cl5qQauj.d.ts → index-CKI1fDEl.d.ts} +37 -3
  80. package/dist/index.browser.mjs +5 -3
  81. package/dist/index.d.ts +7 -7
  82. package/dist/index.mjs +21 -19
  83. package/dist/{long-query-thread-5BIPZVS6.mjs → long-query-thread-WVSMIBYP.mjs} +17 -15
  84. package/dist/{module-7OHZ2OPI.mjs → module-2E4XYSGT.mjs} +11 -11
  85. package/dist/partial-words.mjs +7 -6
  86. package/dist/pattern.mjs +4 -3
  87. package/dist/persistence/durability/checkpoint-worker.d.ts +3 -1
  88. package/dist/persistence/durability/checkpoint-worker.mjs +24 -22
  89. package/dist/phrase-module-JERF2IDG.mjs +329 -0
  90. package/dist/react.d.ts +7 -7
  91. package/dist/react.mjs +3 -0
  92. package/dist/{rerank-NYX5S7OG.mjs → rerank-DMMT4FZA.mjs} +6 -6
  93. package/dist/rerankers/http.mjs +2 -2
  94. package/dist/{restore-queue-NVMWJMHI.mjs → restore-queue-JAMNRC6T.mjs} +1 -1
  95. package/dist/{runtime-XNYW6AWX.mjs → runtime-7MLQ7J64.mjs} +7 -7
  96. package/dist/{schema-4W_7tk1f.d.ts → schema-CS-clLun.d.ts} +54 -28
  97. package/dist/server.d.ts +10 -10
  98. package/dist/server.mjs +27 -15
  99. package/dist/{snapshot-P7IQGNNQ.mjs → snapshot-DOQLGGEX.mjs} +45 -30
  100. package/dist/synonyms.mjs +4 -3
  101. package/dist/{tasks-DLQIfXqy.d.ts → tasks-BfF-VRhm.d.ts} +4 -6
  102. package/dist/{thread-QPETQEPK.mjs → thread-DNK5XWXG.mjs} +16 -14
  103. package/dist/vector/search-worker.d.ts +1 -1
  104. package/dist/vector/search-worker.mjs +4 -4
  105. package/dist/workers/entry.mjs +8 -8
  106. package/dist/{write-WZVM7ZL6.mjs → write-ZKR7SNRT.mjs} +23 -21
  107. package/package.json +7 -7
  108. package/dist/direct-executor-6KCVVHYT.mjs +0 -26
@@ -1,5 +1,5 @@
1
1
  import { english } from './chunk-TGP5M5R7.mjs';
2
- import { NarsilError, ErrorCodes } from './chunk-OBWUWZRA.mjs';
2
+ import { NarsilError, ErrorCodes } from './chunk-CZ7ISLXA.mjs';
3
3
 
4
4
  // src/languages/registry.ts
5
5
  var languages = /* @__PURE__ */ new Map();
@@ -1,7 +1,7 @@
1
- import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-4W_7tk1f.js';
2
- import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, Q as QueryParams, e as QueryResult, P as PreflightResult, h as SuggestParams, j as SuggestResult } from './events-x2aVu0_o.js';
1
+ import { P as PartitionConfig, B as BM25Params, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-CS-clLun.js';
2
+ import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, Q as QueryParams, e as QueryResult, P as PreflightResult, h as SuggestParams, j as SuggestResult } from './events-DErop1LM.js';
3
3
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
4
- import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-DLQIfXqy.js';
4
+ import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-BfF-VRhm.js';
5
5
 
6
6
  /**
7
7
  * This is the `fetch` implementation the client sends every request through.
@@ -301,6 +301,22 @@ interface AdminOperations {
301
301
  * set passes its limits. The index then keeps the set that it held before.
302
302
  */
303
303
  updateSynonyms(indexName: string, synonyms: SynonymRule[], options?: RequestOptions): Promise<void>;
304
+ /**
305
+ * Replaces the BM25 setting of an index, which takes effect from the next
306
+ * search without a rebuild. A value that the call leaves out returns to its
307
+ * default, and `{}` clears the setting.
308
+ *
309
+ * @param indexName - The server replaces the setting of this index.
310
+ * @param bm25 - This is the new setting, in the shape that
311
+ * {@link BM25Params} describes.
312
+ * @param options - This sets the signal, the deadline, and the headers for
313
+ * this request.
314
+ * @throws A `NarsilError` with `CONFIG_INVALID` when `k1` is not a number
315
+ * from 0 to 1,000, when `b` is not a number from 0 to 1, or when `fields`
316
+ * holds a name that is not a text field. The index then keeps the setting
317
+ * that it held before.
318
+ */
319
+ updateBM25(indexName: string, bm25: BM25Params, options?: RequestOptions): Promise<void>;
304
320
  /**
305
321
  * Reads the synonym set of an index, with every word as the caller wrote it.
306
322
  *
package/dist/client.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-x2aVu0_o.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-9YwwCcqP.js';
3
- export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-DLQIfXqy.js';
4
- export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-CsuhZ13c.js';
5
- import './schema-4W_7tk1f.js';
1
+ export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-DErop1LM.js';
2
+ export { A as ASYNC_IMPORT_CAPABILITY, B as BM25_TUNING_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-Bl8G9taj.js';
3
+ export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-BfF-VRhm.js';
4
+ export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-Cx-TiqPE.js';
5
+ import './schema-CS-clLun.js';
6
6
  import './adapters-BQFQ4PRz.js';
7
7
  import './synonyms-CpOAHPa-.js';
8
- import './config-CtTfxbpV.js';
9
- import './config-DLVnlByZ.js';
10
- import './index-Cl5qQauj.js';
8
+ import './config-CzB9YvF_.js';
9
+ import './config-hOWGBeC6.js';
10
+ import './index-CKI1fDEl.js';
11
11
  import './types-DvncmvuQ.js';
package/dist/client.mjs CHANGED
@@ -32,6 +32,9 @@ var ErrorCodes = {
32
32
  SEARCH_INVALID_CURSOR: "SEARCH_INVALID_CURSOR",
33
33
  SEARCH_RESULT_WINDOW_EXCEEDED: "SEARCH_RESULT_WINDOW_EXCEEDED",
34
34
  SEARCH_WORK_CAP_EXCEEDED: "SEARCH_WORK_CAP_EXCEEDED",
35
+ SEARCH_INVALID_PHRASE: "SEARCH_INVALID_PHRASE",
36
+ SEARCH_PHRASE_NOT_READY: "SEARCH_PHRASE_NOT_READY",
37
+ BM25_NOT_READY: "BM25_NOT_READY",
35
38
  LANGUAGE_NOT_SUPPORTED: "LANGUAGE_NOT_SUPPORTED",
36
39
  ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
37
40
  ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
@@ -166,6 +169,7 @@ var REBUILD_ANALYSIS_CAPABILITY = "indexes.rebuildAnalysis";
166
169
  var INDEX_LIFECYCLE_CAPABILITY = "indexes.lifecycle";
167
170
  var DOCUMENT_EXPORT_CAPABILITY = "indexes.documentExport";
168
171
  var SYNONYMS_CAPABILITY = "indexes.synonyms";
172
+ var BM25_TUNING_CAPABILITY = "indexes.bm25";
169
173
  var SERVER_CAPABILITIES = [
170
174
  ASYNC_IMPORT_CAPABILITY,
171
175
  TASK_CANCEL_CAPABILITY,
@@ -173,7 +177,8 @@ var SERVER_CAPABILITIES = [
173
177
  REBUILD_ANALYSIS_CAPABILITY,
174
178
  INDEX_LIFECYCLE_CAPABILITY,
175
179
  DOCUMENT_EXPORT_CAPABILITY,
176
- SYNONYMS_CAPABILITY
180
+ SYNONYMS_CAPABILITY,
181
+ BM25_TUNING_CAPABILITY
177
182
  ];
178
183
 
179
184
  // src/json-encoding.ts
@@ -323,6 +328,9 @@ function createAdminOperations(transport) {
323
328
  async updateSynonyms(indexName, synonyms, options) {
324
329
  await postJson(`${indexPath(indexName)}/synonyms`, { synonyms }, options);
325
330
  },
331
+ async updateBM25(indexName, bm25, options) {
332
+ await postJson(`${indexPath(indexName)}/bm25`, bm25, options);
333
+ },
326
334
  async getSynonyms(indexName, options) {
327
335
  const path = `${indexPath(indexName)}/synonyms`;
328
336
  const body = await readBody(
@@ -1056,4 +1064,4 @@ function createNarsilClient(options) {
1056
1064
  };
1057
1065
  }
1058
1066
 
1059
- export { ASYNC_IMPORT_CAPABILITY, ClientErrorCodes, DOCUMENT_EXPORT_CAPABILITY, ErrorCodes, INDEX_LIFECYCLE_CAPABILITY, NarsilError, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, SYNONYMS_CAPABILITY, ServerErrorCodes, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, createNarsilClient, isNarsilError };
1067
+ export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, ClientErrorCodes, DOCUMENT_EXPORT_CAPABILITY, ErrorCodes, INDEX_LIFECYCLE_CAPABILITY, NarsilError, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, SYNONYMS_CAPABILITY, ServerErrorCodes, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, createNarsilClient, isNarsilError };
@@ -1,5 +1,5 @@
1
- import { N as NarsilConfig } from './config-DLVnlByZ.js';
2
- import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './index-Cl5qQauj.js';
1
+ import { N as NarsilConfig } from './config-hOWGBeC6.js';
2
+ import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './index-CKI1fDEl.js';
3
3
  import { N as NodeTransport } from './types-DvncmvuQ.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter, R as RerankAdapter } from './adapters-BQFQ4PRz.js';
2
- import { Q as QueryParams, e as QueryResult, f as NarsilEventHandlers } from './events-x2aVu0_o.js';
3
- import { I as IndexConfig, A as AnyDocument } from './schema-4W_7tk1f.js';
2
+ import { Q as QueryParams, e as QueryResult, f as NarsilEventHandlers } from './events-DErop1LM.js';
3
+ import { I as IndexConfig, A as AnyDocument } from './schema-CS-clLun.js';
4
4
 
5
5
  /**
6
6
  * Hooks that the engine calls alongside its own work, so that an application
@@ -229,9 +229,11 @@ interface NarsilConfig {
229
229
  */
230
230
  events?: NarsilEventHandlers;
231
231
  /**
232
- * This is the most work that the engine may do on the pattern tests of one
233
- * search, counted over every partition that it searches. The engine adds one
234
- * unit for each run of three code points that it looks up in a pattern
232
+ * This is the most work that the engine may do on the pattern tests and
233
+ * phrases of one search, counted over every partition that it searches. For
234
+ * a phrase, the engine adds one unit for each posting of its starting word
235
+ * that it visits, and one for each position that it compares. For a pattern
236
+ * test, it adds one unit for each run of three code points that it looks up in a pattern
235
237
  * index, one for each entry that it reads from a pattern index, and one for
236
238
  * each step of its matcher. For a text whose case fold is shorter than three
237
239
  * code points, it counts each document that it checks as an entry that it
@@ -0,0 +1,28 @@
1
+ export { createDirectExecutor } from './chunk-RWESFSJI.mjs';
2
+ import './chunk-2MKX2SCO.mjs';
3
+ import './chunk-ZR4VM4A6.mjs';
4
+ import './chunk-ZATRDAYU.mjs';
5
+ import './chunk-EBIHRL7B.mjs';
6
+ import './chunk-TGP5M5R7.mjs';
7
+ import './chunk-U2BKYEC7.mjs';
8
+ import './chunk-2SEL6SBS.mjs';
9
+ import './chunk-WQBCBKY3.mjs';
10
+ import './chunk-JUKYYXSP.mjs';
11
+ import './chunk-EUCX5K74.mjs';
12
+ import './chunk-PU6SKH7O.mjs';
13
+ import './chunk-U476IXKQ.mjs';
14
+ import './chunk-FQBFZAWG.mjs';
15
+ import './chunk-VJS4JFBQ.mjs';
16
+ import './chunk-GES7U2PM.mjs';
17
+ import './chunk-7XY6VD7B.mjs';
18
+ import './chunk-6SSVIW7Y.mjs';
19
+ import './chunk-X5CV2E2B.mjs';
20
+ import './chunk-7X5JST5L.mjs';
21
+ import './chunk-D5TFRB5G.mjs';
22
+ import './chunk-4UMZ7KQL.mjs';
23
+ import './chunk-R6A773WK.mjs';
24
+ import './chunk-YTJCGKM4.mjs';
25
+ import './chunk-HCGJKDZV.mjs';
26
+ import './chunk-22YPZVMG.mjs';
27
+ import './chunk-L5ORED7V.mjs';
28
+ import './chunk-CZ7ISLXA.mjs';
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../index-Cl5qQauj.js';
2
- import '../../schema-4W_7tk1f.js';
1
+ import { C as ClusterCoordinator } from '../../index-CKI1fDEl.js';
2
+ import '../../schema-CS-clLun.js';
3
3
  import '../../adapters-BQFQ4PRz.js';
4
4
  import '../../synonyms-CpOAHPa-.js';
5
5
 
@@ -1,7 +1,8 @@
1
+ import { INDEX_METADATA_KEY_PREFIX, indexNameOfMetadataSuffix } from '../../chunk-Q2AP2FSN.mjs';
1
2
  import { MAX_NODE_ID_LENGTH, CONTROLLER_LEASE_KEY, MAX_WATCHERS } from '../../chunk-44W3CBNG.mjs';
2
3
  import '../../chunk-R6A773WK.mjs';
3
4
  import { compareCodePoints } from '../../chunk-YTJCGKM4.mjs';
4
- import { NarsilError, ErrorCodes, describeError } from '../../chunk-OBWUWZRA.mjs';
5
+ import { NarsilError, ErrorCodes, describeError } from '../../chunk-CZ7ISLXA.mjs';
5
6
  import { encode, decode } from '@msgpack/msgpack';
6
7
 
7
8
  // src/distribution/coordinator/etcd/constants.ts
@@ -760,6 +761,22 @@ function storedValueMethods(context) {
760
761
  handler({ type: "schema_dropped", indexName: extractSuffix(fullKey, prefix), schema: null });
761
762
  }
762
763
  });
764
+ },
765
+ async watchIndexMetadata(handler) {
766
+ assertNotShutdown();
767
+ const prefix = keys.generic(INDEX_METADATA_KEY_PREFIX);
768
+ const nameOf = (fullKey) => indexNameOfMetadataSuffix(fullKey.slice(prefix.length));
769
+ return watchPrefix2(prefix, {
770
+ put(kv) {
771
+ const indexName = nameOf(kv.key.toString());
772
+ if (indexName === null) return;
773
+ handler({ indexName, metadata: kv.value.byteLength === 0 ? null : new Uint8Array(kv.value) });
774
+ },
775
+ delete(fullKey) {
776
+ const indexName = nameOf(fullKey);
777
+ if (indexName !== null) handler({ indexName, metadata: null });
778
+ }
779
+ });
763
780
  }
764
781
  };
765
782
  }
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../index-Cl5qQauj.js';
2
- import '../../schema-4W_7tk1f.js';
1
+ import { C as ClusterCoordinator } from '../../index-CKI1fDEl.js';
2
+ import '../../schema-CS-clLun.js';
3
3
  import '../../adapters-BQFQ4PRz.js';
4
4
  import '../../synonyms-CpOAHPa-.js';
5
5
 
@@ -1,7 +1,32 @@
1
+ import { indexNameOfMetadataKey } from '../../chunk-Q2AP2FSN.mjs';
1
2
  import { CONTROLLER_LEASE_KEY, NODE_HEARTBEAT_TTL_MS } from '../../chunk-44W3CBNG.mjs';
2
3
  import '../../chunk-R6A773WK.mjs';
3
4
  import { compareCodePoints } from '../../chunk-YTJCGKM4.mjs';
4
5
 
6
+ // src/distribution/coordinator/index-metadata-watchers.ts
7
+ function createIndexMetadataWatchers() {
8
+ const handlers = /* @__PURE__ */ new Set();
9
+ return {
10
+ watch(handler) {
11
+ handlers.add(handler);
12
+ return () => {
13
+ handlers.delete(handler);
14
+ };
15
+ },
16
+ emit(key, value) {
17
+ const indexName = indexNameOfMetadataKey(key);
18
+ if (indexName === null) return;
19
+ const metadata = value === null || value.byteLength === 0 ? null : new Uint8Array(value);
20
+ for (const handler of handlers) {
21
+ try {
22
+ handler({ indexName, metadata });
23
+ } catch (_) {
24
+ }
25
+ }
26
+ }
27
+ };
28
+ }
29
+
5
30
  // src/distribution/coordinator/in-memory.ts
6
31
  var NODE_HEARTBEAT_PREFIX = "_narsil/node/";
7
32
  function bytesEqual(a, b) {
@@ -26,6 +51,7 @@ function createInMemoryCoordinator() {
26
51
  const nodeWatchers = /* @__PURE__ */ new Set();
27
52
  const allocationWatchers = /* @__PURE__ */ new Set();
28
53
  const schemaWatchers = /* @__PURE__ */ new Set();
54
+ const indexMetadataWatchers = createIndexMetadataWatchers();
29
55
  let isShutdown = false;
30
56
  function assertNotShutdown() {
31
57
  if (isShutdown) {
@@ -232,6 +258,7 @@ function createInMemoryCoordinator() {
232
258
  return false;
233
259
  }
234
260
  kvStore.set(key, new Uint8Array(value));
261
+ indexMetadataWatchers.emit(key, value);
235
262
  return true;
236
263
  }
237
264
  if (current === void 0) {
@@ -241,11 +268,12 @@ function createInMemoryCoordinator() {
241
268
  return false;
242
269
  }
243
270
  kvStore.set(key, new Uint8Array(value));
271
+ indexMetadataWatchers.emit(key, value);
244
272
  return true;
245
273
  },
246
274
  async delete(key) {
247
275
  assertNotShutdown();
248
- kvStore.delete(key);
276
+ if (kvStore.delete(key)) indexMetadataWatchers.emit(key, null);
249
277
  },
250
278
  async getSchema(indexName) {
251
279
  assertNotShutdown();
@@ -274,6 +302,10 @@ function createInMemoryCoordinator() {
274
302
  schemaWatchers.delete(handler);
275
303
  };
276
304
  },
305
+ async watchIndexMetadata(handler) {
306
+ assertNotShutdown();
307
+ return indexMetadataWatchers.watch(handler);
308
+ },
277
309
  async getLeaseHolder(key) {
278
310
  assertNotShutdown();
279
311
  if (!isLeaseValid(key)) {
@@ -2,7 +2,7 @@ import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-J6YV
2
2
  import { timeoutsOf, replyDeadlineMs } from '../../chunk-PWIWSUCX.mjs';
3
3
  import { MAX_MESSAGE_SIZE_BYTES, GRPC_KEEPALIVE_TIMEOUT_MS, GRPC_KEEPALIVE_TIME_MS, GRPC_ENVELOPE_OVERHEAD_BYTES } from '../../chunk-UNEEFTEU.mjs';
4
4
  import { TransportError, TransportErrorCodes } from '../../chunk-YH5OIL7B.mjs';
5
- import { NarsilError, ErrorCodes } from '../../chunk-OBWUWZRA.mjs';
5
+ import { NarsilError, ErrorCodes } from '../../chunk-CZ7ISLXA.mjs';
6
6
 
7
7
  // src/distribution/transport/grpc/codec.ts
8
8
  var FIELD_ONE_LENGTH_DELIMITED_KEY = 10;
@@ -1,14 +1,14 @@
1
- import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-CtTfxbpV.js';
2
- export { c as ClusterControllerConfig, d as ClusterHealth, e as ClusterHealthStatus, f as ClusterMemoryConfig, g as ClusterMetrics, h as ClusterNodeInfo, i as ClusterQueryConfig, j as CommitPointFigure, k as CoordinatorRequestFigure, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, l as ReplicationConfig, V as VectorRebuildWaitFigure } from './config-CtTfxbpV.js';
1
+ import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-CzB9YvF_.js';
2
+ export { c as ClusterControllerConfig, d as ClusterHealth, e as ClusterHealthStatus, f as ClusterMemoryConfig, g as ClusterMetrics, h as ClusterNodeInfo, i as ClusterQueryConfig, j as CommitPointFigure, k as CoordinatorRequestFigure, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, l as ReplicationConfig, V as VectorRebuildWaitFigure } from './config-CzB9YvF_.js';
3
3
  import { R as RerankAdapter } from './adapters-BQFQ4PRz.js';
4
- import { B as BatchResult, L as ListParams, g as ListResult, h as SuggestParams, j as SuggestResult, Q as QueryParams, P as PreflightResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './events-x2aVu0_o.js';
5
- import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-4W_7tk1f.js';
4
+ import { B as BatchResult, L as ListParams, g as ListResult, h as SuggestParams, j as SuggestResult, Q as QueryParams, P as PreflightResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './events-DErop1LM.js';
5
+ import { B as BM25Params, I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-CS-clLun.js';
6
+ import { b as NodeCapacity, N as NodeRole } from './index-CKI1fDEl.js';
7
+ export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, I as IndexMetadataEvent, e as IndexMetadataWatch, f as IndexPartitionBytes, g as NodeEvent, h as NodeMemoryReport, a as NodeRegistration, P as PartitionAssignment, i as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-CKI1fDEl.js';
6
8
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
7
- import { b as NodeCapacity, N as NodeRole } from './index-Cl5qQauj.js';
8
- export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, I as IndexPartitionBytes, e as NodeEvent, f as NodeMemoryReport, a as NodeRegistration, P as PartitionAssignment, g as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-Cl5qQauj.js';
9
- import { N as Narsil } from './engine-Bq5wz6c1.js';
9
+ import { N as Narsil } from './engine-B_W9sdZK.js';
10
10
  export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-DvncmvuQ.js';
11
- import './config-DLVnlByZ.js';
11
+ import './config-hOWGBeC6.js';
12
12
 
13
13
  /**
14
14
  * The cluster splits an index into this many partitions when
@@ -36,6 +36,67 @@ declare const DEFAULT_REPLICATION_FACTOR = 1;
36
36
  */
37
37
  declare const DEFAULT_CAPACITY: NodeCapacity;
38
38
 
39
+ /**
40
+ * Changes the search settings of a live index across a cluster.
41
+ *
42
+ * @public
43
+ */
44
+ interface ClusterNodeSearchSettings {
45
+ /**
46
+ * Replaces the synonym set of an index across the cluster, so that every
47
+ * search that starts after the promise resolves expands its words with the
48
+ * new set.
49
+ *
50
+ * The node stores the set in the coordinator before it asks each node that
51
+ * holds a partition of the index to apply the set. The promise resolves
52
+ * once every one of those nodes answers. Pass an empty list to remove the
53
+ * set.
54
+ *
55
+ * @param indexName - The index whose set the cluster replaces.
56
+ * @param synonyms - The new set, in the shape that {@link SynonymRule}
57
+ * describes.
58
+ * @throws A `NarsilError` with `CONFIG_INVALID` when a rule breaks that
59
+ * shape, when a word analyses to no token or to more than one, or when the
60
+ * set passes 100,000 rules, 500,000 words, or 4,194,304 bytes of words in
61
+ * UTF-8. It throws `CLUSTER_WRITE_BLOCKED` when the index metadata changes
62
+ * between the node's read and its write on every one of its tries, and
63
+ * `QUERY_NODE_TIMEOUT` when a node holding a partition gives no answer.
64
+ * After a timeout, the coordinator keeps the new set, so a retry of the
65
+ * same call can finish applying it.
66
+ */
67
+ updateSynonyms(indexName: string, synonyms: SynonymRule[]): Promise<void>;
68
+ /**
69
+ * Returns the synonym set that the coordinator holds for an index, with
70
+ * every word as the caller wrote it, or an empty list when the index holds
71
+ * no set.
72
+ *
73
+ * @param indexName - The index whose set the node returns.
74
+ * @throws A `NarsilError` with `INDEX_NOT_FOUND` when the cluster holds no
75
+ * index under that name.
76
+ */
77
+ getSynonyms(indexName: string): Promise<SynonymRule[]>;
78
+ /**
79
+ * Replaces the BM25 setting of an index across the cluster, so that this
80
+ * node scores every search that starts after the promise resolves under the
81
+ * new setting.
82
+ *
83
+ * The call replaces the whole setting, and `{}` clears it. The promise
84
+ * resolves once the coordinator stores the setting and this node applies it.
85
+ * Every other node follows through its watch of the index metadata, so a
86
+ * search that another node coordinates can use the old setting for that
87
+ * time.
88
+ *
89
+ * @param indexName - The index whose setting the node replaces.
90
+ * @param bm25 - The new setting, in the shape that {@link BM25Params} describes.
91
+ * @throws A `NarsilError` with `CONFIG_INVALID` when a value breaks that
92
+ * shape, with `INDEX_NOT_FOUND` when the cluster holds no index under that
93
+ * name, with `BM25_NOT_READY` while a registered node has a specification
94
+ * version below 1.1, and with `CLUSTER_WRITE_BLOCKED` when other writes keep
95
+ * changing the index metadata.
96
+ */
97
+ updateBM25(indexName: string, bm25: BM25Params): Promise<void>;
98
+ }
99
+
39
100
  /**
40
101
  * One node of a cluster, which routes each write to the partition's primary
41
102
  * and gathers each search from every partition.
@@ -46,7 +107,7 @@ declare const DEFAULT_CAPACITY: NodeCapacity;
46
107
  *
47
108
  * @public
48
109
  */
49
- interface ClusterNode {
110
+ interface ClusterNode extends ClusterNodeSearchSettings {
50
111
  /** This identifies the node across the cluster. */
51
112
  readonly nodeId: string;
52
113
  /** The node holds these roles in the cluster. */
@@ -149,39 +210,6 @@ interface ClusterNode {
149
210
  * @param name - The index to drop.
150
211
  */
151
212
  dropIndex(name: string): Promise<void>;
152
- /**
153
- * Replaces the synonym set of an index across the cluster, so that every
154
- * search that starts after the promise resolves expands its words with the
155
- * new set.
156
- *
157
- * The node stores the set in the coordinator before it asks each node that
158
- * holds a partition of the index to apply the set. The promise resolves
159
- * once every one of those nodes answers. Pass an empty list to remove the
160
- * set.
161
- *
162
- * @param indexName - The index whose set the cluster replaces.
163
- * @param synonyms - The new set, in the shape that {@link SynonymRule}
164
- * describes.
165
- * @throws A `NarsilError` with `CONFIG_INVALID` when a rule breaks that
166
- * shape, when a word analyses to no token or to more than one, or when the
167
- * set passes 100,000 rules, 500,000 words, or 4,194,304 bytes of words in
168
- * UTF-8. It throws `CLUSTER_WRITE_BLOCKED` when the index metadata changes
169
- * between the node's read and its write on every one of its tries, and
170
- * `QUERY_NODE_TIMEOUT` when a node holding a partition gives no answer.
171
- * After a timeout, the coordinator keeps the new set, so a retry of the
172
- * same call can finish applying it.
173
- */
174
- updateSynonyms(indexName: string, synonyms: SynonymRule[]): Promise<void>;
175
- /**
176
- * Returns the synonym set that the coordinator holds for an index, with
177
- * every word as the caller wrote it, or an empty list when the index holds
178
- * no set.
179
- *
180
- * @param indexName - The index whose set the node returns.
181
- * @throws A `NarsilError` with `INDEX_NOT_FOUND` when the cluster holds no
182
- * index under that name.
183
- */
184
- getSynonyms(indexName: string): Promise<SynonymRule[]>;
185
213
  /**
186
214
  * Removes every document from an index across the cluster and keeps the
187
215
  * index itself, along with its schema and allocation.
@@ -478,4 +506,4 @@ interface ClusterEngineOptions {
478
506
  */
479
507
  declare function clusterNodeEngine(node: ClusterNode, options?: ClusterEngineOptions): Narsil;
480
508
 
481
- export { type ClusterEngineOptions, ClusterNamespace, type ClusterNode, ClusterNodeConfig, CreateIndexOptions, DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, NodeCapacity, NodeRole, clusterNodeEngine, createClusterNode };
509
+ export { type ClusterEngineOptions, ClusterNamespace, type ClusterNode, ClusterNodeConfig, type ClusterNodeSearchSettings, CreateIndexOptions, DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, NodeCapacity, NodeRole, clusterNodeEngine, createClusterNode };