@delali/narsil 0.3.1-next.157 → 0.3.1-next.161
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 +3 -3
- package/dist/adapters/gcs.mjs +3 -3
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +3 -3
- package/dist/browser/{chunk-N23GL72Q.mjs → chunk-4RNSFVWI.mjs} +20777 -19056
- package/dist/browser/chunk-MMHIIL5B.mjs +564 -0
- package/dist/browser/chunk-MZHQ65VI.mjs +1228 -0
- package/dist/browser/chunk-WC2DEXWU.mjs +29 -0
- package/dist/browser/{chunk-VLJQW4J6.mjs → core-leaf-TJAGWPZZ.mjs} +4674 -3102
- package/dist/{react-native/chunks/durability-config-QXVZEO7T.mjs → browser/durability-config-SGB5ZP5K.mjs} +8 -3
- package/dist/browser/embed-RF2MPGAO.mjs +222 -0
- package/dist/{react-native/chunks/geo-index-PX3BIHAH.mjs → browser/geo-index-GNHY4PUB.mjs} +190 -93
- package/dist/{react-native/chunks/module-TTEVPRCW.mjs → browser/module-362VSIGR.mjs} +1570 -275
- package/dist/browser/msgpack-leaf-44XNWSSY.mjs +302 -0
- package/dist/browser/optional-reads-XMVPG6HG.mjs +3230 -0
- package/dist/browser/optional-writes-WMZX4OEC.mjs +3196 -0
- package/dist/browser/phrase-module-22TKMXWI.mjs +616 -0
- package/dist/browser/resolve-vector-text-KI65IHMD.mjs +60 -0
- package/dist/browser/{restore-hooks-IE3GGYHG.mjs → restore-queue-S4BWOGMU.mjs} +98 -24
- package/dist/{react-native/chunks/runtime-R5E3TB3J.mjs → browser/runtime-NU6VOVH2.mjs} +61 -25
- package/dist/browser/segment-codec-leaf-A427QJUX.mjs +554 -0
- package/dist/browser/segment-merge-leaf-7BZ54JPI.mjs +1636 -0
- package/dist/browser/storage-leaf-X6CNRHJS.mjs +18221 -0
- package/dist/browser/store-leaf-AEMTAVHX.mjs +2069 -0
- package/dist/browser/{chunk-GFAZPSWK.mjs → suggestions-leaf-3Y6MR6OF.mjs} +441 -119
- package/dist/browser/worker-copies-WQCPP3TS.mjs +2750 -0
- package/dist/{capabilities-D3AoBJoF.d.ts → capabilities-BKDrry0z.d.ts} +2 -2
- package/dist/chunk-2JRERUNZ.mjs +217 -0
- package/dist/chunk-2RIS76RJ.mjs +212 -0
- package/dist/chunk-3B775F3C.mjs +252 -0
- package/dist/{chunk-24FNVRKB.mjs → chunk-3D6RZGJH.mjs} +3 -3
- package/dist/{chunk-INJYO3BU.mjs → chunk-4CAMH7FO.mjs} +1 -1
- package/dist/{chunk-U476IXKQ.mjs → chunk-4PY4JYMY.mjs} +2 -1
- package/dist/chunk-6EZW2GQL.mjs +978 -0
- package/dist/chunk-75UNINFA.mjs +271 -0
- package/dist/chunk-77AUVDQ5.mjs +7 -0
- package/dist/{chunk-JTYPJF3T.mjs → chunk-7MWYORQC.mjs} +2 -2
- package/dist/{chunk-TGP5M5R7.mjs → chunk-7T4LAYT4.mjs} +1 -1
- package/dist/{chunk-XIHUI4KB.mjs → chunk-AB27FWZM.mjs} +8 -3
- package/dist/{chunk-FUD5XSZ5.mjs → chunk-BXM7XM4G.mjs} +7 -3
- package/dist/{chunk-HJJI72X7.mjs → chunk-C7YQHCSO.mjs} +1 -1
- package/dist/{chunk-RVGRFOGN.mjs → chunk-D456ZFPQ.mjs} +2 -1
- package/dist/{chunk-KKQC526K.mjs → chunk-E2F6LZR3.mjs} +19 -21
- package/dist/{chunk-SMOOSIAW.mjs → chunk-FE3MRIBN.mjs} +104 -13
- package/dist/{chunk-KYYABCSW.mjs → chunk-FETZYCH7.mjs} +15 -1
- package/dist/{chunk-XXJZMTZT.mjs → chunk-FVZ5DB6Y.mjs} +3 -2
- package/dist/{chunk-EYD7K3H6.mjs → chunk-GF4K7IUK.mjs} +317 -120
- package/dist/chunk-GXCDWLQI.mjs +193 -0
- package/dist/{chunk-IIRIG7H5.mjs → chunk-H64YDF5M.mjs} +3 -3
- package/dist/{browser/chunk-VY5KW3HN.mjs → chunk-HOOR4CP5.mjs} +63 -7
- package/dist/chunk-IB4BYLE3.mjs +127 -0
- package/dist/{chunk-3C7MTCCI.mjs → chunk-IE3Q62QD.mjs} +2 -2
- package/dist/chunk-IH3G6SJO.mjs +40 -0
- package/dist/chunk-JV74RKCY.mjs +3041 -0
- package/dist/{chunk-ZPZ3YGXV.mjs → chunk-K67I3RF4.mjs} +261 -101
- package/dist/chunk-KLVMK3R5.mjs +47 -0
- package/dist/{chunk-5VV4R6P7.mjs → chunk-LAWIJRMJ.mjs} +4154 -2577
- package/dist/chunk-LF4GB4PO.mjs +281 -0
- package/dist/chunk-NC4QLCZC.mjs +59 -0
- package/dist/chunk-OOO54OVC.mjs +627 -0
- package/dist/chunk-OUWZKNO3.mjs +207 -0
- package/dist/{chunk-FJKKCV4D.mjs → chunk-P5YLI5ED.mjs} +343 -182
- package/dist/{chunk-4ZTHGTVX.mjs → chunk-PTTMGRG5.mjs} +9 -10
- package/dist/{react-native/chunks/chunk-DZ7H7D2C.mjs → chunk-Q3ZZH5Z7.mjs} +6 -0
- package/dist/{browser/chunk-EKMGCRSR.mjs → chunk-QBVTYY4J.mjs} +2 -9
- package/dist/{chunk-W5EB5XKI.mjs → chunk-R4CE4IVU.mjs} +341 -183
- package/dist/chunk-S2POFTLN.mjs +10 -0
- package/dist/{chunk-KJ3RTZDJ.mjs → chunk-S3BSDBF7.mjs} +10 -3
- package/dist/{chunk-4LMSZAK6.mjs → chunk-SHGN3QIF.mjs} +69 -13
- package/dist/chunk-SXIRM4MX.mjs +3549 -0
- package/dist/{chunk-TBC3XUL2.mjs → chunk-TGPKS2UM.mjs} +47 -1
- package/dist/chunk-TINW4BSH.mjs +31301 -0
- package/dist/{cold-module-VOJXMNZB.mjs → chunk-TSLV5P2J.mjs} +397 -80
- package/dist/{chunk-HHBUCIUY.mjs → chunk-TW543F33.mjs} +3 -3
- package/dist/chunk-U6B7DUQW.mjs +788 -0
- package/dist/{chunk-OQLD2BSW.mjs → chunk-V3SGPXWQ.mjs} +8 -9
- package/dist/chunk-W34VJXY7.mjs +4723 -0
- package/dist/chunk-YETKPX5M.mjs +5 -0
- package/dist/chunk-ZQ6QY42L.mjs +59 -0
- package/dist/{client-kqSMevVi.d.ts → client-CTp8RRiK.d.ts} +4 -4
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +66 -18
- package/dist/{config-B4v_Htpu.d.ts → config-PCNzWjHL.d.ts} +6 -3
- package/dist/{config-CTP01fns.d.ts → config-_WT5grSL.d.ts} +3 -3
- package/dist/core-leaf-KXFGP74A.mjs +7 -0
- package/dist/digest-leaf-KXBGKYHZ.mjs +1 -0
- package/dist/direct-executor-MKTZBR26.mjs +16 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +7 -4
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +1 -2
- package/dist/distribution/transport/grpc.mjs +7 -2
- package/dist/distribution/transport/tcp.mjs +7 -1
- package/dist/distribution.d.ts +7 -7
- package/dist/distribution.mjs +1199 -1092
- package/dist/{browser/durability-config-TIYKW6XX.mjs → durability-config-XV4XR7Y4.mjs} +7 -3
- package/dist/embed-4H7RTBVL.mjs +221 -0
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CkPn2PWE.d.ts → engine-DBRVR_d-.d.ts} +1252 -1239
- package/dist/{browser/geo-index-OTV7VPIR.mjs → geo-index-2ZMMWWSK.mjs} +190 -93
- package/dist/{index-C4AmUnl1.d.ts → index-Ck9w5WHz.d.ts} +1 -1
- package/dist/index.browser.mjs +4 -16
- package/dist/index.d.ts +1495 -78
- package/dist/index.mjs +14 -50
- package/dist/index.react-native.mjs +11 -28
- package/dist/invalidation/filesystem.mjs +1 -2
- package/dist/languages/albanian.mjs +1 -1
- package/dist/languages/amharic.mjs +1 -1
- package/dist/languages/arabic.mjs +1 -1
- package/dist/languages/armenian.mjs +1 -1
- package/dist/languages/azerbaijani.mjs +1 -1
- package/dist/languages/bambara.mjs +1 -1
- package/dist/languages/basque.mjs +1 -1
- package/dist/languages/belarusian.mjs +1 -1
- package/dist/languages/bengali.mjs +1 -1
- package/dist/languages/bosnian.mjs +1 -1
- package/dist/languages/breton.mjs +1 -1
- package/dist/languages/bulgarian.mjs +1 -1
- package/dist/languages/burmese.mjs +1 -1
- package/dist/languages/catalan.mjs +1 -1
- package/dist/languages/chinese.mjs +1 -1
- package/dist/languages/croatian.mjs +1 -1
- package/dist/languages/czech.mjs +1 -1
- package/dist/languages/dagbani.mjs +1 -1
- package/dist/languages/danish.mjs +1 -1
- package/dist/languages/dutch.mjs +1 -1
- package/dist/languages/english.mjs +1 -1
- package/dist/languages/esperanto.mjs +1 -1
- package/dist/languages/estonian.mjs +1 -1
- package/dist/languages/ewe.mjs +1 -1
- package/dist/languages/faroese.mjs +1 -1
- package/dist/languages/fijian.mjs +1 -1
- package/dist/languages/finnish.mjs +1 -1
- package/dist/languages/french.mjs +1 -1
- package/dist/languages/ga.mjs +1 -1
- package/dist/languages/galician.mjs +1 -1
- package/dist/languages/georgian.mjs +1 -1
- package/dist/languages/german.mjs +1 -1
- package/dist/languages/greek.mjs +1 -1
- package/dist/languages/guarani.mjs +1 -1
- package/dist/languages/gujarati.mjs +1 -1
- package/dist/languages/haitian-creole.mjs +1 -1
- package/dist/languages/hausa.mjs +1 -1
- package/dist/languages/hawaiian.mjs +1 -1
- package/dist/languages/hebrew.mjs +1 -1
- package/dist/languages/hindi.mjs +1 -1
- package/dist/languages/hungarian.mjs +1 -1
- package/dist/languages/icelandic.mjs +1 -1
- package/dist/languages/igbo.mjs +1 -1
- package/dist/languages/indonesian.mjs +1 -1
- package/dist/languages/irish.mjs +1 -1
- package/dist/languages/italian.mjs +1 -1
- package/dist/languages/japanese.mjs +1 -1
- package/dist/languages/kannada.mjs +1 -1
- package/dist/languages/kazakh.mjs +1 -1
- package/dist/languages/khmer.mjs +1 -1
- package/dist/languages/kinyarwanda.mjs +1 -1
- package/dist/languages/kirundi.mjs +1 -1
- package/dist/languages/korean.mjs +1 -1
- package/dist/languages/kurmanji.mjs +1 -1
- package/dist/languages/kyrgyz.mjs +1 -1
- package/dist/languages/lao.mjs +1 -1
- package/dist/languages/latin.mjs +1 -1
- package/dist/languages/latvian.mjs +1 -1
- package/dist/languages/lingala.mjs +1 -1
- package/dist/languages/lithuanian.mjs +1 -1
- package/dist/languages/luxembourgish.mjs +1 -1
- package/dist/languages/macedonian.mjs +1 -1
- package/dist/languages/malagasy.mjs +1 -1
- package/dist/languages/malay.mjs +1 -1
- package/dist/languages/malayalam.mjs +1 -1
- package/dist/languages/maltese.mjs +1 -1
- package/dist/languages/maori.mjs +1 -1
- package/dist/languages/marathi.mjs +1 -1
- package/dist/languages/nepali.mjs +1 -1
- package/dist/languages/norwegian.mjs +1 -1
- package/dist/languages/oromo.mjs +1 -1
- package/dist/languages/persian.mjs +1 -1
- package/dist/languages/polish.mjs +1 -1
- package/dist/languages/portuguese.mjs +1 -1
- package/dist/languages/punjabi.mjs +1 -1
- package/dist/languages/romanian.mjs +1 -1
- package/dist/languages/russian.mjs +1 -1
- package/dist/languages/samoan.mjs +1 -1
- package/dist/languages/sanskrit.mjs +1 -1
- package/dist/languages/scottish-gaelic.mjs +1 -1
- package/dist/languages/serbian.mjs +1 -1
- package/dist/languages/shona.mjs +1 -1
- package/dist/languages/sinhala.mjs +1 -1
- package/dist/languages/slovak.mjs +1 -1
- package/dist/languages/slovenian.mjs +1 -1
- package/dist/languages/sorani.mjs +1 -1
- package/dist/languages/spanish.mjs +1 -1
- package/dist/languages/swahili.mjs +1 -1
- package/dist/languages/swedish.mjs +1 -1
- package/dist/languages/tagalog.mjs +1 -1
- package/dist/languages/tamil.mjs +1 -1
- package/dist/languages/tatar.mjs +1 -1
- package/dist/languages/telugu.mjs +1 -1
- package/dist/languages/thai.mjs +1 -1
- package/dist/languages/tibetan.mjs +1 -1
- package/dist/languages/tigrinya.mjs +1 -1
- package/dist/languages/tongan.mjs +1 -1
- package/dist/languages/turkish.mjs +1 -1
- package/dist/languages/twi.mjs +1 -1
- package/dist/languages/ukrainian.mjs +1 -1
- package/dist/languages/urdu.mjs +1 -1
- package/dist/languages/vietnamese.mjs +1 -1
- package/dist/languages/welsh.mjs +1 -1
- package/dist/languages/wolof.mjs +1 -1
- package/dist/languages/xhosa.mjs +1 -1
- package/dist/languages/yoruba.mjs +1 -1
- package/dist/languages/zulu.mjs +1 -1
- package/dist/{long-query-thread-QDFQSJD6.mjs → long-query-thread-JMGNGF6V.mjs} +74 -58
- package/dist/{module-N55W4Q5C.mjs → module-ZJ6ARG6V.mjs} +444 -111
- package/dist/msgpack-leaf-5WFRP6JM.mjs +9 -0
- package/dist/optional-reads-BR3BOVZW.mjs +3373 -0
- package/dist/optional-writes-DDFHYUOH.mjs +218 -0
- package/dist/{paged-partition-archive-RLRGOXDX.mjs → paged-partition-archive-G576XGVE.mjs} +29 -69
- package/dist/partial-words.browser.mjs +1649 -0
- package/dist/partial-words.mjs +15 -14
- package/dist/{chunk-CITFCZKF.mjs → pattern.browser.mjs} +153 -186
- package/dist/pattern.mjs +6 -8
- package/dist/persistence/durability/checkpoint-worker.d.ts +32 -24
- package/dist/persistence/durability/checkpoint-worker.mjs +27 -59
- package/dist/phrase-module-XK3T44VU.mjs +634 -0
- package/dist/query-actions-OMXJEC2J.mjs +118 -0
- package/dist/query-suggestions/merge-worker.mjs +18 -54
- package/dist/query-suggestions.browser.mjs +26 -227
- package/dist/query-suggestions.d.ts +2 -2
- package/dist/query-suggestions.mjs +16 -67
- package/dist/react-native/chunks/chunk-4EXKQ2IB.mjs +565 -0
- package/dist/react-native/chunks/chunk-52QD7CBJ.mjs +52 -0
- package/dist/react-native/chunks/chunk-72OKYHZL.mjs +969 -0
- package/dist/react-native/chunks/chunk-AQOWRH2C.mjs +802 -0
- package/dist/react-native/chunks/{chunk-4COWCEY7.mjs → chunk-FTQ7JNMU.mjs} +341 -180
- package/dist/react-native/chunks/chunk-G3CUQ333.mjs +42 -0
- package/dist/react-native/chunks/{chunk-EJ33LCHV.mjs → chunk-HRDMIQ63.mjs} +53 -1
- package/dist/react-native/chunks/{chunk-4AV5PPH6.mjs → chunk-IY6U6HRA.mjs} +63 -7
- package/dist/react-native/chunks/chunk-J2NQW353.mjs +212 -0
- package/dist/react-native/chunks/chunk-L4R5ITVG.mjs +29047 -0
- package/dist/react-native/chunks/{chunk-OXM66LO6.mjs → chunk-OK3WUA6N.mjs} +2 -10
- package/dist/react-native/chunks/{chunk-MVXELMJX.mjs → chunk-PVMEHBQO.mjs} +1 -1
- package/dist/{browser/chunk-SRMZXJSL.mjs → react-native/chunks/chunk-TQ26BKBH.mjs} +6 -0
- package/dist/{browser/chunk-GPPOG6PT.mjs → react-native/chunks/chunk-VUJCSQG5.mjs} +3 -1
- package/dist/react-native/chunks/{chunk-ENLMYKSX.mjs → chunk-XEGKQKLY.mjs} +5385 -3114
- package/dist/react-native/chunks/chunk-YOTP2FPE.mjs +232 -0
- package/dist/react-native/chunks/chunk-ZIU6TWXG.mjs +127 -0
- package/dist/react-native/chunks/core-leaf-5B4JXCVA.mjs +6 -0
- package/dist/react-native/chunks/digest-leaf-X6OIFDIU.mjs +1 -0
- package/dist/{durability-config-GE4U7MCZ.mjs → react-native/chunks/durability-config-3IOXIPYZ.mjs} +7 -3
- package/dist/react-native/chunks/embed-3WQ2CCR5.mjs +221 -0
- package/dist/{geo-index-MRH5JMIR.mjs → react-native/chunks/geo-index-QEYKEVPH.mjs} +190 -93
- package/dist/react-native/chunks/{chunk-CKNRFDTZ.mjs → gzip.react-native-DLO4WW27.mjs} +2 -1
- package/dist/{browser/module-TCT66FWA.mjs → react-native/chunks/module-VUA27HZZ.mjs} +1018 -540
- package/dist/react-native/chunks/msgpack-leaf-TR66ZVAX.mjs +7 -0
- package/dist/react-native/chunks/optional-reads-WDTLLHUT.mjs +3364 -0
- package/dist/react-native/chunks/optional-writes-FZV3QW34.mjs +267 -0
- package/dist/react-native/chunks/phrase-module-KCQWVXYZ.mjs +635 -0
- package/dist/react-native/chunks/resolve-vector-text-LXRYXF7M.mjs +59 -0
- package/dist/react-native/chunks/restore-queue-EI2V2I4S.mjs +179 -0
- package/dist/{browser/runtime-OTAGEFQW.mjs → react-native/chunks/runtime-BUCSAK4U.mjs} +61 -25
- package/dist/react-native/chunks/segment-codec-leaf-6ULP7H3I.mjs +12 -0
- package/dist/react-native/chunks/segment-merge-leaf-F4GQZNK6.mjs +13 -0
- package/dist/react-native/chunks/storage-leaf-OAXBU2L6.mjs +18042 -0
- package/dist/react-native/chunks/store-leaf-GY2ZZFXB.mjs +14 -0
- package/dist/react-native/chunks/{chunk-WW2X2AEI.mjs → suggestions-leaf-SQEZ4IBS.mjs} +332 -118
- package/dist/react-native/chunks/worker-copies-EEHSCFJW.mjs +2627 -0
- package/dist/react-native/partial-words.mjs +954 -35
- package/dist/react-native/pattern.mjs +238 -111
- package/dist/react-native/query-suggestions.mjs +33 -239
- package/dist/react-native/sync.mjs +95 -52
- package/dist/react-native/synonyms.mjs +256 -112
- package/dist/react.d.ts +9 -9
- package/dist/react.mjs +6 -0
- package/dist/{rerank-MQ37IYRV.mjs → rerank-Y6MWBMTT.mjs} +17 -8
- package/dist/rerankers/http.mjs +2 -2
- package/dist/resolve-vector-text-4PDRTPNQ.mjs +2 -0
- package/dist/restore-queue-KPYSRJ4A.mjs +184 -0
- package/dist/runtime-4GKUIAKV.mjs +595 -0
- package/dist/{schema-Jwt928nJ.d.ts → schema-C_7yRJLt.d.ts} +1 -1
- package/dist/segment-codec-leaf-6IFBSBPN.mjs +17 -0
- package/dist/segment-merge-leaf-VE3FUSVE.mjs +17 -0
- package/dist/server.d.ts +33 -13
- package/dist/server.mjs +81 -100
- package/dist/{browser/durability-wiring-GVZEE46O.mjs → storage-leaf-HMIIOUYN.mjs} +2334 -931
- package/dist/store-leaf-M7T7SUZJ.mjs +19 -0
- package/dist/stored-values-BWIMpiT_.d.ts +25 -0
- package/dist/suggestions-leaf-Q3Q5D6XV.mjs +53 -0
- package/dist/sync/filesystem.d.ts +3 -3
- package/dist/sync/filesystem.mjs +27 -11
- package/dist/sync/indexeddb.browser.mjs +287 -0
- package/dist/sync/indexeddb.d.ts +3 -3
- package/dist/sync/indexeddb.mjs +7 -2
- package/dist/sync.browser.mjs +88 -72
- package/dist/sync.d.ts +4 -4
- package/dist/sync.mjs +89 -59
- package/dist/{chunk-I5B7RXU7.mjs → synonyms.browser.mjs} +248 -135
- package/dist/synonyms.mjs +15 -11
- package/dist/{tasks-CoNjxbop.d.ts → tasks-B4tT4vmP.d.ts} +4 -4
- package/dist/thread-SNILJXX3.mjs +30 -0
- package/dist/{types-DPMjfOr_.d.ts → types-CTg0KaMy.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +7 -1
- package/dist/vector/search-worker.mjs +9 -13
- package/dist/worker-copies-ZLZS2CUM.mjs +2152 -0
- package/dist/workers/entry.mjs +60 -30
- package/openapi.json +66 -50
- package/package.json +233 -8
- package/dist/analysis-change-CKEMM2MC.mjs +0 -55
- package/dist/analysis-change-entry-SEDMJ6MW.mjs +0 -1
- package/dist/archive-history-E4R73RWD.mjs +0 -29
- package/dist/browser/analysis-change-ZKGJFENM.mjs +0 -942
- package/dist/browser/analysis-change-entry-5BFUVMHJ.mjs +0 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +0 -29
- package/dist/browser/chunk-25MTVDYD.mjs +0 -432
- package/dist/browser/chunk-3I27KXQD.mjs +0 -34
- package/dist/browser/chunk-3NLMB5CC.mjs +0 -217
- package/dist/browser/chunk-4RD3AFSB.mjs +0 -32
- package/dist/browser/chunk-5W3MMTLG.mjs +0 -19
- package/dist/browser/chunk-5YWB3E2W.mjs +0 -92
- package/dist/browser/chunk-7IGKGWSQ.mjs +0 -79
- package/dist/browser/chunk-AI5UI46D.mjs +0 -12
- package/dist/browser/chunk-ATEBYXP6.mjs +0 -10
- package/dist/browser/chunk-BLT4RHCJ.mjs +0 -241
- package/dist/browser/chunk-C26SPCGQ.mjs +0 -2636
- package/dist/browser/chunk-C4FJ3WDY.mjs +0 -177
- package/dist/browser/chunk-CXNTHHA7.mjs +0 -63
- package/dist/browser/chunk-DSXIBE6N.mjs +0 -78
- package/dist/browser/chunk-DUH6QUVU.mjs +0 -2374
- package/dist/browser/chunk-ELV4OZOI.mjs +0 -29
- package/dist/browser/chunk-EXQZGUQH.mjs +0 -193
- package/dist/browser/chunk-G64Q6OJF.mjs +0 -96
- package/dist/browser/chunk-HOZW3PKP.mjs +0 -9
- package/dist/browser/chunk-HUCSHDTB.mjs +0 -100
- package/dist/browser/chunk-JPTQZWJQ.mjs +0 -10
- package/dist/browser/chunk-K3IPRX6D.mjs +0 -2559
- package/dist/browser/chunk-ML7THVLJ.mjs +0 -38
- package/dist/browser/chunk-MY2XKH22.mjs +0 -40
- package/dist/browser/chunk-NLWTBAGB.mjs +0 -111
- package/dist/browser/chunk-NXQG7DRA.mjs +0 -318
- package/dist/browser/chunk-OEDCEZXJ.mjs +0 -92
- package/dist/browser/chunk-OIZS5KIX.mjs +0 -6
- package/dist/browser/chunk-RA6LSBCM.mjs +0 -43
- package/dist/browser/chunk-TK63WFXK.mjs +0 -90
- package/dist/browser/chunk-TY7L6OXO.mjs +0 -69
- package/dist/browser/chunk-U3JOQGWX.mjs +0 -19
- package/dist/browser/chunk-U4YDIBUT.mjs +0 -653
- package/dist/browser/chunk-UATIJ4KU.mjs +0 -21
- package/dist/browser/chunk-UKOWD2K5.mjs +0 -315
- package/dist/browser/chunk-UTMHUHUV.mjs +0 -150
- package/dist/browser/chunk-V43N6TZO.mjs +0 -857
- package/dist/browser/chunk-VI7BQR4U.mjs +0 -21
- package/dist/browser/chunk-WN464PTL.mjs +0 -375
- package/dist/browser/chunk-WXLBZJMT.mjs +0 -25
- package/dist/browser/chunk-X7TXYUKO.mjs +0 -86
- package/dist/browser/chunk-XAWNZ4G2.mjs +0 -151
- package/dist/browser/chunk-Y6IBAUNO.mjs +0 -561
- package/dist/browser/chunk-ZI2V4VD7.mjs +0 -21
- package/dist/browser/cold-module-YNUUDNOM.mjs +0 -761
- package/dist/browser/engine-hooks-HBVS6YM4.mjs +0 -18
- package/dist/browser/gzip-5S7ROJFJ.mjs +0 -1
- package/dist/browser/import-5ESVMFDJ.mjs +0 -20
- package/dist/browser/methods-KTQCSIN4.mjs +0 -30
- package/dist/browser/module-NDSQLPMQ.mjs +0 -25
- package/dist/browser/operations-OJ3BXS55.mjs +0 -5
- package/dist/browser/phrase-module-HAT3TLZN.mjs +0 -328
- package/dist/browser/pool-3JLET5RO.mjs +0 -297
- package/dist/browser/release-HYXPVJVS.mjs +0 -32
- package/dist/browser/restore-queue-LQBBTODR.mjs +0 -55
- package/dist/browser/retention-TY3L3BFN.mjs +0 -211
- package/dist/browser/snapshot-5FHPPCNZ.mjs +0 -965
- package/dist/browser/start-2UZTOBG5.mjs +0 -26
- package/dist/browser/sync-state-P5XG6LTQ.mjs +0 -15
- package/dist/browser/write-ULXAN5B4.mjs +0 -196
- package/dist/chunk-2NE7VCYE.mjs +0 -212
- package/dist/chunk-2ROUFMQX.mjs +0 -543
- package/dist/chunk-37CD3OKS.mjs +0 -87
- package/dist/chunk-3MXV3VHR.mjs +0 -46
- package/dist/chunk-3OH67G7R.mjs +0 -214
- package/dist/chunk-4B7JIGQD.mjs +0 -106
- package/dist/chunk-5YNRKI2C.mjs +0 -81
- package/dist/chunk-6HTGOXIK.mjs +0 -875
- package/dist/chunk-6OEGXLBX.mjs +0 -57
- package/dist/chunk-6RC4K46J.mjs +0 -86
- package/dist/chunk-7GFE3PEY.mjs +0 -40
- package/dist/chunk-7GXJUJ24.mjs +0 -49
- package/dist/chunk-7V5IUP2T.mjs +0 -63
- package/dist/chunk-A4L7YTKX.mjs +0 -458
- package/dist/chunk-BEZH7VEH.mjs +0 -23
- package/dist/chunk-BNL5OPRV.mjs +0 -634
- package/dist/chunk-BTPGQC6Z.mjs +0 -27
- package/dist/chunk-C7XQYG6U.mjs +0 -50
- package/dist/chunk-CQZXZ75V.mjs +0 -562
- package/dist/chunk-CWS55TEX.mjs +0 -242
- package/dist/chunk-CZQ33DLW.mjs +0 -78
- package/dist/chunk-EEBCDP36.mjs +0 -32
- package/dist/chunk-FB6463IN.mjs +0 -1499
- package/dist/chunk-FCJ553HS.mjs +0 -655
- package/dist/chunk-FEZVDOWX.mjs +0 -6996
- package/dist/chunk-FOCV4CBZ.mjs +0 -87
- package/dist/chunk-FQBFZAWG.mjs +0 -27
- package/dist/chunk-G6HRSGOU.mjs +0 -74
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-GH4WQ22V.mjs +0 -34
- package/dist/chunk-GPWMUPCA.mjs +0 -1126
- package/dist/chunk-GQPTDQCL.mjs +0 -54
- package/dist/chunk-HJSN7UYG.mjs +0 -10
- package/dist/chunk-I54T6CQP.mjs +0 -117
- package/dist/chunk-IPN7S4KX.mjs +0 -130
- package/dist/chunk-J4IJTTEX.mjs +0 -226
- package/dist/chunk-JSV6OQ4C.mjs +0 -74
- package/dist/chunk-K4ZIGL2O.mjs +0 -290
- package/dist/chunk-KAKQ74LS.mjs +0 -53
- package/dist/chunk-KCQYFO4K.mjs +0 -62
- package/dist/chunk-KHKIRS5D.mjs +0 -113
- package/dist/chunk-KOKM4PQN.mjs +0 -52
- package/dist/chunk-KP7TYHWT.mjs +0 -92
- package/dist/chunk-KZ3NX2P7.mjs +0 -21
- package/dist/chunk-L5ORED7V.mjs +0 -25
- package/dist/chunk-LDNCLRZU.mjs +0 -218
- package/dist/chunk-LHKOSI2J.mjs +0 -58
- package/dist/chunk-LQG5G2LY.mjs +0 -39
- package/dist/chunk-MATMVH65.mjs +0 -9
- package/dist/chunk-MP7ABPTD.mjs +0 -189
- package/dist/chunk-MW6BR4QP.mjs +0 -316
- package/dist/chunk-MWD5VPN7.mjs +0 -21
- package/dist/chunk-ODYKO5TO.mjs +0 -101
- package/dist/chunk-OG7UGJ6F.mjs +0 -63
- package/dist/chunk-ORN5BLL7.mjs +0 -11
- package/dist/chunk-OYABFKTW.mjs +0 -1974
- package/dist/chunk-P5LANSH6.mjs +0 -121
- package/dist/chunk-PELHVTO7.mjs +0 -24
- package/dist/chunk-PIH5SJ4N.mjs +0 -7481
- package/dist/chunk-PSZI4O24.mjs +0 -253
- package/dist/chunk-PV2CG7EJ.mjs +0 -886
- package/dist/chunk-PWGYQXML.mjs +0 -470
- package/dist/chunk-Q2UL2TPC.mjs +0 -21
- package/dist/chunk-QHPYS427.mjs +0 -66
- package/dist/chunk-QJVOLKU6.mjs +0 -111
- package/dist/chunk-QLDABJZM.mjs +0 -20
- package/dist/chunk-QYRNLLLI.mjs +0 -99
- package/dist/chunk-RCX4WNLC.mjs +0 -151
- package/dist/chunk-RFBLQLLZ.mjs +0 -16
- package/dist/chunk-RIHIVFIQ.mjs +0 -240
- package/dist/chunk-RLOES5SX.mjs +0 -31
- package/dist/chunk-RWURUDSP.mjs +0 -2639
- package/dist/chunk-RZWWB2XR.mjs +0 -96
- package/dist/chunk-S5LN746F.mjs +0 -10
- package/dist/chunk-SOI6LTHM.mjs +0 -216
- package/dist/chunk-SQJWAIF4.mjs +0 -12
- package/dist/chunk-TDIK6NTV.mjs +0 -10
- package/dist/chunk-TQXHPFWT.mjs +0 -177
- package/dist/chunk-U55XJEIG.mjs +0 -18
- package/dist/chunk-UD5HIS4U.mjs +0 -382
- package/dist/chunk-UHICS3JI.mjs +0 -83
- package/dist/chunk-UJDJB3NE.mjs +0 -913
- package/dist/chunk-VD7J552I.mjs +0 -28
- package/dist/chunk-VSLSGASN.mjs +0 -30
- package/dist/chunk-VZ2ONHEE.mjs +0 -3715
- package/dist/chunk-W7OSSKH5.mjs +0 -1427
- package/dist/chunk-WZ7YV54N.mjs +0 -152
- package/dist/chunk-X5CV2E2B.mjs +0 -1
- package/dist/chunk-Y4WPNHMC.mjs +0 -50
- package/dist/chunk-YEKL4JBK.mjs +0 -96
- package/dist/chunk-ZXNQEW43.mjs +0 -18
- package/dist/chunk-ZYAY26KG.mjs +0 -29
- package/dist/direct-executor-V5DRIECI.mjs +0 -34
- package/dist/durability-wiring-3TD62MBI.mjs +0 -4072
- package/dist/engine-hooks-HA3SBOBR.mjs +0 -54
- package/dist/gzip-F4HMIEEQ.mjs +0 -1
- package/dist/import-GPKLTSKA.mjs +0 -56
- package/dist/methods-7IOINERF.mjs +0 -30
- package/dist/module-JYHFTVPS.mjs +0 -63
- package/dist/operations-G5EP6JPX.mjs +0 -5
- package/dist/phrase-module-XW5MKWP5.mjs +0 -330
- package/dist/pool-Y4A46T36.mjs +0 -298
- package/dist/react-native/chunks/analysis-change-QUVDNABS.mjs +0 -934
- package/dist/react-native/chunks/analysis-change-entry-OC4XASBF.mjs +0 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +0 -29
- package/dist/react-native/chunks/chunk-2PRHILX3.mjs +0 -529
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +0 -1
- package/dist/react-native/chunks/chunk-3WI35N75.mjs +0 -226
- package/dist/react-native/chunks/chunk-4DII3ZSM.mjs +0 -73
- package/dist/react-native/chunks/chunk-4J74WHQM.mjs +0 -177
- package/dist/react-native/chunks/chunk-4NWR3NGS.mjs +0 -151
- package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +0 -17
- package/dist/react-native/chunks/chunk-5MSX5FRT.mjs +0 -858
- package/dist/react-native/chunks/chunk-6OFDUYVX.mjs +0 -92
- package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +0 -9
- package/dist/react-native/chunks/chunk-6ZELFCK5.mjs +0 -315
- package/dist/react-native/chunks/chunk-AAAETEJK.mjs +0 -27
- package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +0 -32
- package/dist/react-native/chunks/chunk-BITYFZSZ.mjs +0 -242
- package/dist/react-native/chunks/chunk-C5G6TJ7A.mjs +0 -140
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +0 -43
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +0 -10
- package/dist/react-native/chunks/chunk-DMIFXZ3Q.mjs +0 -432
- package/dist/react-native/chunks/chunk-DVDX4SDR.mjs +0 -375
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +0 -12
- package/dist/react-native/chunks/chunk-F753DA54.mjs +0 -23
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +0 -40
- package/dist/react-native/chunks/chunk-FTZHMRD2.mjs +0 -18
- package/dist/react-native/chunks/chunk-HJBJBH26.mjs +0 -34
- package/dist/react-native/chunks/chunk-IAENKE2D.mjs +0 -21
- package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +0 -10
- package/dist/react-native/chunks/chunk-IYNT75CE.mjs +0 -111
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +0 -38
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +0 -15
- package/dist/react-native/chunks/chunk-KSBYEMCB.mjs +0 -100
- package/dist/react-native/chunks/chunk-KU646XXT.mjs +0 -164
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +0 -68
- package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +0 -93
- package/dist/react-native/chunks/chunk-LZSLNSUN.mjs +0 -193
- package/dist/react-native/chunks/chunk-MJDQU5MW.mjs +0 -1225
- package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +0 -8
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +0 -78
- package/dist/react-native/chunks/chunk-OCSLSH27.mjs +0 -22723
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +0 -29
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +0 -79
- package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +0 -9
- package/dist/react-native/chunks/chunk-RDWG33MM.mjs +0 -79
- package/dist/react-native/chunks/chunk-SK2PWYDH.mjs +0 -654
- package/dist/react-native/chunks/chunk-SUPXRTMD.mjs +0 -96
- package/dist/react-native/chunks/chunk-TORU2OHQ.mjs +0 -218
- package/dist/react-native/chunks/chunk-U4KSKA4Z.mjs +0 -23
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +0 -68
- package/dist/react-native/chunks/chunk-WBYQRHDY.mjs +0 -86
- package/dist/react-native/chunks/chunk-WVWJNUMN.mjs +0 -2562
- package/dist/react-native/chunks/chunk-YH7QY657.mjs +0 -288
- package/dist/react-native/chunks/chunk-YZW4CHM6.mjs +0 -562
- package/dist/react-native/chunks/chunk-ZNZ6CPAZ.mjs +0 -562
- package/dist/react-native/chunks/chunk-ZVQMBF2H.mjs +0 -63
- package/dist/react-native/chunks/chunk-ZWAIN4GG.mjs +0 -2636
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +0 -92
- package/dist/react-native/chunks/cold-module-N6KFNNZA.mjs +0 -773
- package/dist/react-native/chunks/durability-wiring-RN64S2TL.mjs +0 -4984
- package/dist/react-native/chunks/engine-hooks-CWA5CKCA.mjs +0 -30
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +0 -3
- package/dist/react-native/chunks/import-5UAWBRJP.mjs +0 -32
- package/dist/react-native/chunks/methods-6W5U4C3H.mjs +0 -30
- package/dist/react-native/chunks/module-6RP4ZCBW.mjs +0 -37
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +0 -5
- package/dist/react-native/chunks/phrase-module-QK22HSQ2.mjs +0 -329
- package/dist/react-native/chunks/pool-JR3NJCAF.mjs +0 -297
- package/dist/react-native/chunks/release-2SIHZWDO.mjs +0 -32
- package/dist/react-native/chunks/restore-hooks-ENFMDTWC.mjs +0 -127
- package/dist/react-native/chunks/restore-queue-4R6AASE5.mjs +0 -55
- package/dist/react-native/chunks/retention-5GTFT3GR.mjs +0 -223
- package/dist/react-native/chunks/snapshot-5LGPQXFS.mjs +0 -976
- package/dist/react-native/chunks/start-ZQJVZ5DN.mjs +0 -38
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +0 -15
- package/dist/react-native/chunks/write-6BRYIIZ7.mjs +0 -208
- package/dist/release-SMR4WJD4.mjs +0 -32
- package/dist/restore-hooks-HXLIEB4A.mjs +0 -153
- package/dist/restore-queue-LZH7LMLR.mjs +0 -55
- package/dist/retention-3K7ARGAG.mjs +0 -66
- package/dist/runtime-COIUORCN.mjs +0 -177
- package/dist/snapshot-O7ICP7NJ.mjs +0 -783
- package/dist/start-S4PFP6RS.mjs +0 -66
- package/dist/sync-state-ZWHLAFLE.mjs +0 -15
- package/dist/thread-YLJ3ZPQ3.mjs +0 -50
- package/dist/write-2OBJGLFS.mjs +0 -233
- /package/dist/browser/{chunk-M3MQE2X7.mjs → digest-leaf-64IPRPZD.mjs} +0 -0
- /package/dist/browser/{chunk-JNOAKDUM.mjs → gzip-JF3S6PPT.mjs} +0 -0
- /package/dist/{chunk-ZXNNR73R.mjs → gzip-2UCZW2MM.mjs} +0 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { createSurfaceRegistry, SegmentRefusal, encodeSurfaceTable, encodePartialSpellingsOf, encodeStringBlob, mergeTextAt, generateId, encodeExternalIdTableData, buildPartialWordTableFrom, wrapFrozenTokenTable, encodeDocumentTableData, topLevelMapKeys, mergeStoredFields, prepareDocumentText, recordValueSize, patternIndexOf, encodeFieldIndexes, mergeFieldRegions, sameFields, partialSpellingsOfDocuments, storedDocumentsOf, encodeFrozenTokenTableData, mergeKeywordSources, GrowingSegment, LivePostings, createSpellingTable, createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex } from './chunk-L4R5ITVG.mjs';
|
|
2
|
+
import { storedText, bitsetIterator } from './chunk-4EXKQ2IB.mjs';
|
|
3
|
+
import { encodeDocument } from './chunk-YOTP2FPE.mjs';
|
|
4
|
+
import { schemaFieldsOf, getNestedValue, isWordIndexedBase, validateDocument, validateDocumentStrict } from './chunk-FTQ7JNMU.mjs';
|
|
5
|
+
import { NarsilError, ErrorCodes } from './chunk-TQ26BKBH.mjs';
|
|
6
|
+
|
|
7
|
+
// src/engine/orchestration/eligibility.ts
|
|
8
|
+
function toError(value) {
|
|
9
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
10
|
+
}
|
|
11
|
+
function isDeterministicFailure(error) {
|
|
12
|
+
return error instanceof NarsilError && error.code === ErrorCodes.CONFIG_INVALID;
|
|
13
|
+
}
|
|
14
|
+
function alreadyPresentOnWorker(reason) {
|
|
15
|
+
return reason instanceof NarsilError && reason.code === ErrorCodes.DOC_ALREADY_EXISTS;
|
|
16
|
+
}
|
|
17
|
+
function assertConfigReachesWorker(indexName, config, bootstrapModule) {
|
|
18
|
+
if (config.tokenizer !== void 0 && typeof config.tokenizer !== "string") {
|
|
19
|
+
throw new NarsilError(
|
|
20
|
+
ErrorCodes.CONFIG_INVALID,
|
|
21
|
+
`Index "${indexName}" holds a tokenizer instance, and no worker thread can receive one. Register the tokenizer with registerTokenizer and name it in the index config`,
|
|
22
|
+
{ indexName }
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if (typeof config.stopWords === "function") {
|
|
26
|
+
throw new NarsilError(
|
|
27
|
+
ErrorCodes.CONFIG_INVALID,
|
|
28
|
+
`Index "${indexName}" holds a stop word function, and no worker thread can receive one. Register the function with registerStopWords and name it in the index config`,
|
|
29
|
+
{ indexName }
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (bootstrapModule !== void 0) return;
|
|
33
|
+
const language = config.language ?? "english";
|
|
34
|
+
const requireRegistered = (setting, name) => {
|
|
35
|
+
throw new NarsilError(
|
|
36
|
+
ErrorCodes.CONFIG_INVALID,
|
|
37
|
+
`Index "${indexName}" uses ${setting} "${name}", which a worker thread registers only from a bootstrap module. Set workers.bootstrapModule to a module that registers it`,
|
|
38
|
+
{ indexName, [setting]: name }
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
if (language !== "english") requireRegistered("language", language);
|
|
42
|
+
if (typeof config.tokenizer === "string") requireRegistered("tokenizer", config.tokenizer);
|
|
43
|
+
if (typeof config.stopWords === "string") requireRegistered("stopWords", config.stopWords);
|
|
44
|
+
}
|
|
45
|
+
function workerIneligibility(indexName, config, bootstrapModule) {
|
|
46
|
+
try {
|
|
47
|
+
assertConfigReachesWorker(indexName, config, bootstrapModule);
|
|
48
|
+
return null;
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (err instanceof NarsilError && err.code === ErrorCodes.CONFIG_INVALID) {
|
|
51
|
+
return err;
|
|
52
|
+
}
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function reportIneligible(state, indexName, error) {
|
|
57
|
+
if (state.reportedIneligible.has(indexName)) return;
|
|
58
|
+
state.reportedIneligible.add(indexName);
|
|
59
|
+
state.callbacks?.onCopyLoadFailure?.("index-excluded", error, false);
|
|
60
|
+
}
|
|
61
|
+
function eligibleIndexNames(state) {
|
|
62
|
+
const names = [];
|
|
63
|
+
for (const [name, entry] of state.indexRegistry) {
|
|
64
|
+
const ineligibility = workerIneligibility(name, entry.config, state.bootstrapModule);
|
|
65
|
+
if (ineligibility) {
|
|
66
|
+
reportIneligible(state, name, ineligibility);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
names.push(name);
|
|
70
|
+
}
|
|
71
|
+
return names;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/workers/protocol.ts
|
|
75
|
+
var nextRequestSequence = 0;
|
|
76
|
+
function createRequestId() {
|
|
77
|
+
nextRequestSequence += 1;
|
|
78
|
+
return String(nextRequestSequence);
|
|
79
|
+
}
|
|
80
|
+
function isValidWorkerResponse(msg) {
|
|
81
|
+
if (msg === null || msg === void 0 || typeof msg !== "object") {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const candidate = msg;
|
|
85
|
+
if (typeof candidate.requestId !== "string") {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (candidate.type !== "success" && candidate.type !== "error") {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/core/segment-merges/host.ts
|
|
95
|
+
function mergeSourceSurfaces(input, analysis) {
|
|
96
|
+
const registry = createSurfaceRegistry();
|
|
97
|
+
input.segment.surfaces.addKeptForms(registry, input.remap, analysis);
|
|
98
|
+
const forms = registry.serialize();
|
|
99
|
+
for (const value of Object.values(forms)) {
|
|
100
|
+
if (Array.isArray(value) && value[0] > 4294967295) throw new SegmentRefusal(8);
|
|
101
|
+
}
|
|
102
|
+
const table = encodeSurfaceTable(forms);
|
|
103
|
+
return { text: table.blob, offsets: table.offsets, counts: table.counts };
|
|
104
|
+
}
|
|
105
|
+
function mergeSourceSpellings(input, analysis) {
|
|
106
|
+
if (analysis === null || analysis.fields.length === 0) return null;
|
|
107
|
+
const counts = /* @__PURE__ */ new Map();
|
|
108
|
+
input.segment.partialWords.countKeptSpellings(counts, analysis, input.remap);
|
|
109
|
+
const values = encodePartialSpellingsOf(analysis.fields, counts);
|
|
110
|
+
const pairs = [];
|
|
111
|
+
for (let at = 0; at < values.counts.length; at++) {
|
|
112
|
+
if (values.counts[at] > 4294967295) throw new SegmentRefusal(8);
|
|
113
|
+
pairs.push(values.spellings[at], values.tokens[at]);
|
|
114
|
+
}
|
|
115
|
+
const table = encodeStringBlob(pairs);
|
|
116
|
+
return { text: table.blob, offsets: table.offsets, counts: Uint32Array.from(values.counts) };
|
|
117
|
+
}
|
|
118
|
+
function source(input, analysis, textAnalysis) {
|
|
119
|
+
const arrays = input.segment.arrays;
|
|
120
|
+
const terms = arrays.tokenTable.data;
|
|
121
|
+
return {
|
|
122
|
+
terms: { text: terms.blob, offsets: terms.offsets, counts: terms.documentFrequencies },
|
|
123
|
+
payloadSlots: terms.payloadSlots,
|
|
124
|
+
postingOffsets: arrays.postingOffsets,
|
|
125
|
+
postingDocuments: arrays.postingDocIds,
|
|
126
|
+
postingFrequencies: arrays.postingFrequencies,
|
|
127
|
+
postingFields: arrays.postingFieldIndices,
|
|
128
|
+
positionOffsets: arrays.positionOffsets,
|
|
129
|
+
positionValues: arrays.positionValues,
|
|
130
|
+
mapping: new Uint32Array(input.remap.buffer, input.remap.byteOffset, input.remap.length),
|
|
131
|
+
fieldMapping: input.fieldIndexRemap,
|
|
132
|
+
fieldLengths: arrays.fieldNames.map((field) => {
|
|
133
|
+
const at = arrays.fieldLengthNames.indexOf(field);
|
|
134
|
+
return at < 0 ? null : arrays.fieldLengthColumns[at];
|
|
135
|
+
}),
|
|
136
|
+
documentCount: arrays.documentCount,
|
|
137
|
+
surfaces: mergeSourceSurfaces(input, textAnalysis),
|
|
138
|
+
spellings: mergeSourceSpellings(input, analysis)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function mergedPartialSpellings(table, analysis) {
|
|
142
|
+
if (analysis === null || analysis.fields.length === 0) return null;
|
|
143
|
+
const values = { fields: [...analysis.fields], tokens: [], spellings: [], counts: [] };
|
|
144
|
+
for (let at = 0; at < table.counts.length; at++) {
|
|
145
|
+
values.spellings.push(mergeTextAt(table, at * 2));
|
|
146
|
+
values.tokens.push(mergeTextAt(table, at * 2 + 1));
|
|
147
|
+
values.counts.push(table.counts[at]);
|
|
148
|
+
}
|
|
149
|
+
return values;
|
|
150
|
+
}
|
|
151
|
+
function mergeKeywordColumns(inputs, documentCount, fieldNames, analysis, textAnalysis) {
|
|
152
|
+
const sources = inputs.map((input) => source(input, analysis, textAnalysis));
|
|
153
|
+
const output = mergeKeywordSources(sources, documentCount, fieldNames.length);
|
|
154
|
+
const termCount = output.terms.counts.length;
|
|
155
|
+
const payloadSlots = new Uint32Array(termCount);
|
|
156
|
+
for (let at = 0; at < termCount; at++) payloadSlots[at] = at;
|
|
157
|
+
const fieldLengthNames = [];
|
|
158
|
+
const fieldLengthColumns = [];
|
|
159
|
+
const totalFieldLengths = /* @__PURE__ */ Object.create(null);
|
|
160
|
+
for (const input of inputs) {
|
|
161
|
+
for (const name of input.segment.arrays.fieldLengthNames) {
|
|
162
|
+
if (fieldLengthNames.includes(name)) continue;
|
|
163
|
+
const field = fieldNames.indexOf(name);
|
|
164
|
+
fieldLengthNames.push(name);
|
|
165
|
+
fieldLengthColumns.push(output.fieldLengths.subarray(field * documentCount, (field + 1) * documentCount));
|
|
166
|
+
totalFieldLengths[name] = output.totalFieldLengths[field];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
tokenTable: {
|
|
171
|
+
blob: output.terms.text,
|
|
172
|
+
offsets: output.terms.offsets,
|
|
173
|
+
payloadSlots,
|
|
174
|
+
documentFrequencies: output.terms.counts
|
|
175
|
+
},
|
|
176
|
+
fieldLengthNames,
|
|
177
|
+
fieldLengthColumns,
|
|
178
|
+
totalFieldLengths,
|
|
179
|
+
postingOffsets: output.postingOffsets,
|
|
180
|
+
postingDocIds: output.postingDocuments,
|
|
181
|
+
postingFrequencies: output.postingFrequencies,
|
|
182
|
+
postingFieldIndices: output.postingFields,
|
|
183
|
+
positionOffsets: output.positionOffsets,
|
|
184
|
+
positionValues: output.positionValues,
|
|
185
|
+
surfaceTable: output.surfaces.counts.length === 0 ? null : { blob: output.surfaces.text, offsets: output.surfaces.offsets, counts: output.surfaces.counts },
|
|
186
|
+
partialSpellings: mergedPartialSpellings(output.spellings, analysis)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/core/partition/frozen/merge-fields.ts
|
|
191
|
+
function fieldsOf(inputs, kind) {
|
|
192
|
+
const fields = /* @__PURE__ */ new Set();
|
|
193
|
+
for (const input of inputs) for (const entry of input.segment.arrays[kind]) fields.add(entry.fieldPath);
|
|
194
|
+
return [...fields];
|
|
195
|
+
}
|
|
196
|
+
function sourceOf(input, regions) {
|
|
197
|
+
return {
|
|
198
|
+
mapping: new Uint32Array(input.remap.buffer, input.remap.byteOffset, input.remap.length),
|
|
199
|
+
regions
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function numeric(inputs, count, kind) {
|
|
203
|
+
return fieldsOf(inputs, kind).map((fieldPath) => {
|
|
204
|
+
const sources = inputs.map((input) => {
|
|
205
|
+
const regions = (kind === "numeric" ? input.segment.numericIndexes : input.segment.sizeIndexes).get(fieldPath)?.regions();
|
|
206
|
+
return sourceOf(input, [regions?.values ?? new Float64Array(0), regions?.ordinals ?? new Uint32Array(0)]);
|
|
207
|
+
});
|
|
208
|
+
const output = mergeFieldRegions(1, sources, count);
|
|
209
|
+
return { fieldPath, values: output[0], docIds: output[1] };
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function boolean(inputs, count) {
|
|
213
|
+
return fieldsOf(inputs, "boolean").map((fieldPath) => {
|
|
214
|
+
const sources = inputs.map((input) => {
|
|
215
|
+
const regions = input.segment.booleanIndexes.get(fieldPath)?.regions(input.remap.length);
|
|
216
|
+
const words = Math.max(1, Math.ceil(input.remap.length / 32));
|
|
217
|
+
return sourceOf(input, [
|
|
218
|
+
regions?.trueBits ?? new Uint32Array(words),
|
|
219
|
+
regions?.falseBits ?? new Uint32Array(words)
|
|
220
|
+
]);
|
|
221
|
+
});
|
|
222
|
+
const output = mergeFieldRegions(2, sources, count);
|
|
223
|
+
return {
|
|
224
|
+
fieldPath,
|
|
225
|
+
trueDocs: Uint32Array.from(bitsetIterator(output[0])),
|
|
226
|
+
falseDocs: Uint32Array.from(bitsetIterator(output[1]))
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function enums(inputs, count) {
|
|
231
|
+
return fieldsOf(inputs, "enums").map((fieldPath) => {
|
|
232
|
+
const sources = inputs.map((input) => {
|
|
233
|
+
const regions = input.segment.enumIndexes.get(fieldPath)?.regions();
|
|
234
|
+
return sourceOf(input, [
|
|
235
|
+
regions?.units ?? new Uint16Array(0),
|
|
236
|
+
regions?.offsets ?? new Uint32Array(1),
|
|
237
|
+
regions?.postingOffsets ?? new Uint32Array(1),
|
|
238
|
+
regions?.postings ?? new Uint32Array(0),
|
|
239
|
+
regions?.suffixOrder ?? new Uint32Array(0)
|
|
240
|
+
]);
|
|
241
|
+
});
|
|
242
|
+
const output = mergeFieldRegions(3, sources, count);
|
|
243
|
+
const units = output[0];
|
|
244
|
+
const offsets = output[1];
|
|
245
|
+
const values = [];
|
|
246
|
+
for (let at = 0; at < offsets.length - 1; at++)
|
|
247
|
+
values.push(storedText(units, offsets[at], offsets[at + 1] - offsets[at]));
|
|
248
|
+
return { fieldPath, values, offsets: output[2], docIds: output[3] };
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function geo(inputs, count) {
|
|
252
|
+
return fieldsOf(inputs, "geo").map((fieldPath) => {
|
|
253
|
+
const sources = inputs.map((input) => {
|
|
254
|
+
const regions = input.segment.geoIndexes.get(fieldPath)?.regions();
|
|
255
|
+
return sourceOf(input, [
|
|
256
|
+
regions?.codes ?? new BigUint64Array(0),
|
|
257
|
+
regions?.lat ?? new Float64Array(0),
|
|
258
|
+
regions?.lon ?? new Float64Array(0),
|
|
259
|
+
regions?.ordinals ?? new Uint32Array(0)
|
|
260
|
+
]);
|
|
261
|
+
});
|
|
262
|
+
const output = mergeFieldRegions(4, sources, count);
|
|
263
|
+
return {
|
|
264
|
+
fieldPath,
|
|
265
|
+
latitudes: output[1],
|
|
266
|
+
longitudes: output[2],
|
|
267
|
+
docIds: output[3]
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function pattern(inputs, count) {
|
|
272
|
+
return fieldsOf(inputs, "pattern").map((fieldPath) => {
|
|
273
|
+
const sources = inputs.map((input) => {
|
|
274
|
+
const regions = input.segment.arrays.pattern.find((entry) => entry.fieldPath === fieldPath);
|
|
275
|
+
return sourceOf(input, [
|
|
276
|
+
regions?.docIds ?? new Uint32Array(0),
|
|
277
|
+
regions?.runs ?? new Uint32Array(0),
|
|
278
|
+
regions?.offsets ?? new Uint32Array(1),
|
|
279
|
+
regions?.postings ?? new Uint32Array(0)
|
|
280
|
+
]);
|
|
281
|
+
});
|
|
282
|
+
const output = mergeFieldRegions(6, sources, count);
|
|
283
|
+
return {
|
|
284
|
+
fieldPath,
|
|
285
|
+
docIds: output[0],
|
|
286
|
+
runs: output[1],
|
|
287
|
+
offsets: output[2],
|
|
288
|
+
postings: output[3]
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function mergeFieldIndexes(inputs, documentCount) {
|
|
293
|
+
return {
|
|
294
|
+
numeric: numeric(inputs, documentCount, "numeric"),
|
|
295
|
+
boolean: boolean(inputs, documentCount),
|
|
296
|
+
enums: enums(inputs, documentCount),
|
|
297
|
+
geo: geo(inputs, documentCount),
|
|
298
|
+
pattern: pattern(inputs, documentCount),
|
|
299
|
+
sizes: numeric(inputs, documentCount, "sizes")
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/core/partition/frozen/shared-snapshot.ts
|
|
304
|
+
function encodedPayloadOf(payload) {
|
|
305
|
+
const { tokens, docFrequencies, surfaceForms, ...columns } = payload;
|
|
306
|
+
return {
|
|
307
|
+
...columns,
|
|
308
|
+
tokenTable: encodeFrozenTokenTableData(tokens, docFrequencies),
|
|
309
|
+
surfaceTable: surfaceForms === null ? null : encodeSurfaceTable(surfaceForms)
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function sharedUint32(source2) {
|
|
313
|
+
const copy = new Uint32Array(new SharedArrayBuffer(source2.length * 4));
|
|
314
|
+
copy.set(source2);
|
|
315
|
+
return copy;
|
|
316
|
+
}
|
|
317
|
+
function sharedUint16(source2) {
|
|
318
|
+
const copy = new Uint16Array(new SharedArrayBuffer(source2.length * 2));
|
|
319
|
+
copy.set(source2);
|
|
320
|
+
return copy;
|
|
321
|
+
}
|
|
322
|
+
function sharedUint8(source2) {
|
|
323
|
+
const copy = new Uint8Array(new SharedArrayBuffer(source2.length));
|
|
324
|
+
copy.set(source2);
|
|
325
|
+
return copy;
|
|
326
|
+
}
|
|
327
|
+
function sharedFloat64(source2) {
|
|
328
|
+
const copy = new Float64Array(new SharedArrayBuffer(source2.length * 8));
|
|
329
|
+
copy.set(source2);
|
|
330
|
+
return copy;
|
|
331
|
+
}
|
|
332
|
+
function sharedSurfaceTable(table) {
|
|
333
|
+
if (table === null || table.counts.length === 0) return null;
|
|
334
|
+
return { blob: sharedUint8(table.blob), offsets: sharedUint32(table.offsets), counts: sharedUint32(table.counts) };
|
|
335
|
+
}
|
|
336
|
+
function sharePartialWordTable(table) {
|
|
337
|
+
if (typeof SharedArrayBuffer !== "function" || table.runEntries.buffer instanceof SharedArrayBuffer) return table;
|
|
338
|
+
return {
|
|
339
|
+
fields: [...table.fields],
|
|
340
|
+
spellings: sharedUint8(table.spellings),
|
|
341
|
+
spellingOffsets: sharedUint32(table.spellingOffsets),
|
|
342
|
+
spellingTokens: sharedUint32(table.spellingTokens),
|
|
343
|
+
spellingCounts: sharedUint32(table.spellingCounts),
|
|
344
|
+
runs: sharedUint32(table.runs),
|
|
345
|
+
runOffsets: sharedUint32(table.runOffsets),
|
|
346
|
+
runEntries: sharedUint32(table.runEntries)
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function sharedPartialWordsOf(tokenData, spellings, documentData, analysis) {
|
|
350
|
+
let source2 = spellings;
|
|
351
|
+
if (source2 === null && analysis !== null && analysis.fields.length > 0) {
|
|
352
|
+
source2 = partialSpellingsOfDocuments(storedDocumentsOf(documentData), analysis);
|
|
353
|
+
}
|
|
354
|
+
if (source2 === null || source2.fields.length === 0) return null;
|
|
355
|
+
const table = buildPartialWordTableFrom(source2, wrapFrozenTokenTable(tokenData));
|
|
356
|
+
return table === null ? null : sharePartialWordTable(table);
|
|
357
|
+
}
|
|
358
|
+
function partialWordsMatch(table, analysis) {
|
|
359
|
+
if (table === null) return analysis === null || analysis.fields.length === 0;
|
|
360
|
+
return analysis === null || sameFields(table.fields, analysis.fields);
|
|
361
|
+
}
|
|
362
|
+
function shareSegmentArrays(arrays, analysis, segmentId) {
|
|
363
|
+
const partialWords = partialWordsMatch(arrays.partialWords, analysis) ? arrays.partialWords : sharedPartialWordsOf(arrays.tokenTable, null, arrays.documentTable, analysis);
|
|
364
|
+
return { ...arrays, segmentId: segmentId ?? generateId(), partialWords };
|
|
365
|
+
}
|
|
366
|
+
function segmentArraysOf(payload, documentData, reusedPartialWords = null) {
|
|
367
|
+
const { tokenTable, surfaceTable } = payload;
|
|
368
|
+
const idTable = encodeExternalIdTableData(payload.docIds);
|
|
369
|
+
const partialWords = reusedPartialWords ?? (payload.partialSpellings === null ? null : buildPartialWordTableFrom(payload.partialSpellings, wrapFrozenTokenTable(tokenTable)));
|
|
370
|
+
return {
|
|
371
|
+
documentCount: payload.documentCount,
|
|
372
|
+
fieldNames: payload.fieldNames,
|
|
373
|
+
fieldLengthNames: payload.fieldLengthNames,
|
|
374
|
+
fieldLengthColumns: payload.fieldLengthColumns,
|
|
375
|
+
totalFieldLengths: payload.totalFieldLengths,
|
|
376
|
+
tokenTable,
|
|
377
|
+
idTable,
|
|
378
|
+
documentTable: documentData,
|
|
379
|
+
postingOffsets: payload.postingOffsets,
|
|
380
|
+
postingDocIds: payload.postingDocIds,
|
|
381
|
+
postingFrequencies: payload.postingFrequencies,
|
|
382
|
+
postingFieldIndices: payload.postingFieldIndices,
|
|
383
|
+
positionOffsets: payload.positionOffsets,
|
|
384
|
+
positionValues: payload.positionValues,
|
|
385
|
+
numeric: payload.numeric,
|
|
386
|
+
sizes: payload.sizes,
|
|
387
|
+
boolean: payload.boolean,
|
|
388
|
+
enums: payload.enums,
|
|
389
|
+
geo: payload.geo,
|
|
390
|
+
pattern: payload.pattern,
|
|
391
|
+
storedFields: payload.storedFields,
|
|
392
|
+
surfaceTable: surfaceTable === null || surfaceTable.counts.length === 0 ? null : surfaceTable,
|
|
393
|
+
partialWords
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function freezeSegmentShared(payload, documents, segmentId, analysis = null) {
|
|
397
|
+
if (typeof SharedArrayBuffer !== "function") return null;
|
|
398
|
+
return freezeEncodedSegmentShared(encodedPayloadOf(payload), encodeDocumentTableData(documents), segmentId, analysis);
|
|
399
|
+
}
|
|
400
|
+
function freezeEncodedSegmentShared(payload, documentData, segmentId, analysis = null, reusedPartialWords = null) {
|
|
401
|
+
if (typeof SharedArrayBuffer !== "function") return null;
|
|
402
|
+
const tokenData = payload.tokenTable;
|
|
403
|
+
const idData = encodeExternalIdTableData(payload.docIds);
|
|
404
|
+
return {
|
|
405
|
+
segmentId: segmentId ?? generateId(),
|
|
406
|
+
documentCount: payload.documentCount,
|
|
407
|
+
fieldNames: [...payload.fieldNames],
|
|
408
|
+
fieldLengthNames: [...payload.fieldLengthNames],
|
|
409
|
+
fieldLengthColumns: payload.fieldLengthColumns.map(sharedUint32),
|
|
410
|
+
totalFieldLengths: { ...payload.totalFieldLengths },
|
|
411
|
+
tokenTable: {
|
|
412
|
+
blob: sharedUint8(tokenData.blob),
|
|
413
|
+
offsets: sharedUint32(tokenData.offsets),
|
|
414
|
+
payloadSlots: sharedUint32(tokenData.payloadSlots),
|
|
415
|
+
documentFrequencies: sharedUint32(tokenData.documentFrequencies)
|
|
416
|
+
},
|
|
417
|
+
idTable: {
|
|
418
|
+
blob: sharedUint8(idData.blob),
|
|
419
|
+
offsets: sharedUint32(idData.offsets),
|
|
420
|
+
sortedOrdinals: sharedUint32(idData.sortedOrdinals)
|
|
421
|
+
},
|
|
422
|
+
documentTable: {
|
|
423
|
+
blob: sharedUint8(documentData.blob),
|
|
424
|
+
offsets: sharedUint32(documentData.offsets),
|
|
425
|
+
...documentData.discardedFields === void 0 ? {} : { discardedFields: documentData.discardedFields }
|
|
426
|
+
},
|
|
427
|
+
postingOffsets: sharedUint32(payload.postingOffsets),
|
|
428
|
+
postingDocIds: sharedUint32(payload.postingDocIds),
|
|
429
|
+
postingFrequencies: sharedUint16(payload.postingFrequencies),
|
|
430
|
+
postingFieldIndices: sharedUint16(payload.postingFieldIndices),
|
|
431
|
+
positionOffsets: payload.positionOffsets === null ? null : sharedUint32(payload.positionOffsets),
|
|
432
|
+
positionValues: payload.positionValues === null ? null : sharedUint32(payload.positionValues),
|
|
433
|
+
numeric: payload.numeric.map((entry) => ({
|
|
434
|
+
fieldPath: entry.fieldPath,
|
|
435
|
+
docIds: sharedUint32(entry.docIds),
|
|
436
|
+
values: sharedFloat64(entry.values)
|
|
437
|
+
})),
|
|
438
|
+
sizes: payload.sizes.map((entry) => ({
|
|
439
|
+
fieldPath: entry.fieldPath,
|
|
440
|
+
docIds: sharedUint32(entry.docIds),
|
|
441
|
+
values: sharedFloat64(entry.values)
|
|
442
|
+
})),
|
|
443
|
+
boolean: payload.boolean.map((entry) => ({
|
|
444
|
+
fieldPath: entry.fieldPath,
|
|
445
|
+
trueDocs: sharedUint32(entry.trueDocs),
|
|
446
|
+
falseDocs: sharedUint32(entry.falseDocs)
|
|
447
|
+
})),
|
|
448
|
+
enums: payload.enums.map((entry) => ({
|
|
449
|
+
fieldPath: entry.fieldPath,
|
|
450
|
+
values: [...entry.values],
|
|
451
|
+
offsets: sharedUint32(entry.offsets),
|
|
452
|
+
docIds: sharedUint32(entry.docIds)
|
|
453
|
+
})),
|
|
454
|
+
geo: payload.geo.map((entry) => ({
|
|
455
|
+
fieldPath: entry.fieldPath,
|
|
456
|
+
docIds: sharedUint32(entry.docIds),
|
|
457
|
+
latitudes: sharedFloat64(entry.latitudes),
|
|
458
|
+
longitudes: sharedFloat64(entry.longitudes)
|
|
459
|
+
})),
|
|
460
|
+
pattern: payload.pattern.map((entry) => ({
|
|
461
|
+
fieldPath: entry.fieldPath,
|
|
462
|
+
docIds: sharedUint32(entry.docIds),
|
|
463
|
+
runs: sharedUint32(entry.runs),
|
|
464
|
+
offsets: sharedUint32(entry.offsets),
|
|
465
|
+
postings: sharedUint32(entry.postings)
|
|
466
|
+
})),
|
|
467
|
+
storedFields: payload.storedFields?.map(({ field, values }) => ({
|
|
468
|
+
field,
|
|
469
|
+
values: {
|
|
470
|
+
shapes: sharedUint8(values.shapes),
|
|
471
|
+
starts: sharedUint32(values.starts),
|
|
472
|
+
kinds: sharedUint8(values.kinds),
|
|
473
|
+
numbers: sharedFloat64(values.numbers),
|
|
474
|
+
textStart: sharedUint32(values.textStart),
|
|
475
|
+
textLength: sharedUint32(values.textLength),
|
|
476
|
+
units: sharedUint16(values.units),
|
|
477
|
+
bytes: sharedUint8(values.bytes)
|
|
478
|
+
}
|
|
479
|
+
})),
|
|
480
|
+
surfaceTable: sharedSurfaceTable(payload.surfaceTable),
|
|
481
|
+
partialWords: reusedPartialWords === null ? sharedPartialWordsOf(tokenData, payload.partialSpellings, documentData, analysis) : sharePartialWordTable(reusedPartialWords)
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// src/core/partition/frozen/merge.ts
|
|
486
|
+
function selectionKeeps(selection, ordinal) {
|
|
487
|
+
return selection.keep === void 0 ? !selection.segment.isTombstoned(ordinal) : selection.keep(ordinal);
|
|
488
|
+
}
|
|
489
|
+
function remapOf(selection, docIds) {
|
|
490
|
+
const { segment } = selection;
|
|
491
|
+
const count = segment.arrays.documentCount;
|
|
492
|
+
const remap = new Int32Array(count).fill(-1);
|
|
493
|
+
for (let ordinal = 0; ordinal < count; ordinal++) {
|
|
494
|
+
if (!selectionKeeps(selection, ordinal)) continue;
|
|
495
|
+
remap[ordinal] = docIds.length;
|
|
496
|
+
docIds.push(segment.arrays.idTable.idAt(ordinal));
|
|
497
|
+
}
|
|
498
|
+
return remap;
|
|
499
|
+
}
|
|
500
|
+
function fieldNameIndex(fieldNames, name) {
|
|
501
|
+
const at = fieldNames.indexOf(name);
|
|
502
|
+
if (at >= 0) return at;
|
|
503
|
+
fieldNames.push(name);
|
|
504
|
+
return fieldNames.length - 1;
|
|
505
|
+
}
|
|
506
|
+
function fieldIndexRemapOf(segment, fieldNames) {
|
|
507
|
+
const remap = new Uint16Array(segment.arrays.fieldNames.length);
|
|
508
|
+
for (let i = 0; i < segment.arrays.fieldNames.length; i++) {
|
|
509
|
+
remap[i] = fieldNameIndex(fieldNames, segment.arrays.fieldNames[i]);
|
|
510
|
+
}
|
|
511
|
+
return remap;
|
|
512
|
+
}
|
|
513
|
+
function holdsADiscardedField(bytes, discardedFields) {
|
|
514
|
+
const keys = topLevelMapKeys(bytes);
|
|
515
|
+
if (keys === null) return true;
|
|
516
|
+
for (const fieldPath of discardedFields) {
|
|
517
|
+
const dot = fieldPath.indexOf(".");
|
|
518
|
+
if (keys.has(dot < 0 ? fieldPath : fieldPath.slice(0, dot))) return true;
|
|
519
|
+
}
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
function encodedDocumentsOf(input) {
|
|
523
|
+
const table = input.segment.arrays.documentTable;
|
|
524
|
+
const encoded = new Array(input.remap.length);
|
|
525
|
+
const encodeOrdinal = (ordinal) => {
|
|
526
|
+
let bytes = encoded[ordinal];
|
|
527
|
+
if (bytes === void 0) {
|
|
528
|
+
bytes = encodeDocument(input.segment.documentSource.docAt(ordinal));
|
|
529
|
+
encoded[ordinal] = bytes;
|
|
530
|
+
}
|
|
531
|
+
return bytes;
|
|
532
|
+
};
|
|
533
|
+
if (table === null) return encodeOrdinal;
|
|
534
|
+
const discardedFields = table.discardedFields;
|
|
535
|
+
return (ordinal) => {
|
|
536
|
+
if (encoded[ordinal] !== void 0) return encodeOrdinal(ordinal);
|
|
537
|
+
const stored = table.blob.subarray(table.offsets[ordinal], table.offsets[ordinal + 1]);
|
|
538
|
+
if (discardedFields === void 0 || !holdsADiscardedField(stored, discardedFields)) return stored;
|
|
539
|
+
return encodeOrdinal(ordinal);
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function mergeDocuments(inputs, documentCount) {
|
|
543
|
+
const readers = inputs.map(encodedDocumentsOf);
|
|
544
|
+
const offsets = new Uint32Array(documentCount + 1);
|
|
545
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
546
|
+
const { remap } = inputs[i];
|
|
547
|
+
for (let ordinal = 0; ordinal < remap.length; ordinal++) {
|
|
548
|
+
if (remap[ordinal] >= 0) offsets[remap[ordinal] + 1] = readers[i](ordinal).length;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
for (let ordinal = 0; ordinal < documentCount; ordinal++) {
|
|
552
|
+
if (offsets[ordinal + 1] > 4294967295 - offsets[ordinal]) throw new SegmentRefusal(8);
|
|
553
|
+
offsets[ordinal + 1] += offsets[ordinal];
|
|
554
|
+
}
|
|
555
|
+
const blob = new Uint8Array(offsets[documentCount]);
|
|
556
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
557
|
+
const { remap } = inputs[i];
|
|
558
|
+
for (let ordinal = 0; ordinal < remap.length; ordinal++) {
|
|
559
|
+
const target = remap[ordinal];
|
|
560
|
+
if (target >= 0) blob.set(readers[i](ordinal), offsets[target]);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return { blob, offsets };
|
|
564
|
+
}
|
|
565
|
+
function mergeSegmentContents(selections, analysis = null, textAnalysis = null) {
|
|
566
|
+
const docIds = [];
|
|
567
|
+
const fieldNames = [];
|
|
568
|
+
const inputs = selections.map((selection) => ({
|
|
569
|
+
segment: selection.segment,
|
|
570
|
+
remap: remapOf(selection, docIds),
|
|
571
|
+
fieldIndexRemap: fieldIndexRemapOf(selection.segment, fieldNames)
|
|
572
|
+
}));
|
|
573
|
+
const documentCount = docIds.length;
|
|
574
|
+
const keyword = mergeKeywordColumns(inputs, documentCount, fieldNames, analysis, textAnalysis);
|
|
575
|
+
const payload = {
|
|
576
|
+
documentCount,
|
|
577
|
+
docIds,
|
|
578
|
+
fieldNames,
|
|
579
|
+
...keyword,
|
|
580
|
+
...mergeFieldIndexes(inputs, documentCount),
|
|
581
|
+
storedFields: mergeStoredFields(
|
|
582
|
+
inputs.map((input) => ({ store: input.segment.docStore, mapping: new Uint32Array(input.remap.buffer) })),
|
|
583
|
+
documentCount
|
|
584
|
+
)
|
|
585
|
+
};
|
|
586
|
+
return { payload, documents: mergeDocuments(inputs, documentCount), reusedPartialWords: null };
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// src/core/partition/segment-builder/keywords.ts
|
|
590
|
+
var SegmentKeywords = class {
|
|
591
|
+
constructor(fields, trackPositions) {
|
|
592
|
+
this.trackPositions = trackPositions;
|
|
593
|
+
this.segment = new GrowingSegment(new LivePostings(), trackPositions);
|
|
594
|
+
this.partial = new Set(fields.filter((field) => field.partial).map((field) => field.path));
|
|
595
|
+
if (this.partial.size > 0) this.segment.spellings = createSpellingTable();
|
|
596
|
+
}
|
|
597
|
+
segment;
|
|
598
|
+
fields = [];
|
|
599
|
+
fieldIndexes = /* @__PURE__ */ new Map();
|
|
600
|
+
partial;
|
|
601
|
+
add(prepared, ordinal) {
|
|
602
|
+
const fields = [];
|
|
603
|
+
for (const [path, text] of prepared.fields) {
|
|
604
|
+
let field = this.fieldIndexes.get(path);
|
|
605
|
+
if (field === void 0) {
|
|
606
|
+
field = this.fields.length;
|
|
607
|
+
this.fields.push(path);
|
|
608
|
+
this.fieldIndexes.set(path, field);
|
|
609
|
+
}
|
|
610
|
+
fields.push({ field, text: text.records });
|
|
611
|
+
}
|
|
612
|
+
fields.sort((left, right) => left.field - right.field);
|
|
613
|
+
this.segment.reserveFields(ordinal + 1, this.fields.length);
|
|
614
|
+
for (const field of fields)
|
|
615
|
+
this.segment.fields.partial[field.field] = Number(this.partial.has(this.fields[field.field]));
|
|
616
|
+
return this.segment.insert(ordinal, fields);
|
|
617
|
+
}
|
|
618
|
+
encode() {
|
|
619
|
+
const { terms, pool, positions } = this.segment.postings;
|
|
620
|
+
let postings = 0;
|
|
621
|
+
let positionCount = 0;
|
|
622
|
+
for (let token = 0; token < terms.count; token++) {
|
|
623
|
+
postings += terms.lengths[token];
|
|
624
|
+
if (!this.trackPositions || pool.positionStarts === null) continue;
|
|
625
|
+
const end = terms.sliceStart[token] + terms.lengths[token];
|
|
626
|
+
for (let row2 = terms.sliceStart[token]; row2 < end; row2++)
|
|
627
|
+
positionCount += positions.values[pool.positionStarts[row2]];
|
|
628
|
+
}
|
|
629
|
+
const postingOffsets = new Uint32Array(terms.count + 1);
|
|
630
|
+
const postingDocIds = new Uint32Array(postings);
|
|
631
|
+
const postingFrequencies = new Uint16Array(postings);
|
|
632
|
+
const postingFieldIndices = new Uint16Array(postings);
|
|
633
|
+
const positionOffsets = this.trackPositions && postings > 0 ? new Uint32Array(postings + 1) : null;
|
|
634
|
+
const positionValues = positionOffsets === null ? null : new Uint32Array(positionCount);
|
|
635
|
+
const docFrequencies = /* @__PURE__ */ Object.create(null);
|
|
636
|
+
let row = 0;
|
|
637
|
+
let position = 0;
|
|
638
|
+
for (let token = 0; token < terms.count; token++) {
|
|
639
|
+
const start = terms.sliceStart[token];
|
|
640
|
+
const length = terms.lengths[token];
|
|
641
|
+
postingOffsets[token] = row;
|
|
642
|
+
postingDocIds.set(pool.docIds.subarray(start, start + length), row);
|
|
643
|
+
postingFrequencies.set(pool.frequencies.subarray(start, start + length), row);
|
|
644
|
+
postingFieldIndices.set(pool.fieldIndices.subarray(start, start + length), row);
|
|
645
|
+
if (positionOffsets !== null && positionValues !== null && pool.positionStarts !== null) {
|
|
646
|
+
for (let at = start; at < start + length; at++) {
|
|
647
|
+
const offset = pool.positionStarts[at];
|
|
648
|
+
const count = positions.values[offset];
|
|
649
|
+
positionOffsets[row + at - start] = position;
|
|
650
|
+
positionValues.set(positions.values.subarray(offset + 1, offset + 1 + count), position);
|
|
651
|
+
position += count;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
row += length;
|
|
655
|
+
docFrequencies[terms.tokens[token]] = terms.frequencyAt(token);
|
|
656
|
+
}
|
|
657
|
+
postingOffsets[terms.count] = row;
|
|
658
|
+
if (positionOffsets !== null) positionOffsets[row] = position;
|
|
659
|
+
const fieldLengthColumns = [];
|
|
660
|
+
const totalFieldLengths = /* @__PURE__ */ Object.create(null);
|
|
661
|
+
const lengths = this.segment.fields;
|
|
662
|
+
for (let field = 0; field < this.fields.length; field++) {
|
|
663
|
+
const start = field * lengths.ordinalCapacity;
|
|
664
|
+
fieldLengthColumns.push(lengths.values.slice(start, start + lengths.documents[0]));
|
|
665
|
+
totalFieldLengths[this.fields[field]] = lengths.totals[field];
|
|
666
|
+
}
|
|
667
|
+
let surfaceForms = null;
|
|
668
|
+
if (this.segment.surfaces !== null) {
|
|
669
|
+
const table = this.segment.surfaces;
|
|
670
|
+
surfaceForms = /* @__PURE__ */ Object.create(null);
|
|
671
|
+
for (const entry of table.liveEntries())
|
|
672
|
+
surfaceForms[table.textAt(entry)] = [table.count[entry], terms.tokens[table.token[entry]]];
|
|
673
|
+
}
|
|
674
|
+
let partialSpellings = null;
|
|
675
|
+
if (this.segment.spellings !== null) {
|
|
676
|
+
const table = this.segment.spellings;
|
|
677
|
+
partialSpellings = { fields: [...this.partial], tokens: [], spellings: [], counts: [] };
|
|
678
|
+
for (const entry of table.liveEntries()) {
|
|
679
|
+
partialSpellings.tokens.push(terms.tokens[table.token[entry]]);
|
|
680
|
+
partialSpellings.spellings.push(table.textAt(entry));
|
|
681
|
+
partialSpellings.counts.push(table.count[entry]);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return {
|
|
685
|
+
tokens: [...terms.tokens],
|
|
686
|
+
fieldNames: [...this.fields],
|
|
687
|
+
postingOffsets,
|
|
688
|
+
postingDocIds,
|
|
689
|
+
postingFrequencies,
|
|
690
|
+
postingFieldIndices,
|
|
691
|
+
positionOffsets,
|
|
692
|
+
positionValues,
|
|
693
|
+
docFrequencies,
|
|
694
|
+
fieldLengthNames: [...this.fields],
|
|
695
|
+
fieldLengthColumns,
|
|
696
|
+
totalFieldLengths,
|
|
697
|
+
surfaceForms,
|
|
698
|
+
partialSpellings
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
// src/core/partition/segment-builder/index.ts
|
|
704
|
+
function indexOf(indexes, fieldPath, create) {
|
|
705
|
+
let index = indexes.get(fieldPath);
|
|
706
|
+
if (index === void 0) {
|
|
707
|
+
index = create();
|
|
708
|
+
indexes.set(fieldPath, index);
|
|
709
|
+
}
|
|
710
|
+
return index;
|
|
711
|
+
}
|
|
712
|
+
function indexFilterValue(indexes, ordinal, fieldPath, fieldType, value) {
|
|
713
|
+
if (fieldType === "number" || fieldType === "number[]") {
|
|
714
|
+
const index = indexOf(indexes.numericIndexes, fieldPath, createNumericIndex);
|
|
715
|
+
for (const entry of fieldType === "number" ? [value] : value) index.insert(ordinal, entry);
|
|
716
|
+
} else if (fieldType === "boolean" || fieldType === "boolean[]") {
|
|
717
|
+
const index = indexOf(indexes.booleanIndexes, fieldPath, createBooleanIndex);
|
|
718
|
+
for (const entry of fieldType === "boolean" ? [value] : value)
|
|
719
|
+
index.insert(ordinal, entry);
|
|
720
|
+
} else if (fieldType === "enum" || fieldType === "enum[]") {
|
|
721
|
+
const index = indexOf(indexes.enumIndexes, fieldPath, createEnumIndex);
|
|
722
|
+
for (const entry of fieldType === "enum" ? [value] : value) index.insert(ordinal, entry);
|
|
723
|
+
} else if (fieldType === "geopoint") {
|
|
724
|
+
const point = value;
|
|
725
|
+
indexOf(indexes.geoIndexes, fieldPath, createLoadedGeoIndex).insert(ordinal, point.lat, point.lon);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
function refuseRepeatedDocIds(documents) {
|
|
729
|
+
const seen = /* @__PURE__ */ new Set();
|
|
730
|
+
for (const { docId } of documents) {
|
|
731
|
+
if (seen.has(docId)) {
|
|
732
|
+
throw new NarsilError(ErrorCodes.DOC_ALREADY_EXISTS, `Document "${docId}" already exists in partition 0`, {
|
|
733
|
+
docId,
|
|
734
|
+
partitionId: 0
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
seen.add(docId);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
function validateAsAnInsertDoes(documents, schema, options) {
|
|
741
|
+
if (options?.validate === false) return;
|
|
742
|
+
for (const { document } of documents) {
|
|
743
|
+
validateDocument(document, schema, options?.patternValueLimit);
|
|
744
|
+
if (options?.strict) validateDocumentStrict(document, schema);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
function emptyFilters() {
|
|
748
|
+
return {
|
|
749
|
+
numericIndexes: /* @__PURE__ */ new Map(),
|
|
750
|
+
booleanIndexes: /* @__PURE__ */ new Map(),
|
|
751
|
+
enumIndexes: /* @__PURE__ */ new Map(),
|
|
752
|
+
geoIndexes: /* @__PURE__ */ new Map(),
|
|
753
|
+
patternIndexes: /* @__PURE__ */ new Map(),
|
|
754
|
+
sizeIndexes: /* @__PURE__ */ new Map()
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function buildSegmentPayloads(documents, schema, language, options, trackPositions) {
|
|
758
|
+
refuseRepeatedDocIds(documents);
|
|
759
|
+
validateAsAnInsertDoes(documents, schema, options);
|
|
760
|
+
const fields = schemaFieldsOf(schema);
|
|
761
|
+
let keywords = new SegmentKeywords(fields, trackPositions);
|
|
762
|
+
let filters = emptyFilters();
|
|
763
|
+
let start = 0;
|
|
764
|
+
const outputs = [];
|
|
765
|
+
const finish = (end) => {
|
|
766
|
+
const members = documents.slice(start, end);
|
|
767
|
+
const identity = Int32Array.from({ length: members.length }, (_, ordinal) => ordinal);
|
|
768
|
+
outputs.push({
|
|
769
|
+
documents: members,
|
|
770
|
+
payload: {
|
|
771
|
+
documentCount: members.length,
|
|
772
|
+
docIds: members.map((entry) => entry.docId),
|
|
773
|
+
...keywords.encode(),
|
|
774
|
+
...encodeFieldIndexes(filters, identity)
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
};
|
|
778
|
+
for (let at = 0; at < documents.length; at++) {
|
|
779
|
+
const document = documents[at].document;
|
|
780
|
+
const text = prepareDocumentText(document, fields, language, options);
|
|
781
|
+
if (!keywords.add(text, at - start)) {
|
|
782
|
+
if (at === start) throw new SegmentRefusal(8);
|
|
783
|
+
finish(at);
|
|
784
|
+
start = at;
|
|
785
|
+
keywords = new SegmentKeywords(fields, trackPositions);
|
|
786
|
+
filters = emptyFilters();
|
|
787
|
+
if (!keywords.add(text, 0)) throw new SegmentRefusal(8);
|
|
788
|
+
}
|
|
789
|
+
const ordinal = at - start;
|
|
790
|
+
for (const { path: fieldPath, base: fieldType, pattern: pattern2 } of fields) {
|
|
791
|
+
const value = getNestedValue(document, fieldPath);
|
|
792
|
+
if (value === void 0 || value === null) continue;
|
|
793
|
+
recordValueSize(filters.sizeIndexes, ordinal, fieldPath, fieldType, value);
|
|
794
|
+
if (pattern2) patternIndexOf(filters.patternIndexes, fieldPath).add(ordinal, value);
|
|
795
|
+
if (!isWordIndexedBase(fieldType)) indexFilterValue(filters, ordinal, fieldPath, fieldType, value);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
if (start < documents.length || outputs.length === 0) finish(documents.length);
|
|
799
|
+
return outputs;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export { alreadyPresentOnWorker, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility };
|