@delali/narsil 0.2.0 → 0.2.1-next.25
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/adapters/filesystem.d.ts +23 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +25 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +14 -1
- package/dist/adapters-CVqI5NBt.d.ts +149 -0
- package/dist/{chunk-S6IAXOBA.mjs → chunk-ASI6AOW2.mjs} +1 -1
- package/dist/{chunk-AUMKFYTG.mjs → chunk-FKK76OR7.mjs} +56 -55
- package/dist/{chunk-M2EDG55Y.mjs → chunk-UNJZ7ZDB.mjs} +10 -0
- package/dist/{chunk-XAKNSWIK.mjs → chunk-WLR5BFL3.mjs} +16 -14
- package/dist/config-CAjTHzkH.d.ts +256 -0
- package/dist/{direct-executor-2FV3MEDD.mjs → direct-executor-3W4QRA4E.mjs} +2 -2
- package/dist/distribution/coordinator/etcd.d.ts +44 -3
- package/dist/distribution/coordinator/etcd.mjs +2 -2
- package/dist/distribution/coordinator/in-memory.d.ts +14 -3
- package/dist/distribution.d.ts +312 -45
- package/dist/distribution.mjs +4 -4
- package/dist/embeddings/openai.d.ts +28 -1
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/engine-CCrlfLyq.d.ts +431 -0
- package/dist/index.browser.mjs +24 -12
- package/dist/index.d.ts +173 -8
- package/dist/index.mjs +3 -3
- package/dist/invalidation/broadcast-channel.d.ts +20 -1
- package/dist/invalidation/filesystem.d.ts +24 -1
- package/dist/invalidation/noop.d.ts +14 -1
- package/dist/language-DB8KG1z5.d.ts +53 -0
- package/dist/languages/albanian.d.ts +11 -1
- package/dist/languages/amharic.d.ts +11 -1
- package/dist/languages/arabic.d.ts +10 -1
- package/dist/languages/armenian.d.ts +10 -1
- package/dist/languages/azerbaijani.d.ts +11 -1
- package/dist/languages/bambara.d.ts +11 -1
- package/dist/languages/basque.d.ts +10 -1
- package/dist/languages/belarusian.d.ts +11 -1
- package/dist/languages/bengali.d.ts +11 -1
- package/dist/languages/bosnian.d.ts +11 -1
- package/dist/languages/breton.d.ts +11 -1
- package/dist/languages/bulgarian.d.ts +10 -1
- package/dist/languages/burmese.d.ts +11 -1
- package/dist/languages/catalan.d.ts +10 -1
- package/dist/languages/chinese.d.ts +11 -1
- package/dist/languages/croatian.d.ts +11 -1
- package/dist/languages/czech.d.ts +10 -1
- package/dist/languages/dagbani.d.ts +11 -1
- package/dist/languages/danish.d.ts +10 -1
- package/dist/languages/dutch.d.ts +10 -1
- package/dist/languages/english.d.ts +10 -1
- package/dist/languages/esperanto.d.ts +10 -1
- package/dist/languages/estonian.d.ts +10 -1
- package/dist/languages/ewe.d.ts +11 -1
- package/dist/languages/faroese.d.ts +11 -1
- package/dist/languages/fijian.d.ts +11 -1
- package/dist/languages/finnish.d.ts +10 -1
- package/dist/languages/french.d.ts +10 -1
- package/dist/languages/ga.d.ts +11 -1
- package/dist/languages/galician.d.ts +11 -1
- package/dist/languages/georgian.d.ts +11 -1
- package/dist/languages/german.d.ts +10 -1
- package/dist/languages/greek.d.ts +10 -1
- package/dist/languages/guarani.d.ts +11 -1
- package/dist/languages/gujarati.d.ts +11 -1
- package/dist/languages/haitian-creole.d.ts +11 -1
- package/dist/languages/hausa.d.ts +11 -1
- package/dist/languages/hawaiian.d.ts +11 -1
- package/dist/languages/hebrew.d.ts +11 -1
- package/dist/languages/hindi.d.ts +10 -1
- package/dist/languages/hungarian.d.ts +10 -1
- package/dist/languages/icelandic.d.ts +11 -1
- package/dist/languages/igbo.d.ts +11 -1
- package/dist/languages/indonesian.d.ts +10 -1
- package/dist/languages/irish.d.ts +10 -1
- package/dist/languages/italian.d.ts +10 -1
- package/dist/languages/japanese.d.ts +11 -1
- package/dist/languages/kannada.d.ts +11 -1
- package/dist/languages/kazakh.d.ts +11 -1
- package/dist/languages/khmer.d.ts +11 -1
- package/dist/languages/kinyarwanda.d.ts +11 -1
- package/dist/languages/kirundi.d.ts +11 -1
- package/dist/languages/korean.d.ts +11 -1
- package/dist/languages/kurmanji.d.ts +11 -1
- package/dist/languages/kyrgyz.d.ts +11 -1
- package/dist/languages/lao.d.ts +11 -1
- package/dist/languages/latin.d.ts +11 -1
- package/dist/languages/latvian.d.ts +11 -1
- package/dist/languages/lingala.d.ts +11 -1
- package/dist/languages/lithuanian.d.ts +10 -1
- package/dist/languages/luxembourgish.d.ts +11 -1
- package/dist/languages/macedonian.d.ts +11 -1
- package/dist/languages/malagasy.d.ts +11 -1
- package/dist/languages/malay.d.ts +11 -1
- package/dist/languages/malayalam.d.ts +11 -1
- package/dist/languages/maltese.d.ts +11 -1
- package/dist/languages/maori.d.ts +11 -1
- package/dist/languages/marathi.d.ts +11 -1
- package/dist/languages/nepali.d.ts +10 -1
- package/dist/languages/norwegian.d.ts +10 -1
- package/dist/languages/oromo.d.ts +11 -1
- package/dist/languages/persian.d.ts +10 -1
- package/dist/languages/polish.d.ts +10 -1
- package/dist/languages/portuguese.d.ts +10 -1
- package/dist/languages/punjabi.d.ts +11 -1
- package/dist/languages/romanian.d.ts +10 -1
- package/dist/languages/russian.d.ts +10 -1
- package/dist/languages/samoan.d.ts +11 -1
- package/dist/languages/sanskrit.d.ts +10 -1
- package/dist/languages/scottish-gaelic.d.ts +11 -1
- package/dist/languages/serbian.d.ts +10 -1
- package/dist/languages/shona.d.ts +11 -1
- package/dist/languages/sinhala.d.ts +11 -1
- package/dist/languages/slovak.d.ts +11 -1
- package/dist/languages/slovenian.d.ts +10 -1
- package/dist/languages/sorani.d.ts +11 -1
- package/dist/languages/spanish.d.ts +10 -1
- package/dist/languages/swahili.d.ts +10 -1
- package/dist/languages/swedish.d.ts +10 -1
- package/dist/languages/tagalog.d.ts +11 -1
- package/dist/languages/tamil.d.ts +10 -1
- package/dist/languages/tatar.d.ts +11 -1
- package/dist/languages/telugu.d.ts +11 -1
- package/dist/languages/thai.d.ts +11 -1
- package/dist/languages/tibetan.d.ts +11 -1
- package/dist/languages/tigrinya.d.ts +11 -1
- package/dist/languages/tongan.d.ts +11 -1
- package/dist/languages/turkish.d.ts +10 -1
- package/dist/languages/twi.d.ts +11 -1
- package/dist/languages/ukrainian.d.ts +10 -1
- package/dist/languages/urdu.d.ts +11 -1
- package/dist/languages/vietnamese.d.ts +11 -1
- package/dist/languages/welsh.d.ts +11 -1
- package/dist/languages/wolof.d.ts +11 -1
- package/dist/languages/xhosa.d.ts +11 -1
- package/dist/languages/yoruba.d.ts +11 -1
- package/dist/languages/zulu.d.ts +11 -1
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
- package/dist/persistence/durability/checkpoint-worker.mjs +3 -3
- package/dist/schema-CE6S_aAr.d.ts +208 -0
- package/dist/search-CgQQIciB.d.ts +786 -0
- package/dist/server.d.ts +213 -12
- package/dist/server.mjs +29 -1
- package/dist/types-BV3nAKTL.d.ts +302 -0
- package/dist/vector/hnsw-build-worker.d.ts +68 -2
- package/dist/vector/hnsw-build-worker.mjs +0 -2
- package/dist/workers/entry.mjs +1 -1
- package/package.json +5 -2
- package/dist/adapters-Bo2JQg8b.d.ts +0 -37
- package/dist/config-P27AtSn4.d.ts +0 -502
- package/dist/language-CmJBHf1j.d.ts +0 -17
- package/dist/narsil-CMZRPDlQ.d.ts +0 -159
- package/dist/schema-BnvLvjRp.d.ts +0 -67
- package/dist/types-BRTcBgAp.d.ts +0 -73
package/dist/languages/thai.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Thai analysis: the stop word list and the rules that split Thai
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `thai`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const thai: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { thai };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Tibetan analysis: the stop word list and the rules that split Tibetan
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `tibetan`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const tibetan: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { tibetan };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Tigrinya analysis: the stop word list and the rules that split Tigrinya
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `tigrinya`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const tigrinya: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { tigrinya };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Tongan analysis: the stop word list and the rules that split Tongan
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `tongan`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const tongan: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { tongan };
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Turkish analysis: the Snowball stemmer, the stop word list, and the rules
|
|
5
|
+
* that split Turkish text into tokens.
|
|
6
|
+
*
|
|
7
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
8
|
+
* whose `language` is `turkish`.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
3
12
|
declare const turkish: LanguageModule;
|
|
4
13
|
|
|
5
14
|
export { turkish };
|
package/dist/languages/twi.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Twi analysis: the stop word list and the rules that split Twi
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `twi`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const twi: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { twi };
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Ukrainian analysis: the Snowball stemmer, the stop word list, and the rules
|
|
5
|
+
* that split Ukrainian text into tokens.
|
|
6
|
+
*
|
|
7
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
8
|
+
* whose `language` is `ukrainian`.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
3
12
|
declare const ukrainian: LanguageModule;
|
|
4
13
|
|
|
5
14
|
export { ukrainian };
|
package/dist/languages/urdu.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Urdu analysis: the stop word list and the rules that split Urdu
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `urdu`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const urdu: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { urdu };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Vietnamese analysis: the stop word list and the rules that split Vietnamese
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `vietnamese`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const vietnamese: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { vietnamese };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Welsh analysis: the stop word list and the rules that split Welsh
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `welsh`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const welsh: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { welsh };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Wolof analysis: the stop word list and the rules that split Wolof
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `wolof`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const wolof: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { wolof };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Xhosa analysis: the stop word list and the rules that split Xhosa
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `xhosa`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const xhosa: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { xhosa };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Yoruba analysis: the stop word list and the rules that split Yoruba
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `yoruba`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const yoruba: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { yoruba };
|
package/dist/languages/zulu.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LanguageModule } from '../language-
|
|
1
|
+
import { L as LanguageModule } from '../language-DB8KG1z5.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Zulu analysis: the stop word list and the rules that split Zulu
|
|
5
|
+
* text into tokens. Tokens are indexed as the normaliser leaves them,
|
|
6
|
+
* without stemming.
|
|
7
|
+
*
|
|
8
|
+
* Import it and pass it to {@link registerLanguage} before you create an index
|
|
9
|
+
* whose `language` is `zulu`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
3
13
|
declare const zulu: LanguageModule;
|
|
4
14
|
|
|
5
15
|
export { zulu };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PartitionConfig, c as ScoringMode, V as VectorIndexConfig } from '../../schema-
|
|
2
|
-
import '../../adapters-
|
|
1
|
+
import { P as PartitionConfig, c as ScoringMode, V as VectorIndexConfig } from '../../schema-CE6S_aAr.js';
|
|
2
|
+
import '../../adapters-CVqI5NBt.js';
|
|
3
3
|
|
|
4
4
|
interface IndexMetadata {
|
|
5
5
|
indexName: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-WLR5BFL3.mjs';
|
|
2
|
+
import '../../chunk-ASI6AOW2.mjs';
|
|
3
3
|
import '../../chunk-TGP5M5R7.mjs';
|
|
4
4
|
import '../../chunk-S7RJJMHI.mjs';
|
|
5
5
|
import '../../chunk-KMMJMDUA.mjs';
|
|
6
6
|
import '../../chunk-U2BKYEC7.mjs';
|
|
7
|
-
import '../../chunk-
|
|
7
|
+
import '../../chunk-UNJZ7ZDB.mjs';
|
|
8
8
|
import '../../chunk-BKAI2WXI.mjs';
|
|
9
9
|
|
|
10
10
|
// src/persistence/durability/rebuild.ts
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { E as EmbeddingAdapter } from './adapters-CVqI5NBt.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A document as the engine stores it: any set of fields, with an optional `id`.
|
|
5
|
+
*
|
|
6
|
+
* The engine takes the `id` field as the document id when you insert without
|
|
7
|
+
* passing one. Every other field must match the type its schema declares.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
type AnyDocument = Record<string, unknown> & {
|
|
12
|
+
id?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The type a schema field declares, which sets how the engine indexes it.
|
|
16
|
+
*
|
|
17
|
+
* `string` is analysed and searchable, `number`, `boolean`, and `enum` are
|
|
18
|
+
* filterable and sortable, `geopoint` accepts a latitude and longitude pair,
|
|
19
|
+
* and `vector[N]` holds an N-dimensional embedding. Each array form indexes
|
|
20
|
+
* every element of the field.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
type FieldType = 'string' | 'number' | 'boolean' | 'enum' | 'geopoint' | `vector[${number}]` | 'string[]' | 'number[]' | 'boolean[]' | 'enum[]';
|
|
25
|
+
/**
|
|
26
|
+
* The field layout of an index, written as a plain object.
|
|
27
|
+
*
|
|
28
|
+
* Each key names a field and each value is either its {@link FieldType} or a
|
|
29
|
+
* nested schema, which is how you describe an object inside a document.
|
|
30
|
+
* Nesting goes four levels deep.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
type SchemaDefinition = {
|
|
35
|
+
[field: string]: FieldType | SchemaDefinition;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* How the engine stores vectors once a field is promoted to an HNSW graph.
|
|
39
|
+
*
|
|
40
|
+
* `sq8` quantises each component to a signed byte, which cuts memory to a
|
|
41
|
+
* quarter and costs a small amount of recall. `none` keeps full precision.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
type VectorQuantizationMode = 'sq8' | 'none';
|
|
46
|
+
/**
|
|
47
|
+
* Controls when a vector field moves from a brute-force scan to an HNSW graph,
|
|
48
|
+
* and how that graph is built.
|
|
49
|
+
*
|
|
50
|
+
* A small field answers faster from a brute-force scan, so the engine builds a
|
|
51
|
+
* graph only once the field holds enough vectors to earn one. Leave every
|
|
52
|
+
* field unset to accept the engine's own values.
|
|
53
|
+
*
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
interface VectorIndexConfig {
|
|
57
|
+
/** The engine promotes the field to an HNSW graph once it holds this many vectors. */
|
|
58
|
+
threshold?: number;
|
|
59
|
+
/** A filtered search prefers the graph over a scan once the field holds this many vectors. */
|
|
60
|
+
filterThreshold?: number;
|
|
61
|
+
/** These settings shape the graph: neighbours per node, build-time exploration, and the metric that ranks results. */
|
|
62
|
+
hnswConfig?: {
|
|
63
|
+
m?: number;
|
|
64
|
+
efConstruction?: number;
|
|
65
|
+
metric?: 'cosine' | 'dotProduct' | 'euclidean';
|
|
66
|
+
};
|
|
67
|
+
/** The engine stores the promoted vectors at this precision. It keeps full precision by default. */
|
|
68
|
+
quantization?: VectorQuantizationMode;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Connects an index to an embedding adapter and says which fields feed it.
|
|
72
|
+
*
|
|
73
|
+
* The engine embeds the named source fields on every insert and update, so a
|
|
74
|
+
* document arrives as text and is stored with its vector alongside.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
interface EmbeddingFieldConfig {
|
|
79
|
+
/** An adapter instance, or a registered adapter name. Only a name survives
|
|
80
|
+
* durability recovery, since instances cannot be serialised. */
|
|
81
|
+
adapter?: EmbeddingAdapter | string;
|
|
82
|
+
/** This maps each vector field to the text field, or fields, the engine embeds into it. */
|
|
83
|
+
fields: Record<string, string | string[]>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Replaces a language's stop word list, either with a fixed set or with a
|
|
87
|
+
* function that receives the language defaults and returns the set to use.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
type StopWordOverride = Set<string> | ((defaults: Set<string>) => Set<string>);
|
|
92
|
+
/**
|
|
93
|
+
* Everything {@link Narsil.createIndex} needs to build an index.
|
|
94
|
+
*
|
|
95
|
+
* Only `schema` is required. The rest tune analysis, scoring, partitioning,
|
|
96
|
+
* and vector handling, and each one falls back to an engine default.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
interface IndexConfig {
|
|
101
|
+
/** This layout fixes the type of every field you search, filter, or sort on. */
|
|
102
|
+
schema: SchemaDefinition;
|
|
103
|
+
/** The engine tokenises and stems text fields with the language module registered under this name. It uses English by default. */
|
|
104
|
+
language?: string;
|
|
105
|
+
/** These settings control how the index splits documents across partitions as it grows. */
|
|
106
|
+
partitions?: PartitionConfig;
|
|
107
|
+
/** A query scores this way unless it asks for another mode. */
|
|
108
|
+
defaultScoring?: ScoringMode;
|
|
109
|
+
/** These parameters tune BM25 for this index. */
|
|
110
|
+
bm25?: BM25Params;
|
|
111
|
+
/** This replaces the language's stop words, either inline or by the name a stop word list registered under. */
|
|
112
|
+
stopWords?: StopWordOverride | string;
|
|
113
|
+
/** This replaces the language's tokeniser, either inline or by the name a tokeniser registered under. */
|
|
114
|
+
tokenizer?: CustomTokenizer | string;
|
|
115
|
+
/** Setting this records term positions, which phrase queries and highlighting need. */
|
|
116
|
+
trackPositions?: boolean;
|
|
117
|
+
/** These settings control when vector fields move to an HNSW graph, and how that graph is built. */
|
|
118
|
+
vectorPromotion?: VectorIndexConfig;
|
|
119
|
+
/** Setting this rejects a document carrying a field the schema does not declare. The engine accepts extra fields by default. */
|
|
120
|
+
strict?: boolean;
|
|
121
|
+
/** These settings embed text fields into vector fields on every write. */
|
|
122
|
+
embedding?: EmbeddingFieldConfig;
|
|
123
|
+
/** The engine rejects a document that omits any of these fields. */
|
|
124
|
+
required?: string[];
|
|
125
|
+
/**
|
|
126
|
+
* Return the words users typed from suggest() and prefix expansion
|
|
127
|
+
* instead of index stems, at an insert-throughput cost. Default false.
|
|
128
|
+
*/
|
|
129
|
+
surfaceForms?: boolean;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* BM25 tuning for an index.
|
|
133
|
+
*
|
|
134
|
+
* Both parameters default to the values the literature settles on, so change
|
|
135
|
+
* them only once you have measured relevance on your own corpus.
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
interface BM25Params {
|
|
140
|
+
/** This saturates term frequency, so a higher value lets a repeated term keep raising a score. It defaults to 1.2. */
|
|
141
|
+
k1?: number;
|
|
142
|
+
/** This normalises by field length, from 0 for none to 1 for full. It defaults to 0.75. */
|
|
143
|
+
b?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A tokeniser you supply, which replaces the language module's own.
|
|
147
|
+
*
|
|
148
|
+
* The engine calls it for every text field on write and for every query term,
|
|
149
|
+
* so the same rules apply on both sides.
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
interface CustomTokenizer {
|
|
154
|
+
/**
|
|
155
|
+
* Splits one field value into the tokens the engine indexes.
|
|
156
|
+
*
|
|
157
|
+
* @param text - The raw field value, before any stemming or stop word removal.
|
|
158
|
+
* @returns Each token with the character offset it starts at, which
|
|
159
|
+
* highlighting and phrase matching rely on.
|
|
160
|
+
*/
|
|
161
|
+
tokenize(text: string): Array<{
|
|
162
|
+
token: string;
|
|
163
|
+
position: number;
|
|
164
|
+
}>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* How an index splits its documents across partitions as it grows.
|
|
168
|
+
*
|
|
169
|
+
* The engine adds a partition once a partition passes its watermark, and it
|
|
170
|
+
* refuses a write once every partition is full and the ceiling is reached.
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
interface PartitionConfig {
|
|
175
|
+
/** The engine refuses a write that would push one partition past this many documents. */
|
|
176
|
+
maxDocsPerPartition?: number;
|
|
177
|
+
/** The index grows to this many partitions and no further. */
|
|
178
|
+
maxPartitions?: number;
|
|
179
|
+
/** The engine adds a partition once one fills this fraction of `maxDocsPerPartition`, from 0 to 1. */
|
|
180
|
+
watermark?: number;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* How a query gathers the term statistics BM25 scores with.
|
|
184
|
+
*
|
|
185
|
+
* `local` scores each partition from its own statistics, which is fastest and
|
|
186
|
+
* accurate enough for evenly spread data. `dfs` gathers document frequencies
|
|
187
|
+
* across partitions first, so every score compares like for like. `broadcast`
|
|
188
|
+
* sends the query to every partition and merges the results.
|
|
189
|
+
*
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
type ScoringMode = 'local' | 'dfs' | 'broadcast';
|
|
193
|
+
/**
|
|
194
|
+
* Per-write options for {@link Narsil.insert} and {@link Narsil.insertBatch}.
|
|
195
|
+
*
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
interface InsertOptions {
|
|
199
|
+
/**
|
|
200
|
+
* Setting this stores the document object you passed instead of a copy,
|
|
201
|
+
* which saves a clone on a large load. Changing that object afterwards
|
|
202
|
+
* changes the stored document with it, so pass this only for a document you
|
|
203
|
+
* discard.
|
|
204
|
+
*/
|
|
205
|
+
skipClone?: boolean;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export type { AnyDocument as A, BM25Params as B, CustomTokenizer as C, EmbeddingFieldConfig as E, FieldType as F, IndexConfig as I, PartitionConfig as P, StopWordOverride as S, VectorIndexConfig as V, InsertOptions as a, SchemaDefinition as b, ScoringMode as c, VectorQuantizationMode as d };
|