@delali/narsil 0.3.1-next.129 → 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.
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/browser/chunk-26A5JFT2.mjs +89 -0
- package/dist/browser/{chunk-5D6NJD6C.mjs → chunk-2Y3CO4EQ.mjs} +342 -201
- package/dist/browser/{chunk-WLD6DDIX.mjs → chunk-AIIJDWMG.mjs} +1 -1
- package/dist/browser/{chunk-YAGXZU4W.mjs → chunk-D7WQF6DV.mjs} +2 -2
- package/dist/browser/{chunk-WZBTVTSU.mjs → chunk-M5UAAXGU.mjs} +2 -2
- package/dist/browser/{chunk-XTFJZHQP.mjs → chunk-NSCSR6MA.mjs} +15 -5
- package/dist/browser/{chunk-3NVZD52E.mjs → chunk-UDGB2MWT.mjs} +5 -28
- package/dist/browser/{chunk-II5POT55.mjs → chunk-VBBLTD7O.mjs} +4 -3
- package/dist/browser/chunk-VEGHFP2P.mjs +30 -0
- package/dist/browser/{durability-wiring-HCCC6BJB.mjs → durability-wiring-FNZSRH4N.mjs} +8 -6
- package/dist/browser/{module-S2VDU2JE.mjs → module-4HIMOQM5.mjs} +6 -5
- package/dist/browser/phrase-module-WESYVU7K.mjs +327 -0
- package/dist/browser/{restore-queue-BZ7WWEC4.mjs → restore-queue-GEZ54CA5.mjs} +1 -1
- package/dist/browser/{runtime-PL4TTFJE.mjs → runtime-3X7ZJ5T3.mjs} +2 -1
- package/dist/browser/{snapshot-RTUCHI2L.mjs → snapshot-V7VF6BN6.mjs} +25 -10
- package/dist/browser/{write-IMU7G5NU.mjs → write-YIC2MKRY.mjs} +7 -5
- package/dist/{capabilities-BTjv-tK8.d.ts → capabilities-Bl8G9taj.d.ts} +2 -2
- package/dist/{chunk-3XHFVYIQ.mjs → chunk-2C3WXBQS.mjs} +1 -1
- package/dist/{chunk-37RTD6KD.mjs → chunk-2JWNJSNE.mjs} +8 -8
- package/dist/{chunk-K76F5YYX.mjs → chunk-2MKX2SCO.mjs} +219 -58
- package/dist/{chunk-AN3CUMPZ.mjs → chunk-2SEL6SBS.mjs} +4 -95
- package/dist/{chunk-OPO5SE4J.mjs → chunk-2WBY4Y4M.mjs} +1 -1
- package/dist/{chunk-PTIJAZWL.mjs → chunk-4GDLFDPZ.mjs} +1 -1
- package/dist/chunk-4UMZ7KQL.mjs +17 -0
- package/dist/{chunk-TY64A3ZW.mjs → chunk-5LX6MOIB.mjs} +2 -2
- package/dist/{chunk-PCRWCOZC.mjs → chunk-6M6SDH3S.mjs} +43 -23
- package/dist/{chunk-MGD7XETB.mjs → chunk-6SSVIW7Y.mjs} +19 -3
- package/dist/{chunk-5LC5VMDQ.mjs → chunk-7OIQ2SIO.mjs} +4 -4
- package/dist/{chunk-4XEVROSP.mjs → chunk-7XY6VD7B.mjs} +1 -1
- package/dist/{chunk-WI5Q3L43.mjs → chunk-CZ7ISLXA.mjs} +2 -0
- package/dist/{chunk-RC27KF7F.mjs → chunk-D5TFRB5G.mjs} +3 -15
- package/dist/{chunk-F4UKMTKM.mjs → chunk-EUCX5K74.mjs} +4 -4
- package/dist/{chunk-CTF6WFTX.mjs → chunk-F6AAXI7T.mjs} +3 -3
- package/dist/{chunk-DX2FI4LU.mjs → chunk-FQBFZAWG.mjs} +3 -1
- package/dist/{chunk-XTER67YM.mjs → chunk-HCGJKDZV.mjs} +1 -1
- package/dist/{chunk-WQYB4TNR.mjs → chunk-JJ6EUMXB.mjs} +2 -2
- package/dist/{chunk-2HQQ7Y5D.mjs → chunk-JT3YZGCE.mjs} +2 -2
- package/dist/chunk-JUKYYXSP.mjs +93 -0
- package/dist/{chunk-WUIDPBSY.mjs → chunk-K77FJXKS.mjs} +17 -7
- package/dist/{chunk-CSSCLRGY.mjs → chunk-NMXRXFGZ.mjs} +2 -2
- package/dist/{chunk-44TB6AIZ.mjs → chunk-NNO7CO3A.mjs} +1 -1
- package/dist/{chunk-FRSWYMXH.mjs → chunk-PATMDIMN.mjs} +1 -1
- package/dist/{chunk-AFOZR4ZQ.mjs → chunk-PU6SKH7O.mjs} +2 -2
- package/dist/{chunk-EZIGAOUJ.mjs → chunk-QQTXT65X.mjs} +6 -5
- package/dist/{chunk-Y4NOHICF.mjs → chunk-RNSC4NFI.mjs} +1 -1
- package/dist/{chunk-RYH3PASD.mjs → chunk-RWESFSJI.mjs} +21 -11
- package/dist/{chunk-QQS4QZQA.mjs → chunk-SOHMMNCH.mjs} +4 -4
- package/dist/{chunk-K73PZTBR.mjs → chunk-SZGRYEIC.mjs} +4 -4
- package/dist/{chunk-43Q7HAI2.mjs → chunk-T4OFG4IQ.mjs} +4 -4
- package/dist/{chunk-2YOAGAGF.mjs → chunk-TGHNXN7W.mjs} +59 -30
- package/dist/{chunk-J4LRE5Q7.mjs → chunk-WVRDRLIC.mjs} +6 -6
- package/dist/{chunk-XRXBCOA4.mjs → chunk-X5CNUKD5.mjs} +2 -2
- package/dist/{chunk-TB7YMDD5.mjs → chunk-XABMCBHA.mjs} +6 -4
- package/dist/{chunk-Y4US5EGH.mjs → chunk-Y2U5VVWX.mjs} +1 -1
- package/dist/{chunk-5VSTAJET.mjs → chunk-Y4BVTQ53.mjs} +2 -2
- package/dist/{chunk-3LJVM6XM.mjs → chunk-YBWSV5DV.mjs} +2 -2
- package/dist/{chunk-M6MBSVIJ.mjs → chunk-ZR4VM4A6.mjs} +1 -1
- package/dist/{client-BOcveV7A.d.ts → client-Cx-TiqPE.d.ts} +3 -3
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +2 -0
- package/dist/{config-CPmIY3aH.d.ts → config-CzB9YvF_.d.ts} +2 -2
- package/dist/{config-C3YXk5Rn.d.ts → config-hOWGBeC6.d.ts} +7 -5
- package/dist/direct-executor-HQ4QVDX7.mjs +28 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +8 -8
- package/dist/distribution.mjs +85 -45
- package/dist/{durability-wiring-6R26AJDI.mjs → durability-wiring-S7OX2MAI.mjs} +27 -25
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-JjRAXpT3.d.ts → engine-B_W9sdZK.d.ts} +2 -2
- package/dist/{events-pM0lna7M.d.ts → events-DErop1LM.d.ts} +12 -2
- package/dist/{index-DkQ2DlgR.d.ts → index-CKI1fDEl.d.ts} +1 -1
- package/dist/index.browser.mjs +5 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +20 -18
- package/dist/{long-query-thread-6VLA6YJI.mjs → long-query-thread-WVSMIBYP.mjs} +17 -15
- package/dist/{module-S4WGMFNW.mjs → module-2E4XYSGT.mjs} +11 -11
- package/dist/partial-words.mjs +7 -6
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +23 -21
- package/dist/phrase-module-JERF2IDG.mjs +329 -0
- package/dist/react.d.ts +7 -7
- package/dist/react.mjs +2 -0
- package/dist/{rerank-V4J4MIWR.mjs → rerank-DMMT4FZA.mjs} +6 -6
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{restore-queue-PUGWCPCX.mjs → restore-queue-JAMNRC6T.mjs} +1 -1
- package/dist/{runtime-TBFBQQQO.mjs → runtime-7MLQ7J64.mjs} +7 -7
- package/dist/{schema-DGAP_8HJ.d.ts → schema-CS-clLun.d.ts} +4 -4
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +15 -15
- package/dist/{snapshot-PUVSMV7E.mjs → snapshot-DOQLGGEX.mjs} +44 -29
- package/dist/synonyms.mjs +4 -3
- package/dist/{tasks-txGvNz6h.d.ts → tasks-BfF-VRhm.d.ts} +2 -2
- package/dist/{thread-TA7QQBWP.mjs → thread-DNK5XWXG.mjs} +16 -14
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +4 -4
- package/dist/workers/entry.mjs +7 -7
- package/dist/{write-TGKYT3C4.mjs → write-ZKR7SNRT.mjs} +22 -20
- package/package.json +7 -7
- package/dist/direct-executor-ULA6V5HC.mjs +0 -26
package/dist/index.mjs
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
export { VERSION, createNarsil } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { VERSION, createNarsil } from './chunk-TGHNXN7W.mjs';
|
|
2
|
+
import './chunk-6M6SDH3S.mjs';
|
|
3
|
+
import './chunk-JT3YZGCE.mjs';
|
|
4
|
+
import './chunk-NNO7CO3A.mjs';
|
|
5
5
|
import './chunk-AV4IJKD2.mjs';
|
|
6
|
-
export { registerSynonyms } from './chunk-
|
|
7
|
-
export { registerPartialWordSearch, registerPatternSearch } from './chunk-
|
|
8
|
-
export { getLanguage, registerLanguage } from './chunk-
|
|
6
|
+
export { registerSynonyms } from './chunk-RWESFSJI.mjs';
|
|
7
|
+
export { registerPartialWordSearch, registerPatternSearch } from './chunk-2MKX2SCO.mjs';
|
|
8
|
+
export { getLanguage, registerLanguage } from './chunk-ZR4VM4A6.mjs';
|
|
9
9
|
import './chunk-ZATRDAYU.mjs';
|
|
10
10
|
import './chunk-EBIHRL7B.mjs';
|
|
11
11
|
import './chunk-HJSN7UYG.mjs';
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-RNSC4NFI.mjs';
|
|
13
13
|
import './chunk-TGP5M5R7.mjs';
|
|
14
14
|
import './chunk-U2BKYEC7.mjs';
|
|
15
15
|
export { isSimdAvailable } from './chunk-KOKM4PQN.mjs';
|
|
16
16
|
import './chunk-QSK35UC2.mjs';
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
17
|
+
import './chunk-2C3WXBQS.mjs';
|
|
18
|
+
import './chunk-2SEL6SBS.mjs';
|
|
19
19
|
import './chunk-WQBCBKY3.mjs';
|
|
20
|
-
import './chunk-
|
|
21
|
-
import './chunk-
|
|
20
|
+
import './chunk-JUKYYXSP.mjs';
|
|
21
|
+
import './chunk-EUCX5K74.mjs';
|
|
22
|
+
import './chunk-PU6SKH7O.mjs';
|
|
22
23
|
import './chunk-U476IXKQ.mjs';
|
|
23
|
-
import './chunk-
|
|
24
|
+
import './chunk-FQBFZAWG.mjs';
|
|
24
25
|
import './chunk-VJS4JFBQ.mjs';
|
|
25
26
|
import './chunk-GES7U2PM.mjs';
|
|
26
|
-
import './chunk-
|
|
27
|
-
export { getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerStopWords, registerTokenizer } from './chunk-
|
|
27
|
+
import './chunk-7XY6VD7B.mjs';
|
|
28
|
+
export { getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerStopWords, registerTokenizer } from './chunk-6SSVIW7Y.mjs';
|
|
28
29
|
import './chunk-X5CV2E2B.mjs';
|
|
29
30
|
import './chunk-7X5JST5L.mjs';
|
|
30
|
-
export { clearNormalizationCache, configureNormalizationCache, getNormalizationCacheSize, resetNormalizationCache } from './chunk-
|
|
31
|
+
export { clearNormalizationCache, configureNormalizationCache, getNormalizationCacheSize, resetNormalizationCache } from './chunk-D5TFRB5G.mjs';
|
|
32
|
+
import './chunk-4UMZ7KQL.mjs';
|
|
31
33
|
import './chunk-R6A773WK.mjs';
|
|
32
34
|
import './chunk-YTJCGKM4.mjs';
|
|
33
35
|
import './chunk-UJWGQIXU.mjs';
|
|
34
|
-
import './chunk-
|
|
36
|
+
import './chunk-HCGJKDZV.mjs';
|
|
35
37
|
import './chunk-22YPZVMG.mjs';
|
|
36
38
|
import './chunk-RFBLQLLZ.mjs';
|
|
37
39
|
import './chunk-L5ORED7V.mjs';
|
|
38
|
-
export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './chunk-
|
|
40
|
+
export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './chunk-CZ7ISLXA.mjs';
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { createRelayClient, createThreadReadEngine, searchHandler, isLongQueryPortNote } from './chunk-
|
|
2
|
-
import { answerRequest } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { createRelayClient, createThreadReadEngine, searchHandler, isLongQueryPortNote } from './chunk-QQTXT65X.mjs';
|
|
2
|
+
import { answerRequest } from './chunk-YBWSV5DV.mjs';
|
|
3
|
+
import './chunk-XABMCBHA.mjs';
|
|
4
4
|
import './chunk-KZ3NX2P7.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-4GDLFDPZ.mjs';
|
|
6
6
|
import './chunk-IWVEG5CX.mjs';
|
|
7
7
|
import './chunk-DJHHF2L5.mjs';
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
8
|
+
import './chunk-6M6SDH3S.mjs';
|
|
9
|
+
import './chunk-2MKX2SCO.mjs';
|
|
10
10
|
import './chunk-ZATRDAYU.mjs';
|
|
11
11
|
import './chunk-EBIHRL7B.mjs';
|
|
12
12
|
import './chunk-HJSN7UYG.mjs';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-RNSC4NFI.mjs';
|
|
14
14
|
import './chunk-QSK35UC2.mjs';
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
15
|
+
import './chunk-2C3WXBQS.mjs';
|
|
16
|
+
import './chunk-2SEL6SBS.mjs';
|
|
17
17
|
import './chunk-WQBCBKY3.mjs';
|
|
18
|
-
import './chunk-
|
|
19
|
-
import './chunk-
|
|
18
|
+
import './chunk-JUKYYXSP.mjs';
|
|
19
|
+
import './chunk-EUCX5K74.mjs';
|
|
20
|
+
import './chunk-PU6SKH7O.mjs';
|
|
20
21
|
import './chunk-U476IXKQ.mjs';
|
|
21
|
-
import './chunk-
|
|
22
|
+
import './chunk-FQBFZAWG.mjs';
|
|
22
23
|
import './chunk-VJS4JFBQ.mjs';
|
|
23
24
|
import './chunk-GES7U2PM.mjs';
|
|
24
|
-
import './chunk-
|
|
25
|
+
import './chunk-7XY6VD7B.mjs';
|
|
25
26
|
import './chunk-X5CV2E2B.mjs';
|
|
26
|
-
import './chunk-
|
|
27
|
+
import './chunk-D5TFRB5G.mjs';
|
|
28
|
+
import './chunk-4UMZ7KQL.mjs';
|
|
27
29
|
import './chunk-R6A773WK.mjs';
|
|
28
30
|
import './chunk-YTJCGKM4.mjs';
|
|
29
31
|
import './chunk-RIIUZJQ3.mjs';
|
|
30
32
|
import './chunk-22YPZVMG.mjs';
|
|
31
33
|
import './chunk-L5ORED7V.mjs';
|
|
32
|
-
import './chunk-
|
|
34
|
+
import './chunk-CZ7ISLXA.mjs';
|
|
33
35
|
|
|
34
36
|
// src/server/request-threads/long-query-thread.ts
|
|
35
37
|
var serving = null;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { noteWaitingForMemory, admitsBackgroundBytes } from './chunk-PELHVTO7.mjs';
|
|
2
|
+
import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, noBuildHistory, recordCheckpoint, planCheckpoint, deserialize, assignStorePartitions, liveSize, ordinalFilterForSubsets, handOverBuildTurns, threadsHoldCurrentLayout, filterForOptions, OSQ4_MIN_DIMENSION, emptyFieldBeforeRestore, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, releaseReplacedVectors, yieldBuildTurn, WORKER_COPY_MIN_VECTORS, allLiveDocIds, SHUFFLED_REBUILD_MEMORY_RETRY_MS, recalibrateFromStore, signatureOf, adoptGraph, BUILD_RETRY_MAX_DELAY_MS, BUILD_RETRY_FIRST_DELAY_MS, fieldHandlesOf, liveOrdinals, RECALIBRATION_CHUNK_VECTORS, BUILD_CHUNK_SIZE, DRIFT_CHECK_GROWTH_FACTOR, DISK_ADOPTION_YIELD_INTERVAL, adoptLoadedCalibration, RECALIBRATION_DRIFT_RATIO } from './chunk-SOHMMNCH.mjs';
|
|
2
3
|
import { chargeHeapBytes } from './chunk-IWVEG5CX.mjs';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { releaseLocksHeldBy } from './chunk-XRXBCOA4.mjs';
|
|
4
|
+
import { isDead, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors } from './chunk-Y2U5VVWX.mjs';
|
|
5
|
+
import { createVectorStore } from './chunk-Y4BVTQ53.mjs';
|
|
6
|
+
export { openSharedVectorField } from './chunk-Y4BVTQ53.mjs';
|
|
7
|
+
import { osqBitsOf, createOsqQuantizer, STORE_ORDINAL_LAYOUT_GENERATION, ordinalFilterValues, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, createOrdinalFilter, addToOrdinalFilter, nativeScoresOf, toScore, ordinalFilterHas, magnitude, nativeStoreScratchBytes, toDistance, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, createHNSWIndex, topLayerInParts, sharedMemoryAvailable, requireWholeNeighbourLists, shuffleInPlace, createCentroidSums, centroidOfCentroidSums, meanOfCentroidSums, countOfCentroidSums, squaredLengthsOfCentroidSums, releaseLocksHeldBy } from './chunk-X5CNUKD5.mjs';
|
|
8
|
+
export { releaseLocksHeldBy } from './chunk-X5CNUKD5.mjs';
|
|
9
9
|
import { noteFallback } from './chunk-DJHHF2L5.mjs';
|
|
10
10
|
import './chunk-37CD3OKS.mjs';
|
|
11
11
|
import { spawnNodeWorker } from './chunk-W55X2BYN.mjs';
|
|
12
|
-
import { resolveWorkerCount, resolveWorkerEntry, workerResourceLimits } from './chunk-
|
|
12
|
+
import { resolveWorkerCount, resolveWorkerEntry, workerResourceLimits } from './chunk-NNO7CO3A.mjs';
|
|
13
13
|
import { detectRuntime } from './chunk-AV4IJKD2.mjs';
|
|
14
14
|
import './chunk-EBIHRL7B.mjs';
|
|
15
|
-
import './chunk-
|
|
15
|
+
import './chunk-RNSC4NFI.mjs';
|
|
16
16
|
import './chunk-KOKM4PQN.mjs';
|
|
17
17
|
import { MAX_RENUMBERED_SEARCH_ATTEMPTS, DISK_STORAGE_BLOCK_BYTES, UNPLACED_FLAG_CHUNK_ORDINALS, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS, VECTOR_INSERT_TIMEOUT_MS } from './chunk-QSK35UC2.mjs';
|
|
18
|
-
import './chunk-
|
|
18
|
+
import './chunk-2C3WXBQS.mjs';
|
|
19
19
|
import './chunk-U476IXKQ.mjs';
|
|
20
|
-
import './chunk-
|
|
20
|
+
import './chunk-FQBFZAWG.mjs';
|
|
21
21
|
import './chunk-VJS4JFBQ.mjs';
|
|
22
22
|
import './chunk-R6A773WK.mjs';
|
|
23
23
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
24
24
|
import './chunk-RIIUZJQ3.mjs';
|
|
25
25
|
import './chunk-22YPZVMG.mjs';
|
|
26
26
|
import { noteThreadSlotLive, noteThreadSlotGone } from './chunk-RFBLQLLZ.mjs';
|
|
27
|
-
import { NarsilError, ErrorCodes, isNarsilError } from './chunk-
|
|
27
|
+
import { NarsilError, ErrorCodes, isNarsilError } from './chunk-CZ7ISLXA.mjs';
|
|
28
28
|
|
|
29
29
|
// src/core/heap.ts
|
|
30
30
|
function createMaxHeap(compare) {
|
package/dist/partial-words.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { partialWordSearchModule } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { partialWordSearchModule } from './chunk-EUCX5K74.mjs';
|
|
2
|
+
import './chunk-PU6SKH7O.mjs';
|
|
3
3
|
import './chunk-U476IXKQ.mjs';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-FQBFZAWG.mjs';
|
|
5
5
|
import './chunk-VJS4JFBQ.mjs';
|
|
6
6
|
import './chunk-GES7U2PM.mjs';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
7
|
+
import './chunk-7XY6VD7B.mjs';
|
|
8
|
+
import './chunk-D5TFRB5G.mjs';
|
|
9
|
+
import './chunk-4UMZ7KQL.mjs';
|
|
9
10
|
import './chunk-R6A773WK.mjs';
|
|
10
11
|
import './chunk-YTJCGKM4.mjs';
|
|
11
12
|
import './chunk-L5ORED7V.mjs';
|
|
12
|
-
import './chunk-
|
|
13
|
+
import './chunk-CZ7ISLXA.mjs';
|
|
13
14
|
|
|
14
15
|
// src/partial-words/index.ts
|
|
15
16
|
var partialWordSearch = partialWordSearchModule;
|
package/dist/pattern.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { patternSearchModule } from './chunk-
|
|
1
|
+
import { patternSearchModule } from './chunk-2SEL6SBS.mjs';
|
|
2
2
|
import './chunk-WQBCBKY3.mjs';
|
|
3
|
+
import './chunk-JUKYYXSP.mjs';
|
|
3
4
|
import './chunk-GES7U2PM.mjs';
|
|
4
|
-
import './chunk-
|
|
5
|
+
import './chunk-7XY6VD7B.mjs';
|
|
5
6
|
import './chunk-YTJCGKM4.mjs';
|
|
6
7
|
import './chunk-L5ORED7V.mjs';
|
|
7
|
-
import './chunk-
|
|
8
|
+
import './chunk-CZ7ISLXA.mjs';
|
|
8
9
|
|
|
9
10
|
// src/pattern/index.ts
|
|
10
11
|
var patternSearch = patternSearchModule;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as BM25FieldParams, P as PartitionConfig, e as ScoringMode, V as VectorIndexConfig } from '../../schema-
|
|
1
|
+
import { c as BM25FieldParams, P as PartitionConfig, e as ScoringMode, V as VectorIndexConfig } from '../../schema-CS-clLun.js';
|
|
2
2
|
import '../../adapters-BQFQ4PRz.js';
|
|
3
3
|
import '../../synonyms-CpOAHPa-.js';
|
|
4
4
|
|
|
@@ -192,6 +192,7 @@ interface IndexMetadata {
|
|
|
192
192
|
/** Persisted so recovered indexes keep collecting surface forms. */
|
|
193
193
|
surfaceForms?: boolean;
|
|
194
194
|
analysisRevision?: string;
|
|
195
|
+
arrayPositionGap?: number;
|
|
195
196
|
tokenizer?: string;
|
|
196
197
|
stopWords?: string;
|
|
197
198
|
stopWordList?: string[];
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { createDurableDirectory } from '../../chunk-
|
|
1
|
+
import { createDurableDirectory } from '../../chunk-NMXRXFGZ.mjs';
|
|
2
2
|
import '../../chunk-W55X2BYN.mjs';
|
|
3
3
|
import '../../chunk-HLPRHOSO.mjs';
|
|
4
|
-
import { CHECKPOINT_WORKER_HEARTBEAT_MS, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
4
|
+
import { CHECKPOINT_WORKER_HEARTBEAT_MS, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-2JWNJSNE.mjs';
|
|
5
|
+
import '../../chunk-7OIQ2SIO.mjs';
|
|
6
6
|
import '../../chunk-P36MUFEJ.mjs';
|
|
7
7
|
import '../../chunk-YH5OIL7B.mjs';
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
10
|
-
import '../../chunk-
|
|
11
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-TGHNXN7W.mjs';
|
|
9
|
+
import '../../chunk-6M6SDH3S.mjs';
|
|
10
|
+
import '../../chunk-JT3YZGCE.mjs';
|
|
11
|
+
import '../../chunk-NNO7CO3A.mjs';
|
|
12
12
|
import '../../chunk-AV4IJKD2.mjs';
|
|
13
|
-
import '../../chunk-
|
|
14
|
-
import '../../chunk-
|
|
15
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-RWESFSJI.mjs';
|
|
14
|
+
import '../../chunk-2MKX2SCO.mjs';
|
|
15
|
+
import '../../chunk-ZR4VM4A6.mjs';
|
|
16
16
|
import '../../chunk-ZATRDAYU.mjs';
|
|
17
17
|
import '../../chunk-EBIHRL7B.mjs';
|
|
18
18
|
import '../../chunk-HJSN7UYG.mjs';
|
|
19
|
-
import '../../chunk-
|
|
19
|
+
import '../../chunk-RNSC4NFI.mjs';
|
|
20
20
|
import '../../chunk-TGP5M5R7.mjs';
|
|
21
21
|
import '../../chunk-U2BKYEC7.mjs';
|
|
22
22
|
import '../../chunk-KOKM4PQN.mjs';
|
|
23
23
|
import '../../chunk-QSK35UC2.mjs';
|
|
24
|
-
import '../../chunk-
|
|
25
|
-
import '../../chunk-
|
|
24
|
+
import '../../chunk-2C3WXBQS.mjs';
|
|
25
|
+
import '../../chunk-2SEL6SBS.mjs';
|
|
26
26
|
import '../../chunk-WQBCBKY3.mjs';
|
|
27
|
-
import '../../chunk-
|
|
28
|
-
import '../../chunk-
|
|
27
|
+
import '../../chunk-JUKYYXSP.mjs';
|
|
28
|
+
import '../../chunk-EUCX5K74.mjs';
|
|
29
|
+
import '../../chunk-PU6SKH7O.mjs';
|
|
29
30
|
import '../../chunk-U476IXKQ.mjs';
|
|
30
|
-
import '../../chunk-
|
|
31
|
+
import '../../chunk-FQBFZAWG.mjs';
|
|
31
32
|
import '../../chunk-VJS4JFBQ.mjs';
|
|
32
33
|
import '../../chunk-GES7U2PM.mjs';
|
|
33
|
-
import '../../chunk-
|
|
34
|
-
import '../../chunk-
|
|
34
|
+
import '../../chunk-7XY6VD7B.mjs';
|
|
35
|
+
import '../../chunk-6SSVIW7Y.mjs';
|
|
35
36
|
import '../../chunk-X5CV2E2B.mjs';
|
|
36
37
|
import '../../chunk-7X5JST5L.mjs';
|
|
37
|
-
import '../../chunk-
|
|
38
|
+
import '../../chunk-D5TFRB5G.mjs';
|
|
39
|
+
import '../../chunk-4UMZ7KQL.mjs';
|
|
38
40
|
import '../../chunk-R6A773WK.mjs';
|
|
39
41
|
import '../../chunk-YTJCGKM4.mjs';
|
|
40
42
|
import '../../chunk-UJWGQIXU.mjs';
|
|
41
|
-
import '../../chunk-
|
|
43
|
+
import '../../chunk-HCGJKDZV.mjs';
|
|
42
44
|
import '../../chunk-22YPZVMG.mjs';
|
|
43
45
|
import '../../chunk-RFBLQLLZ.mjs';
|
|
44
46
|
import '../../chunk-L5ORED7V.mjs';
|
|
45
|
-
import '../../chunk-
|
|
47
|
+
import '../../chunk-CZ7ISLXA.mjs';
|
|
46
48
|
|
|
47
49
|
// src/persistence/durability/rebuild.ts
|
|
48
50
|
async function rebuildSegmentsFromDurable(root, metadata, targets, compactionThreshold, prior, capturedPartitions = [], keepsWriteRecords = false) {
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { createBitSet, bitsetIsEmpty, GrowableUint32, bitsetHas, bitsetSet } from './chunk-JUKYYXSP.mjs';
|
|
2
|
+
import { MAX_QUERY_PHRASES, MAX_PHRASE_WORDS } from './chunk-FQBFZAWG.mjs';
|
|
3
|
+
import { PHRASE_ROWS_START, PHRASE_SORT_RADIX_BITS, PHRASE_SORT_CLOCK_ROWS } from './chunk-4UMZ7KQL.mjs';
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-CZ7ISLXA.mjs';
|
|
5
|
+
|
|
6
|
+
// src/core/partition/phrase-matching.ts
|
|
7
|
+
var UINT32_BITS = 32;
|
|
8
|
+
var WorkTally = class {
|
|
9
|
+
constructor(meter) {
|
|
10
|
+
this.meter = meter;
|
|
11
|
+
}
|
|
12
|
+
pending = 0;
|
|
13
|
+
add(units) {
|
|
14
|
+
this.pending += units;
|
|
15
|
+
if (this.meter !== void 0 && this.pending >= this.meter.flushUnits) this.flush();
|
|
16
|
+
}
|
|
17
|
+
tickClock(units) {
|
|
18
|
+
this.meter?.clock?.tick(units);
|
|
19
|
+
}
|
|
20
|
+
flush() {
|
|
21
|
+
const units = this.pending;
|
|
22
|
+
this.pending = 0;
|
|
23
|
+
this.meter?.add(units);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function placeRowsByDigit(docIds, from, to, shift, starts, tally) {
|
|
27
|
+
const count = from.length;
|
|
28
|
+
const mask = starts.length - 1;
|
|
29
|
+
starts.fill(0);
|
|
30
|
+
for (let row = 0; row < count; row++) starts[docIds[row] >>> shift & mask]++;
|
|
31
|
+
let next = 0;
|
|
32
|
+
for (let digit = 0; digit < starts.length; digit++) {
|
|
33
|
+
const held = starts[digit];
|
|
34
|
+
starts[digit] = next;
|
|
35
|
+
next += held;
|
|
36
|
+
}
|
|
37
|
+
for (let begin = 0; begin < count; begin += PHRASE_SORT_CLOCK_ROWS) {
|
|
38
|
+
const end = Math.min(count, begin + PHRASE_SORT_CLOCK_ROWS);
|
|
39
|
+
for (let at = begin; at < end; at++) {
|
|
40
|
+
const row = from[at];
|
|
41
|
+
to[starts[docIds[row] >>> shift & mask]++] = row;
|
|
42
|
+
}
|
|
43
|
+
tally.tickClock(end - begin);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function sortedRowOrder(docIds, count, tally) {
|
|
47
|
+
let order = new Uint32Array(count);
|
|
48
|
+
for (let row = 0; row < count; row++) order[row] = row;
|
|
49
|
+
let spare = new Uint32Array(count);
|
|
50
|
+
const starts = new Uint32Array(1 << PHRASE_SORT_RADIX_BITS);
|
|
51
|
+
for (let shift = 0; shift < UINT32_BITS; shift += PHRASE_SORT_RADIX_BITS) {
|
|
52
|
+
placeRowsByDigit(docIds, order, spare, shift, starts, tally);
|
|
53
|
+
const placed = spare;
|
|
54
|
+
spare = order;
|
|
55
|
+
order = placed;
|
|
56
|
+
}
|
|
57
|
+
return order;
|
|
58
|
+
}
|
|
59
|
+
function tokenRowsOf(list, tally) {
|
|
60
|
+
const store = list.positionStore ?? null;
|
|
61
|
+
if (store === null) return null;
|
|
62
|
+
const count = list.length;
|
|
63
|
+
const docIds = list.docIds;
|
|
64
|
+
if (list.ordered) {
|
|
65
|
+
return { list, keys: docIds, order: null, fields: list.fieldNameIndices, store, count, cursor: 0, positionRow: 0 };
|
|
66
|
+
}
|
|
67
|
+
tally.add(count);
|
|
68
|
+
const order = sortedRowOrder(docIds, count, tally);
|
|
69
|
+
const keys = new Uint32Array(count);
|
|
70
|
+
for (let row = 0; row < count; row++) keys[row] = docIds[order[row]];
|
|
71
|
+
return { list, keys, order, fields: list.fieldNameIndices, store, count, cursor: 0, positionRow: 0 };
|
|
72
|
+
}
|
|
73
|
+
function resolvePhrase(index, phrase, sharedRows, tally) {
|
|
74
|
+
const entryRows = [];
|
|
75
|
+
const rows = [];
|
|
76
|
+
for (const token of phrase.tokens) {
|
|
77
|
+
let found = sharedRows.get(token);
|
|
78
|
+
if (found === void 0) {
|
|
79
|
+
const list = index.lookupReadOnce?.(token) ?? index.lookup(token);
|
|
80
|
+
if (list === void 0) return null;
|
|
81
|
+
const built = tokenRowsOf(list, tally);
|
|
82
|
+
if (built === null) return null;
|
|
83
|
+
found = built;
|
|
84
|
+
sharedRows.set(token, found);
|
|
85
|
+
}
|
|
86
|
+
if (!rows.includes(found)) rows.push(found);
|
|
87
|
+
entryRows.push(found);
|
|
88
|
+
}
|
|
89
|
+
let leadEntry = 0;
|
|
90
|
+
for (let entry = 1; entry < entryRows.length; entry++) {
|
|
91
|
+
if (entryRows[entry].count < entryRows[leadEntry].count) leadEntry = entry;
|
|
92
|
+
}
|
|
93
|
+
return { phrase, rows, entryRows, lead: entryRows[leadEntry], leadOffset: phrase.offsets[leadEntry] };
|
|
94
|
+
}
|
|
95
|
+
function firstRowFor(rows, doc) {
|
|
96
|
+
const { keys, count } = rows;
|
|
97
|
+
let low = rows.cursor < count && keys[rows.cursor] <= doc ? rows.cursor : 0;
|
|
98
|
+
let high = low;
|
|
99
|
+
let step = 1;
|
|
100
|
+
while (high < count && keys[high] < doc) {
|
|
101
|
+
low = high + 1;
|
|
102
|
+
high += step;
|
|
103
|
+
step *= 2;
|
|
104
|
+
}
|
|
105
|
+
if (high > count) high = count;
|
|
106
|
+
while (low < high) {
|
|
107
|
+
const middle = low + high >>> 1;
|
|
108
|
+
if (keys[middle] < doc) low = middle + 1;
|
|
109
|
+
else high = middle;
|
|
110
|
+
}
|
|
111
|
+
rows.cursor = low;
|
|
112
|
+
return low;
|
|
113
|
+
}
|
|
114
|
+
function positionRowFor(rows, doc, field) {
|
|
115
|
+
const { keys, order, fields, count } = rows;
|
|
116
|
+
for (let at = firstRowFor(rows, doc); at < count && keys[at] === doc; at++) {
|
|
117
|
+
const row = order === null ? at : order[at];
|
|
118
|
+
if (fields[row] === field) return row;
|
|
119
|
+
}
|
|
120
|
+
return -1;
|
|
121
|
+
}
|
|
122
|
+
function countPhraseStarts(resolved, leadRow, cursors, ends, tally) {
|
|
123
|
+
const { entryRows, lead, leadOffset, phrase } = resolved;
|
|
124
|
+
const offsets = phrase.offsets;
|
|
125
|
+
for (let entry = 0; entry < entryRows.length; entry++) {
|
|
126
|
+
const rows = entryRows[entry];
|
|
127
|
+
const start = rows.list.positionStartAt?.(rows.positionRow) ?? 0;
|
|
128
|
+
cursors[entry] = start;
|
|
129
|
+
ends[entry] = start + (rows.list.positionCountAt?.(rows.positionRow) ?? 0);
|
|
130
|
+
}
|
|
131
|
+
const leadStore = lead.store;
|
|
132
|
+
const leadStart = lead.list.positionStartAt?.(leadRow) ?? 0;
|
|
133
|
+
const leadEnd = leadStart + (lead.list.positionCountAt?.(leadRow) ?? 0);
|
|
134
|
+
let starts = 0;
|
|
135
|
+
for (let at = leadStart; at < leadEnd; at++) {
|
|
136
|
+
const anchor = leadStore[at] - leadOffset;
|
|
137
|
+
if (anchor < 0) continue;
|
|
138
|
+
let holdsEveryEntry = true;
|
|
139
|
+
for (let entry = 0; entry < entryRows.length; entry++) {
|
|
140
|
+
const store = entryRows[entry].store;
|
|
141
|
+
const wanted = anchor + offsets[entry];
|
|
142
|
+
let cursor = cursors[entry];
|
|
143
|
+
const end = ends[entry];
|
|
144
|
+
let compared = 1;
|
|
145
|
+
while (cursor < end && store[cursor] < wanted) {
|
|
146
|
+
cursor++;
|
|
147
|
+
compared++;
|
|
148
|
+
}
|
|
149
|
+
cursors[entry] = cursor;
|
|
150
|
+
tally.add(compared);
|
|
151
|
+
if (cursor === end) {
|
|
152
|
+
return starts;
|
|
153
|
+
}
|
|
154
|
+
if (store[cursor] !== wanted) {
|
|
155
|
+
holdsEveryEntry = false;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (holdsEveryEntry) starts++;
|
|
160
|
+
}
|
|
161
|
+
return starts;
|
|
162
|
+
}
|
|
163
|
+
function collectPhraseRows(resolved, searchable, allowed, capacity, keepRows, tally) {
|
|
164
|
+
const hits = createBitSet(capacity);
|
|
165
|
+
const collected = {
|
|
166
|
+
phrase: resolved.phrase,
|
|
167
|
+
lists: resolved.entryRows.map((rows2) => rows2.list),
|
|
168
|
+
docIds: new GrowableUint32(PHRASE_ROWS_START),
|
|
169
|
+
fieldIndices: new GrowableUint32(PHRASE_ROWS_START),
|
|
170
|
+
frequencies: new GrowableUint32(PHRASE_ROWS_START)
|
|
171
|
+
};
|
|
172
|
+
const { lead, rows } = resolved;
|
|
173
|
+
const leadList = lead.list;
|
|
174
|
+
const docIds = leadList.docIds;
|
|
175
|
+
const fields = leadList.fieldNameIndices;
|
|
176
|
+
const deleted = leadList.deletedDocs;
|
|
177
|
+
const hasDeleted = deleted.size > 0;
|
|
178
|
+
const cursors = new Int32Array(resolved.entryRows.length);
|
|
179
|
+
const ends = new Int32Array(resolved.entryRows.length);
|
|
180
|
+
for (const each of rows) each.cursor = 0;
|
|
181
|
+
for (let leadRow = 0; leadRow < lead.count; leadRow++) {
|
|
182
|
+
tally.add(1);
|
|
183
|
+
const doc = docIds[leadRow];
|
|
184
|
+
const field = fields[leadRow];
|
|
185
|
+
if (searchable[field] === 0) continue;
|
|
186
|
+
if (hasDeleted && deleted.has(doc)) continue;
|
|
187
|
+
if (allowed !== void 0 && !bitsetHas(allowed, doc)) continue;
|
|
188
|
+
let holdsEveryToken = true;
|
|
189
|
+
for (const each of rows) {
|
|
190
|
+
if (each === lead) {
|
|
191
|
+
each.positionRow = leadRow;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const row = positionRowFor(each, doc, field);
|
|
195
|
+
if (row === -1) {
|
|
196
|
+
holdsEveryToken = false;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
each.positionRow = row;
|
|
200
|
+
}
|
|
201
|
+
if (!holdsEveryToken) continue;
|
|
202
|
+
const starts = countPhraseStarts(resolved, leadRow, cursors, ends, tally);
|
|
203
|
+
if (starts === 0) continue;
|
|
204
|
+
bitsetSet(hits, doc);
|
|
205
|
+
if (keepRows) {
|
|
206
|
+
collected.docIds.push(doc);
|
|
207
|
+
collected.fieldIndices.push(field);
|
|
208
|
+
collected.frequencies.push(starts);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return { hits, rows: collected };
|
|
212
|
+
}
|
|
213
|
+
function matchPhrases(index, phrases, searchable, filterBitset, capacity, meter, keepRows) {
|
|
214
|
+
const tally = new WorkTally(meter);
|
|
215
|
+
const sharedRows = /* @__PURE__ */ new Map();
|
|
216
|
+
const resolved = [];
|
|
217
|
+
for (const phrase of phrases) {
|
|
218
|
+
const found = resolvePhrase(index, phrase, sharedRows, tally);
|
|
219
|
+
if (found === null) {
|
|
220
|
+
tally.flush();
|
|
221
|
+
return { matched: createBitSet(capacity), rows: [] };
|
|
222
|
+
}
|
|
223
|
+
resolved.push(found);
|
|
224
|
+
}
|
|
225
|
+
resolved.sort((first, second) => first.lead.count - second.lead.count);
|
|
226
|
+
const rows = [];
|
|
227
|
+
let allowed = filterBitset;
|
|
228
|
+
for (const each of resolved) {
|
|
229
|
+
const collected = collectPhraseRows(each, searchable, allowed, capacity, keepRows, tally);
|
|
230
|
+
allowed = collected.hits;
|
|
231
|
+
rows.push(collected.rows);
|
|
232
|
+
if (bitsetIsEmpty(allowed)) break;
|
|
233
|
+
}
|
|
234
|
+
tally.flush();
|
|
235
|
+
return { matched: allowed ?? createBitSet(capacity), rows };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/search/phrase-analysis.ts
|
|
239
|
+
function phraseKeyOf(tokens, offsets) {
|
|
240
|
+
const slots = [];
|
|
241
|
+
for (let index = 0; index < tokens.length; index++) {
|
|
242
|
+
const gap = index === 0 ? 0 : offsets[index] - offsets[index - 1] - 1;
|
|
243
|
+
for (let missing = 0; missing < gap; missing++) slots.push("?");
|
|
244
|
+
slots.push(tokens[index]);
|
|
245
|
+
}
|
|
246
|
+
return `"${slots.join(" ")}"`;
|
|
247
|
+
}
|
|
248
|
+
function identityOf(tokens, offsets) {
|
|
249
|
+
return JSON.stringify([tokens, offsets]);
|
|
250
|
+
}
|
|
251
|
+
function analyseQueryPhrases(parts, analyseText) {
|
|
252
|
+
const wordParts = [];
|
|
253
|
+
const phrases = [];
|
|
254
|
+
const seen = /* @__PURE__ */ new Set();
|
|
255
|
+
let keptPhraseCount = 0;
|
|
256
|
+
let largestPhraseSize = 0;
|
|
257
|
+
let largestTokenCount = 0;
|
|
258
|
+
let wordsAfterLastPhrase = "";
|
|
259
|
+
for (let index = 0; index < parts.length; index++) {
|
|
260
|
+
const part = parts[index];
|
|
261
|
+
if (index % 2 === 0) {
|
|
262
|
+
wordParts.push(part);
|
|
263
|
+
wordsAfterLastPhrase = `${wordsAfterLastPhrase} ${part}`;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (part.trim().length === 0) continue;
|
|
267
|
+
const entries = analyseText(part);
|
|
268
|
+
if (entries.length === 0) continue;
|
|
269
|
+
const ordered = [...entries].sort((first, second) => first.position - second.position);
|
|
270
|
+
const firstPosition = ordered[0].position;
|
|
271
|
+
const size = ordered[ordered.length - 1].position - firstPosition + 1;
|
|
272
|
+
keptPhraseCount++;
|
|
273
|
+
wordsAfterLastPhrase = "";
|
|
274
|
+
if (size > largestPhraseSize) largestPhraseSize = size;
|
|
275
|
+
if (ordered.length > largestTokenCount) largestTokenCount = ordered.length;
|
|
276
|
+
const tokens = ordered.map((entry) => entry.token);
|
|
277
|
+
const offsets = ordered.map((entry) => entry.position - firstPosition);
|
|
278
|
+
const identity = identityOf(tokens, offsets);
|
|
279
|
+
if (seen.has(identity)) continue;
|
|
280
|
+
seen.add(identity);
|
|
281
|
+
phrases.push({ key: phraseKeyOf(tokens, offsets), tokens, offsets });
|
|
282
|
+
}
|
|
283
|
+
const endsWithPhrase = keptPhraseCount > 0 && (wordsAfterLastPhrase.trim().length === 0 || analyseText(wordsAfterLastPhrase).length === 0);
|
|
284
|
+
return {
|
|
285
|
+
words: wordParts.join(" "),
|
|
286
|
+
phrases,
|
|
287
|
+
keptPhraseCount,
|
|
288
|
+
largestPhraseSize,
|
|
289
|
+
largestTokenCount,
|
|
290
|
+
endsWithPhrase
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function withWordsOnly(params, phrases) {
|
|
294
|
+
return { ...params, term: phrases.words, prefix: phrases.endsWithPhrase ? false : params.prefix };
|
|
295
|
+
}
|
|
296
|
+
function refusePhraseUntilRebuilt(indexName, rebuildMode) {
|
|
297
|
+
const remedy = rebuildMode === "manual" ? "This engine leaves the rebuild to its caller, so somebody has to start it with rebuildAnalysis" : "Try the query again once the rebuild finishes";
|
|
298
|
+
throw new NarsilError(
|
|
299
|
+
ErrorCodes.SEARCH_PHRASE_NOT_READY,
|
|
300
|
+
`Index "${indexName}" holds array fields whose terms need a rebuild, so it cannot match a phrase yet. ${remedy}`,
|
|
301
|
+
{ indexName, rebuild: rebuildMode }
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
function requirePhrasesWithinLimits(phrases, trackPositions) {
|
|
305
|
+
if (phrases.keptPhraseCount === 0) return;
|
|
306
|
+
if (phrases.keptPhraseCount > MAX_QUERY_PHRASES) {
|
|
307
|
+
throw new NarsilError(
|
|
308
|
+
ErrorCodes.SEARCH_INVALID_PHRASE,
|
|
309
|
+
`A query takes at most ${MAX_QUERY_PHRASES} phrases, while this query holds ${phrases.keptPhraseCount}`,
|
|
310
|
+
{ limit: MAX_QUERY_PHRASES, phrases: phrases.keptPhraseCount }
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
if (phrases.largestPhraseSize > MAX_PHRASE_WORDS || phrases.largestTokenCount > MAX_PHRASE_WORDS) {
|
|
314
|
+
throw new NarsilError(
|
|
315
|
+
ErrorCodes.SEARCH_INVALID_PHRASE,
|
|
316
|
+
`A phrase takes at most ${MAX_PHRASE_WORDS} words, counting the stop words between its first and last word, while this query holds one of ${Math.max(phrases.largestPhraseSize, phrases.largestTokenCount)}`,
|
|
317
|
+
{ limit: MAX_PHRASE_WORDS, words: Math.max(phrases.largestPhraseSize, phrases.largestTokenCount) }
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
if (!trackPositions) {
|
|
321
|
+
throw new NarsilError(
|
|
322
|
+
ErrorCodes.SEARCH_INVALID_PHRASE,
|
|
323
|
+
"This index stores no word positions because its trackPositions setting is off, so it cannot match a phrase. Remove the quotes, or create the index with trackPositions on",
|
|
324
|
+
{ trackPositions: false }
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export { analyseQueryPhrases, matchPhrases, refusePhraseUntilRebuilt, requirePhrasesWithinLimits, withWordsOnly };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { N as NarsilError, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, Q as QueryParams, P as PreflightResult, e as QueryResult, h as SuggestParams, j as SuggestResult } from './events-
|
|
2
|
-
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-
|
|
3
|
-
import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-
|
|
4
|
-
export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-
|
|
1
|
+
import { N as NarsilError, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, Q as QueryParams, P as PreflightResult, e as QueryResult, h as SuggestParams, j as SuggestResult } from './events-DErop1LM.js';
|
|
2
|
+
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-DErop1LM.js';
|
|
3
|
+
import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-BfF-VRhm.js';
|
|
4
|
+
export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-BfF-VRhm.js';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
|
-
import { N as Narsil } from './engine-
|
|
7
|
-
import { N as NarsilClient, I as ImportSource } from './client-
|
|
8
|
-
import { A as AnyDocument } from './schema-
|
|
6
|
+
import { N as Narsil } from './engine-B_W9sdZK.js';
|
|
7
|
+
import { N as NarsilClient, I as ImportSource } from './client-Cx-TiqPE.js';
|
|
8
|
+
import { A as AnyDocument } from './schema-CS-clLun.js';
|
|
9
9
|
import './synonyms-CpOAHPa-.js';
|
|
10
10
|
import './adapters-BQFQ4PRz.js';
|
|
11
11
|
|
package/dist/react.mjs
CHANGED
|
@@ -34,6 +34,8 @@ var ErrorCodes = {
|
|
|
34
34
|
SEARCH_INVALID_CURSOR: "SEARCH_INVALID_CURSOR",
|
|
35
35
|
SEARCH_RESULT_WINDOW_EXCEEDED: "SEARCH_RESULT_WINDOW_EXCEEDED",
|
|
36
36
|
SEARCH_WORK_CAP_EXCEEDED: "SEARCH_WORK_CAP_EXCEEDED",
|
|
37
|
+
SEARCH_INVALID_PHRASE: "SEARCH_INVALID_PHRASE",
|
|
38
|
+
SEARCH_PHRASE_NOT_READY: "SEARCH_PHRASE_NOT_READY",
|
|
37
39
|
BM25_NOT_READY: "BM25_NOT_READY",
|
|
38
40
|
LANGUAGE_NOT_SUPPORTED: "LANGUAGE_NOT_SUPPORTED",
|
|
39
41
|
ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
|