@delali/narsil 0.3.1-next.99 → 0.4.1-next.211
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/NOTICE +45 -0
- package/README.md +30 -11
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +101 -13
- package/dist/adapters/gcs.d.ts +49 -0
- package/dist/adapters/gcs.mjs +213 -0
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +2 -7
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/memory.mjs +5 -0
- package/dist/adapters/s3.d.ts +53 -0
- package/dist/adapters/s3.mjs +263 -0
- package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
- package/dist/browser/chunk-4E5APHTM.mjs +1459 -0
- package/dist/browser/chunk-NDYADQ4Y.mjs +23426 -0
- package/dist/browser/chunk-QAOVAYAG.mjs +564 -0
- package/dist/browser/chunk-WC2DEXWU.mjs +29 -0
- package/dist/browser/chunk-YINZFPLT.mjs +1239 -0
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/{chunk-Z7QH2XHB.mjs → core-leaf-HWAXCEWX.mjs} +3987 -2103
- package/dist/browser/custom-token-results-R5BIX7SL.mjs +59 -0
- package/dist/browser/digest-leaf-64IPRPZD.mjs +151 -0
- package/dist/browser/durability-config-75NSFCQN.mjs +97 -0
- package/dist/browser/embed-GG6PS3EA.mjs +264 -0
- package/dist/browser/geo-index-GNHY4PUB.mjs +1484 -0
- package/dist/browser/gzip-JF3S6PPT.mjs +31 -0
- package/dist/browser/module-ZZTNG5JZ.mjs +5762 -0
- package/dist/browser/msgpack-leaf-44XNWSSY.mjs +302 -0
- package/dist/browser/optional-reads-XMVPG6HG.mjs +3230 -0
- package/dist/browser/optional-writes-76DWMRQH.mjs +3603 -0
- package/dist/browser/phrase-module-6UGFVW5J.mjs +617 -0
- package/dist/browser/resolve-vector-text-XRR2OVHE.mjs +85 -0
- package/dist/browser/restore-queue-SG5O735W.mjs +196 -0
- package/dist/browser/{runtime-NYE5TB6O.mjs → runtime-OMKE7DF4.mjs} +83 -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-5UTR5K7J.mjs +19829 -0
- package/dist/browser/store-leaf-3L33V35P.mjs +2070 -0
- package/dist/browser/suggestions-leaf-UBNDVKBD.mjs +1430 -0
- package/dist/browser/worker-copies-JXSGYR5X.mjs +2951 -0
- package/dist/{capabilities-BTTIs96E.d.ts → capabilities-DMte5K9_.d.ts} +162 -18
- package/dist/chunk-2AFZE7Y3.mjs +72 -0
- package/dist/chunk-2CKDCC65.mjs +47 -0
- package/dist/chunk-3ECIRFS5.mjs +61 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-4H4RG2FR.mjs +13 -0
- package/dist/chunk-4PY4JYMY.mjs +11 -0
- package/dist/chunk-4ZPVAHWF.mjs +1289 -0
- package/dist/chunk-5EI5CXO6.mjs +197 -0
- package/dist/chunk-5F5MXWS5.mjs +283 -0
- package/dist/{chunk-OHP7QR33.mjs → chunk-5FLRXF73.mjs} +25 -4
- package/dist/chunk-6FOENO4E.mjs +273 -0
- package/dist/chunk-6GHX35ZM.mjs +108 -0
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/chunk-6N6HHBCQ.mjs +4596 -0
- package/dist/{chunk-LXPIXDUJ.mjs → chunk-7P5YWDRQ.mjs} +403 -169
- package/dist/{chunk-TGP5M5R7.mjs → chunk-7T4LAYT4.mjs} +1 -1
- package/dist/{chunk-GGSH6KBQ.mjs → chunk-ASZLNVWW.mjs} +23 -3
- package/dist/chunk-AVBPB3MI.mjs +602 -0
- package/dist/{chunk-UCDF35PU.mjs → chunk-AVGUEEQ3.mjs} +494 -245
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/chunk-BY6NALRK.mjs +31921 -0
- package/dist/chunk-C4ZMXXTL.mjs +92 -0
- package/dist/{chunk-2WYMG3OZ.mjs → chunk-C74KPRR7.mjs} +274 -19
- package/dist/{chunk-RSRVGAIQ.mjs → chunk-D456ZFPQ.mjs} +3 -2
- package/dist/chunk-DXZ6JDWG.mjs +797 -0
- package/dist/chunk-FJXJZUWF.mjs +209 -0
- package/dist/chunk-FS3HPPSC.mjs +212 -0
- package/dist/chunk-FT4KLZXW.mjs +1164 -0
- package/dist/chunk-GR5GMFJJ.mjs +104 -0
- package/dist/chunk-GXCDWLQI.mjs +193 -0
- package/dist/chunk-GXED6R3Q.mjs +271 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-IL5DRCNU.mjs +3041 -0
- package/dist/{chunk-P36MUFEJ.mjs → chunk-JDDXV6UF.mjs} +2 -1
- package/dist/chunk-K5HSUPYS.mjs +11 -0
- package/dist/chunk-KYIRXTCA.mjs +100 -0
- package/dist/chunk-LFXS6OF7.mjs +289 -0
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/chunk-M2Z5WVWW.mjs +194 -0
- package/dist/{chunk-45AVKHMJ.mjs → chunk-M3B7SGJB.mjs} +63 -50
- package/dist/chunk-M3OW2XSP.mjs +40 -0
- package/dist/chunk-MFPSQZ6P.mjs +127 -0
- package/dist/chunk-MRCJBWJZ.mjs +1292 -0
- package/dist/chunk-MSIN4NM3.mjs +25 -0
- package/dist/chunk-MW3CJVGP.mjs +219 -0
- package/dist/chunk-MYM6CAVK.mjs +76 -0
- package/dist/chunk-NJJN4FMM.mjs +84 -0
- package/dist/chunk-NM7I3BM7.mjs +59 -0
- package/dist/chunk-OIJ64LGT.mjs +19 -0
- package/dist/{chunk-K7D4ZTSW.mjs → chunk-P4F4UWLC.mjs} +1 -1
- package/dist/chunk-Q2AP2FSN.mjs +15 -0
- package/dist/chunk-R2PJKSNL.mjs +54 -0
- package/dist/{chunk-HXJBSHXF.mjs → chunk-R724DJSG.mjs} +5056 -2619
- package/dist/chunk-S2POFTLN.mjs +10 -0
- package/dist/chunk-S5QMWECL.mjs +7 -0
- package/dist/chunk-SLAC5PAB.mjs +5008 -0
- package/dist/chunk-T4HMSZCX.mjs +5 -0
- package/dist/chunk-TACP6VK6.mjs +111 -0
- package/dist/chunk-TGPKS2UM.mjs +125 -0
- package/dist/chunk-TKKXPKEO.mjs +979 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/chunk-XL56L4IR.mjs +228 -0
- package/dist/chunk-XQIAMDAG.mjs +3076 -0
- package/dist/chunk-YTUZ4R22.mjs +1063 -0
- package/dist/{chunk-KV3AZFT3.mjs → chunk-ZKOQR7EA.mjs} +45 -1
- package/dist/chunk-ZPJFGGGI.mjs +638 -0
- package/dist/chunk-ZXX5GZEX.mjs +17 -0
- package/dist/{client-i9eLJrw5.d.ts → client-BKqtl0_V.d.ts} +442 -22
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +8 -898
- package/dist/config-Bnl7L-0H.d.ts +608 -0
- package/dist/{config-P__Diiy4.d.ts → config-CJ-jfI0a.d.ts} +119 -9
- package/dist/core-leaf-6JVHEVFB.mjs +8 -0
- package/dist/custom-token-results-NXHBVY7U.mjs +59 -0
- package/dist/digest-leaf-KXBGKYHZ.mjs +1 -0
- package/dist/direct-executor-V3WOYU2Y.mjs +17 -0
- package/dist/distribution/coordinator/etcd.d.ts +63 -7
- package/dist/distribution/coordinator/etcd.mjs +725 -81
- package/dist/distribution/coordinator/in-memory.d.ts +3 -3
- package/dist/distribution/coordinator/in-memory.mjs +65 -10
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +39 -10
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +9 -6
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +20 -15
- package/dist/distribution.d.ts +267 -56
- package/dist/distribution.mjs +23156 -11362
- package/dist/durability-config-VWS2K24E.mjs +96 -0
- package/dist/embed-4PHHKGBK.mjs +263 -0
- package/dist/embeddings/openai.d.ts +1 -1
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{memory-CUEDwr-F.d.ts → engine-qjAxJSKk.d.ts} +2254 -1123
- package/dist/geo-index-2ZMMWWSK.mjs +1484 -0
- package/dist/gzip-2UCZW2MM.mjs +31 -0
- package/dist/{index-lcdGLyJH.d.ts → index-B_vmxpgW.d.ts} +260 -102
- package/dist/index.browser.mjs +4 -4
- package/dist/index.d.ts +2133 -57
- package/dist/index.mjs +16 -32
- package/dist/index.react-native.mjs +12 -0
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +1 -2
- package/dist/invalidation/noop.d.ts +1 -1
- 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-UCRK7MSI.mjs +154 -0
- package/dist/module-5ZSLUQII.mjs +3729 -0
- package/dist/msgpack-leaf-H5ZYW7S7.mjs +9 -0
- package/dist/optional-reads-5HFMF2QZ.mjs +3373 -0
- package/dist/optional-writes-4UOQKETU.mjs +247 -0
- package/dist/paged-partition-archive-BBRLZCIF.mjs +253 -0
- package/dist/partial-words.browser.mjs +1650 -0
- package/dist/partial-words.mjs +17 -11
- package/dist/{chunk-ASY5PHYI.mjs → pattern.browser.mjs} +253 -311
- package/dist/pattern.mjs +6 -7
- package/dist/persistence/durability/checkpoint-worker.d.ts +93 -25
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -41
- package/dist/phrase-module-EFESWOCR.mjs +635 -0
- package/dist/query-actions-HMJUVWGT.mjs +119 -0
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +53 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +47 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +19 -0
- package/dist/react-native/chunks/chunk-3OEFSHVV.mjs +970 -0
- package/dist/{browser/chunk-RELZRJNR.mjs → react-native/chunks/chunk-43R4GCM7.mjs} +49 -50
- package/dist/react-native/chunks/chunk-AKRYHAVG.mjs +6729 -0
- package/dist/react-native/chunks/chunk-CW2ZFXSE.mjs +14 -0
- package/dist/react-native/chunks/chunk-G3WCDTOF.mjs +29640 -0
- package/dist/react-native/chunks/chunk-GXXHHA2T.mjs +212 -0
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/chunk-HQEVQEDJ.mjs +52 -0
- package/dist/react-native/chunks/chunk-HRDMIQ63.mjs +131 -0
- package/dist/react-native/chunks/chunk-HTBY4GON.mjs +565 -0
- package/dist/react-native/chunks/chunk-LX62Y4B5.mjs +61 -0
- package/dist/react-native/chunks/chunk-MRH36RN3.mjs +902 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/chunk-UE4ANHSX.mjs +127 -0
- package/dist/react-native/chunks/chunk-UNZPWLVL.mjs +1063 -0
- package/dist/react-native/chunks/chunk-UO44MA5M.mjs +232 -0
- package/dist/react-native/chunks/chunk-UYKIV2KT.mjs +42 -0
- package/dist/react-native/chunks/chunk-VUJCSQG5.mjs +11 -0
- package/dist/react-native/chunks/chunk-WVHF4ZAK.mjs +802 -0
- package/dist/react-native/chunks/chunk-ZUJCUPVS.mjs +54 -0
- package/dist/react-native/chunks/core-leaf-S2KNBWDY.mjs +7 -0
- package/dist/react-native/chunks/custom-token-results-3OZEMRE7.mjs +59 -0
- package/dist/react-native/chunks/digest-leaf-X6OIFDIU.mjs +1 -0
- package/dist/react-native/chunks/durability-config-FCSD4MXY.mjs +96 -0
- package/dist/react-native/chunks/embed-HA2I7RCF.mjs +263 -0
- package/dist/react-native/chunks/geo-index-QEYKEVPH.mjs +1484 -0
- package/dist/react-native/chunks/gzip.react-native-CVM4NQG2.mjs +12 -0
- package/dist/react-native/chunks/module-FMBX75GP.mjs +5209 -0
- package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +7 -0
- package/dist/react-native/chunks/optional-reads-AFPO2FEB.mjs +3364 -0
- package/dist/react-native/chunks/optional-writes-XOH25XZI.mjs +296 -0
- package/dist/react-native/chunks/phrase-module-IGYBK7XH.mjs +636 -0
- package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
- package/dist/react-native/chunks/resolve-vector-text-GE2CRJKI.mjs +84 -0
- package/dist/react-native/chunks/restore-queue-LLNMYB4Z.mjs +187 -0
- package/dist/react-native/chunks/runtime-UOHD2XUJ.mjs +615 -0
- package/dist/react-native/chunks/segment-codec-leaf-VR6O5GLC.mjs +13 -0
- package/dist/react-native/chunks/segment-merge-leaf-LLMWU4EW.mjs +14 -0
- package/dist/react-native/chunks/storage-leaf-JD7PIDO4.mjs +19633 -0
- package/dist/react-native/chunks/store-leaf-4UVCMYGN.mjs +15 -0
- package/dist/react-native/chunks/suggestions-leaf-J5VT5RHY.mjs +1321 -0
- package/dist/react-native/chunks/worker-copies-ZYHY7FKJ.mjs +2831 -0
- package/dist/react-native/partial-words.mjs +1658 -0
- package/dist/react-native/pattern.mjs +2570 -0
- package/dist/react-native/query-suggestions.mjs +55 -0
- package/dist/react-native/sync.mjs +2759 -0
- package/dist/react-native/synonyms.mjs +676 -0
- package/dist/react.d.ts +12 -8
- package/dist/react.mjs +45 -1
- package/dist/{rerank-NWTKK636.mjs → rerank-RI2PMNOD.mjs} +22 -12
- package/dist/rerankers/http.d.ts +1 -1
- package/dist/rerankers/http.mjs +2 -2
- package/dist/resolve-vector-text-OD4J3WHF.mjs +3 -0
- package/dist/restore-queue-PCKWDAKQ.mjs +192 -0
- package/dist/runtime-USQYKN3I.mjs +615 -0
- package/dist/{schema-4W_7tk1f.d.ts → schema-CzG9OUw5.d.ts} +70 -30
- package/dist/segment-codec-leaf-QJM7I6QG.mjs +18 -0
- package/dist/segment-merge-leaf-4BJGIJHY.mjs +18 -0
- package/dist/server.d.ts +348 -22
- package/dist/server.mjs +2211 -327
- package/dist/storage-leaf-GRRRI7UV.mjs +5962 -0
- package/dist/store-leaf-6VMMSVBE.mjs +20 -0
- package/dist/stored-values-BWIMpiT_.d.ts +25 -0
- package/dist/suggestions-leaf-4KPTMPTL.mjs +54 -0
- package/dist/sync/filesystem.d.ts +30 -0
- package/dist/sync/filesystem.mjs +288 -0
- package/dist/sync/indexeddb.browser.mjs +287 -0
- package/dist/sync/indexeddb.d.ts +30 -0
- package/dist/sync/indexeddb.mjs +242 -0
- package/dist/sync.browser.mjs +1271 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2712 -0
- package/dist/synonyms.browser.mjs +658 -0
- package/dist/synonyms.mjs +17 -7
- package/dist/tasks-65b6t6lk.d.ts +782 -0
- package/dist/thread-UJ3W5LVI.mjs +31 -0
- package/dist/{types-B3b68nfF.d.ts → types-Ck97nB3D.d.ts} +1 -1
- package/dist/types-CpCg-Gq-.d.ts +227 -0
- package/dist/{types-Cb9kiY5P.d.ts → types-DvncmvuQ.d.ts} +12 -1
- package/dist/vector/search-worker.d.ts +10 -2
- package/dist/vector/search-worker.mjs +11 -11
- package/dist/worker-copies-YSXZXIGC.mjs +2232 -0
- package/dist/workers/entry.mjs +75 -15
- package/openapi.json +6840 -0
- package/package.json +404 -19
- package/dist/browser/chunk-CN4I4FZU.mjs +0 -602
- package/dist/browser/chunk-HOZW3PKP.mjs +0 -9
- package/dist/browser/chunk-JPTQZWJQ.mjs +0 -10
- package/dist/browser/chunk-LD55ZGU3.mjs +0 -347
- package/dist/browser/chunk-NAFT3K6X.mjs +0 -24546
- package/dist/browser/chunk-NNG3EEB6.mjs +0 -2728
- package/dist/browser/chunk-QWES44AW.mjs +0 -473
- package/dist/browser/durability-wiring-PY3L7DES.mjs +0 -3679
- package/dist/browser/module-PDXYHT75.mjs +0 -2822
- package/dist/browser/release-76MXRPGV.mjs +0 -33
- package/dist/browser/restore-queue-DVIYJ7RU.mjs +0 -35
- package/dist/browser/snapshot-J57MZK6L.mjs +0 -1207
- package/dist/browser/write-L7FAQA47.mjs +0 -208
- package/dist/chunk-37CD3OKS.mjs +0 -87
- package/dist/chunk-5XNIRLFC.mjs +0 -96
- package/dist/chunk-7X5JST5L.mjs +0 -114
- package/dist/chunk-AV4IJKD2.mjs +0 -35
- package/dist/chunk-AY3AQ3UH.mjs +0 -73
- package/dist/chunk-BKB3XTMI.mjs +0 -707
- package/dist/chunk-C7SLA6CM.mjs +0 -19
- package/dist/chunk-COVCQ73F.mjs +0 -587
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/chunk-E74YLAIG.mjs +0 -24
- package/dist/chunk-FMWRCP2C.mjs +0 -57
- package/dist/chunk-GES7U2PM.mjs +0 -68
- package/dist/chunk-HJSN7UYG.mjs +0 -10
- package/dist/chunk-JFRNNBOM.mjs +0 -35
- package/dist/chunk-K25LZA54.mjs +0 -8484
- package/dist/chunk-KEHK2O6P.mjs +0 -13
- package/dist/chunk-KOKM4PQN.mjs +0 -52
- package/dist/chunk-KZ3NX2P7.mjs +0 -21
- package/dist/chunk-L3L5YFXC.mjs +0 -614
- package/dist/chunk-L5ORED7V.mjs +0 -25
- package/dist/chunk-LH4NZNJJ.mjs +0 -1731
- package/dist/chunk-LU2CE5AE.mjs +0 -507
- package/dist/chunk-LXWDQLTW.mjs +0 -30
- package/dist/chunk-MHOSCQCQ.mjs +0 -948
- package/dist/chunk-NKRBEGJZ.mjs +0 -1705
- package/dist/chunk-NTRMFARG.mjs +0 -462
- package/dist/chunk-NW4XDSP2.mjs +0 -212
- package/dist/chunk-OOEXLUGR.mjs +0 -117
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-OWNZYMRE.mjs +0 -3591
- package/dist/chunk-PPY2GSIB.mjs +0 -44
- package/dist/chunk-QY7GC2MW.mjs +0 -33
- package/dist/chunk-R6A773WK.mjs +0 -226
- package/dist/chunk-R6PR4WYZ.mjs +0 -68
- package/dist/chunk-R7EEKAJE.mjs +0 -593
- package/dist/chunk-RONEOEON.mjs +0 -426
- package/dist/chunk-VWULPWRJ.mjs +0 -7469
- package/dist/chunk-WCJKUGHB.mjs +0 -262
- package/dist/chunk-WQBCBKY3.mjs +0 -8
- package/dist/chunk-X5CV2E2B.mjs +0 -1
- package/dist/chunk-YA7XLE2R.mjs +0 -1256
- package/dist/chunk-YTJCGKM4.mjs +0 -56
- package/dist/chunk-ZG477IPV.mjs +0 -526
- package/dist/chunk-ZYNAMIYX.mjs +0 -113
- package/dist/config-BGB_fDtq.d.ts +0 -237
- package/dist/direct-executor-CXZ66ACP.mjs +0 -22
- package/dist/durability-wiring-QTHOGFMZ.mjs +0 -3229
- package/dist/engine-BGCEm9E_.d.ts +0 -577
- package/dist/module-3NONKBZX.mjs +0 -1860
- package/dist/release-BH3DKW3T.mjs +0 -33
- package/dist/restore-queue-JPRBUYII.mjs +0 -35
- package/dist/runtime-ZKYZFJJC.mjs +0 -177
- package/dist/snapshot-HOGXNO5W.mjs +0 -793
- package/dist/tasks-HG3rlxx6.d.ts +0 -302
- package/dist/thread-B657LQXK.mjs +0 -692
- package/dist/write-XLIGTXBU.mjs +0 -238
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AnyDocument, B as BM25Params, E as EmbeddingFieldConfig,
|
|
1
|
+
import { e as StopWordOverride, C as CustomTokenizer } from './schema-CzG9OUw5.js';
|
|
2
|
+
export { A as AnyDocument, c as BM25FieldParams, B as BM25Params, E as EmbeddingFieldConfig, f as FieldOptionChain, F as FieldType, I as IndexConfig, a as InsertOptions, P as PartitionConfig, S as SchemaDefinition, d as ScoringMode, T as TextFieldOption, V as VectorIndexConfig, b as VectorQuantizationMode, g as VectorStorageMode, W as WriteOptions } from './schema-CzG9OUw5.js';
|
|
3
3
|
import { P as PartialWordSearch } from './partial-words-DTIHO8G4.js';
|
|
4
4
|
import { P as PatternSearch } from './pattern-Cledccbl.js';
|
|
5
5
|
import { S as SynonymSearch } from './synonyms-CpOAHPa-.js';
|
|
6
6
|
export { O as OneWaySynonymRule, a as SynonymRule, T as TwoWaySynonymRule } from './synonyms-CpOAHPa-.js';
|
|
7
7
|
import { L as LanguageModule } from './language-DB8KG1z5.js';
|
|
8
8
|
export { T as TokenizerConfig } from './language-DB8KG1z5.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { E as EmbeddingAdapter, I as InvalidationAdapter, a as InvalidationEvent, b as PartitionStatistics, P as PersistenceAdapter, R as RerankAdapter } from './adapters-
|
|
9
|
+
import { s as Narsil } from './engine-qjAxJSKk.js';
|
|
10
|
+
export { K as AdapterRegistrationOperations, D as AnalysisChange, O as AnalysisOperations, R as ArrayFilter, T as BM25Operations, B as BatchResult, U as ByteSource, C as Change, a as ChangePosition, b as ChangeType, c as ChangesBatch, d as ChangesEvent, e as ChangesOperations, f as ChangesResync, g as ChangesSetting, h as ChangesStatus, i as ChangesSubscribed, j as ClientErrorCode, k as ClientErrorCodes, W as ComparisonFilter, X as DocumentImportResult, Y as DocumentProjection, Z as DocumentWriteOperations, E as ErrorCode, l as ErrorCodes, _ as FacetConfig, $ as FacetResult, a0 as FieldFilter, a1 as FilterExpression, F as FollowChangesOptions, a2 as GeoFilter, a3 as GeoPolygonFilter, a4 as GeoRadiusFilter, v as GroupConfig, a5 as GroupReducer, G as GroupResult, a6 as HeldCheckpointReport, a7 as HighlightConfig, a8 as HighlightMatch, H as Hit, a9 as HybridConfig, I as IndexInfo, aa as IndexLifecycleOperations, x as IndexStats, L as ListParams, y as ListResult, ab as ListedDocument, M as MemoryStats, N as NarsilError, m as NarsilErrorCode, u as NarsilEventHandlers, J as NarsilEventMap, P as PartitionStatsResult, z as PreflightResult, ac as PresenceFilter, ad as ProcessMemoryReport, ae as QueryCoverage, Q as QueryParams, t as QueryResult, af as RerankConfig, ag as ScoreComponents, ah as SearchMode, S as ServerErrorCode, n as ServerErrorCodes, o as SnapshotOptions, ai as SortField, aj as SortSpec, ak as StringFilter, w as SuggestParams, A as SuggestResult, al as SyncOperations, p as SyncSetting, q as SyncStatus, am as SynonymOperations, an as TermMatchPolicy, ao as VectorMaintenanceOperations, V as VectorMaintenanceResult, ap as VectorQueryConfig, aq as WorkerCopyReport, r as isNarsilError } from './engine-qjAxJSKk.js';
|
|
11
|
+
import { N as NarsilConfig } from './config-CJ-jfI0a.js';
|
|
12
|
+
export { A as AnalysisConfig, D as DurabilityConfig, I as IndexContext, a as IndexLifecycleConfig, b as InsertContext, M as MainCopyQueries, c as MemoryConfig, d as NarsilPlugin, P as PartitionContext, Q as QuerySuggestionsConfig, R as RemoveContext, S as SearchContext, e as StaleAnalysis, U as UpdateContext, W as WorkerConfig, f as WorkerContext } from './config-CJ-jfI0a.js';
|
|
13
|
+
import { N as NativeStoredValues } from './stored-values-BWIMpiT_.js';
|
|
14
|
+
export { E as EmbeddingAdapter, I as InvalidationAdapter, a as InvalidationEvent, b as PartitionStatistics, P as PersistenceAdapter, R as RerankAdapter } from './adapters-pljAqmrC.js';
|
|
15
|
+
export { h as QuerySuggestionsBuildEvent, j as QuerySuggestionsWarningEvent } from './query-suggestions-CBYkrQ5T.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Registers a tokeniser under a name that an index config can then reference.
|
|
@@ -84,6 +85,881 @@ declare function getTokenizer(name: string): CustomTokenizer;
|
|
|
84
85
|
*/
|
|
85
86
|
declare function getStopWords(name: string): StopWordOverride;
|
|
86
87
|
|
|
88
|
+
/** The regions of a growing UTF-16 term dictionary. @internal */
|
|
89
|
+
interface NativeTermTable {
|
|
90
|
+
/** The eight-word header containing counts, slot capacity, generation, and used text units. */
|
|
91
|
+
header: Uint32Array;
|
|
92
|
+
/** The hash slots containing ordinal plus one, zero for empty, or minus one for removed. */
|
|
93
|
+
slots: Int32Array;
|
|
94
|
+
/** The text start of each term. */
|
|
95
|
+
termOffset: Uint32Array;
|
|
96
|
+
/** The UTF-16 length of each term. */
|
|
97
|
+
termLength: Uint32Array;
|
|
98
|
+
/** The next term with the same first unit, plus one, or zero. */
|
|
99
|
+
firstUnitNext: Uint32Array;
|
|
100
|
+
/** The first term for each of the 65,536 possible first units, plus one, or zero. */
|
|
101
|
+
firstUnitHead: Uint32Array;
|
|
102
|
+
/** The UTF-16 units of the terms. */
|
|
103
|
+
units: Uint16Array;
|
|
104
|
+
}
|
|
105
|
+
/** The regions and live counts of a growing or frozen term dictionary. @internal */
|
|
106
|
+
interface NativeTermDictionary {
|
|
107
|
+
/** The growing table, or null for a frozen dictionary. */
|
|
108
|
+
growing: NativeTermTable | null;
|
|
109
|
+
/** The frozen UTF-8 tokens, empty for a growing dictionary. */
|
|
110
|
+
tokens: Uint8Array;
|
|
111
|
+
/** The frozen token offsets and final byte length, empty for a growing dictionary. */
|
|
112
|
+
offsets: Uint32Array;
|
|
113
|
+
/** The stored document frequency at each term ordinal. */
|
|
114
|
+
frequencies: Uint32Array;
|
|
115
|
+
/** The removed document count at each term ordinal. */
|
|
116
|
+
removed: Uint32Array;
|
|
117
|
+
}
|
|
118
|
+
/** The native dictionary operations that preserve live counts and Unicode order. @internal */
|
|
119
|
+
interface NativeTermCore {
|
|
120
|
+
/**
|
|
121
|
+
* Finds an exact live term.
|
|
122
|
+
* @param dictionary - The term regions and removal counts.
|
|
123
|
+
* @param text - The UTF-16 query term.
|
|
124
|
+
* @param output - Receives the ordinal when the term is present.
|
|
125
|
+
* @returns Zero or one, or a negative status that leaves the output unchanged.
|
|
126
|
+
*/
|
|
127
|
+
lookupExact(dictionary: NativeTermDictionary, text: Uint16Array, output: Uint32Array): number;
|
|
128
|
+
/**
|
|
129
|
+
* Finds each exact live term after validating the dictionary once.
|
|
130
|
+
* @param dictionary - The term regions and removal counts.
|
|
131
|
+
* @param units - The concatenated UTF-16 query terms.
|
|
132
|
+
* @param offsets - The nondecreasing term boundaries, starting at zero and ending at the unit count.
|
|
133
|
+
* @param output - Receives each term ordinal, or UINT32_MAX when absent.
|
|
134
|
+
* @returns The query count, or a negative status that leaves the entire output unchanged.
|
|
135
|
+
*/
|
|
136
|
+
lookupExactBatch(dictionary: NativeTermDictionary, units: Uint16Array, offsets: Uint32Array, output: Uint32Array): number;
|
|
137
|
+
/**
|
|
138
|
+
* Finds live prefix matches in descending frequency and then code point order.
|
|
139
|
+
* @param dictionary - The term regions and removal counts.
|
|
140
|
+
* @param text - The UTF-16 prefix, which matches nothing when empty.
|
|
141
|
+
* @param limit - The maximum number of matches.
|
|
142
|
+
* @param output - Receives the matching ordinals.
|
|
143
|
+
* @returns The match count, or a negative status that leaves the output unchanged.
|
|
144
|
+
*/
|
|
145
|
+
lookupPrefix(dictionary: NativeTermDictionary, text: Uint16Array, limit: number, output: Uint32Array): number;
|
|
146
|
+
/**
|
|
147
|
+
* Finds live terms within the edit distance in code point order.
|
|
148
|
+
* @param dictionary - The term regions and removal counts.
|
|
149
|
+
* @param text - The UTF-16 query term.
|
|
150
|
+
* @param tolerance - The maximum Levenshtein distance, or zero for an exact lookup.
|
|
151
|
+
* @param prefixLength - The number of leading query code points that must match.
|
|
152
|
+
* @param output - Receives the matching ordinals.
|
|
153
|
+
* @returns The match count, or a negative status that leaves the output unchanged.
|
|
154
|
+
*/
|
|
155
|
+
lookupTypo(dictionary: NativeTermDictionary, text: Uint16Array, tolerance: number, prefixLength: number, output: Uint32Array): number;
|
|
156
|
+
/**
|
|
157
|
+
* Writes the live document frequency of a term.
|
|
158
|
+
* @param dictionary - The term regions and removal counts.
|
|
159
|
+
* @param ordinal - The term ordinal.
|
|
160
|
+
* @param output - Receives the frequency in its first word.
|
|
161
|
+
* @returns Zero, or a negative status that leaves the output unchanged.
|
|
162
|
+
*/
|
|
163
|
+
documentFrequency(dictionary: NativeTermDictionary, ordinal: number, output: Uint32Array): number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The allocator regions for posting slices and run membership lists. @internal */
|
|
167
|
+
interface NativeSliceAllocator {
|
|
168
|
+
/** The used end and the number of free entries. */
|
|
169
|
+
allocation: Uint32Array;
|
|
170
|
+
/** The first free slice for each class, or UINT32_MAX. */
|
|
171
|
+
freeHeads: Uint32Array;
|
|
172
|
+
/** The strictly increasing capacity of each slice class. */
|
|
173
|
+
sliceCapacities: Uint32Array;
|
|
174
|
+
}
|
|
175
|
+
/** The posting metadata indexed by term ordinal. @internal */
|
|
176
|
+
interface NativeTermColumns {
|
|
177
|
+
/** The first posting of each term's slice. */
|
|
178
|
+
sliceStart: Uint32Array;
|
|
179
|
+
/** The allocated slice class of each term. */
|
|
180
|
+
sliceClass: Uint8Array;
|
|
181
|
+
/** The number of occupied entries in each slice. */
|
|
182
|
+
lengths: Uint32Array;
|
|
183
|
+
/** The stored document count of each term. */
|
|
184
|
+
docFrequency: Uint32Array;
|
|
185
|
+
/** The removed document count of each term. */
|
|
186
|
+
deadDocuments: Uint32Array;
|
|
187
|
+
/** The sum of the live, capped posting frequencies. */
|
|
188
|
+
totalTermFrequency: Float64Array;
|
|
189
|
+
/** The sum of the live surface counts for each term. */
|
|
190
|
+
surfaceOccurrences: Float64Array;
|
|
191
|
+
/** The revision that invalidates each term's cached posting view. */
|
|
192
|
+
revision: Uint32Array;
|
|
193
|
+
/** The live, ordered, and position flags, in bits zero, one, and two. */
|
|
194
|
+
flags: Uint8Array;
|
|
195
|
+
}
|
|
196
|
+
/** The shared posting columns and their slice allocator. @internal */
|
|
197
|
+
interface NativePostingPool extends NativeSliceAllocator {
|
|
198
|
+
/** The document ordinal at each posting. */
|
|
199
|
+
docIds: Uint32Array;
|
|
200
|
+
/** The capped frequency at each posting. */
|
|
201
|
+
frequencies: Uint16Array;
|
|
202
|
+
/** The field ordinal at each posting. */
|
|
203
|
+
fieldIndices: Uint16Array;
|
|
204
|
+
/** The first position entry for each posting, or null when positions are absent. */
|
|
205
|
+
positionStarts: Uint32Array | null;
|
|
206
|
+
}
|
|
207
|
+
/** The position lists and their allocation metadata. @internal */
|
|
208
|
+
interface NativePositionPool {
|
|
209
|
+
/** Each list's length followed by its positions, with word zero reserved for an empty list. */
|
|
210
|
+
values: Uint32Array;
|
|
211
|
+
/** The used end and the number of free words. */
|
|
212
|
+
allocation: Uint32Array;
|
|
213
|
+
}
|
|
214
|
+
/** The surface strings and their live counts. @internal */
|
|
215
|
+
interface NativeSurfaceTable {
|
|
216
|
+
/** The surface dictionary. */
|
|
217
|
+
strings: NativeTermTable;
|
|
218
|
+
/** The term ordinal associated with each surface. */
|
|
219
|
+
token: Uint32Array;
|
|
220
|
+
/** The occurrence count of each surface within this segment. */
|
|
221
|
+
count: Uint32Array;
|
|
222
|
+
}
|
|
223
|
+
/** The three-code-point runs and their spelling membership lists. @internal */
|
|
224
|
+
interface NativeRunTable extends NativeSliceAllocator {
|
|
225
|
+
/** The eight-word header, with the run count at zero and slot capacity at two. */
|
|
226
|
+
header: Uint32Array;
|
|
227
|
+
/** The run ordinal plus one, zero for an empty slot, or minus one for a removed slot. */
|
|
228
|
+
slots: Int32Array;
|
|
229
|
+
/** Three consecutive code points for each run. */
|
|
230
|
+
runs: Uint32Array;
|
|
231
|
+
/** The start of each run's member slice. */
|
|
232
|
+
listStart: Uint32Array;
|
|
233
|
+
/** The number of members in each run. */
|
|
234
|
+
listLength: Uint32Array;
|
|
235
|
+
/** The allocated slice class of each run. */
|
|
236
|
+
listClass: Uint8Array;
|
|
237
|
+
/** The spelling ordinals, in ascending order within each run. */
|
|
238
|
+
members: Uint32Array;
|
|
239
|
+
}
|
|
240
|
+
/** The written spellings used for partial-word search. @internal */
|
|
241
|
+
interface NativeSpellingTable extends NativeSurfaceTable {
|
|
242
|
+
/** The length in code points of each spelling. */
|
|
243
|
+
codePoints: Uint32Array;
|
|
244
|
+
/** The runs that locate spellings containing a query fragment. */
|
|
245
|
+
runs: NativeRunTable;
|
|
246
|
+
}
|
|
247
|
+
/** The mutable keyword regions of one segment, protected by its copy's publication gate. @internal */
|
|
248
|
+
interface NativeGrowingSegment {
|
|
249
|
+
/** The term dictionary. */
|
|
250
|
+
terms: NativeTermTable;
|
|
251
|
+
/** The term posting metadata. */
|
|
252
|
+
columns: NativeTermColumns;
|
|
253
|
+
/** The posting columns and their allocator. */
|
|
254
|
+
postings: NativePostingPool;
|
|
255
|
+
/** The position lists, or null when the segment does not track positions. */
|
|
256
|
+
positions: NativePositionPool | null;
|
|
257
|
+
/** The surface table, or null when no token has a separate surface. */
|
|
258
|
+
surfaces: NativeSurfaceTable | null;
|
|
259
|
+
/** The spelling table, or null when the segment has no partial-word field. */
|
|
260
|
+
spellings: NativeSpellingTable | null;
|
|
261
|
+
/** The retired document ordinals as a uint32 bitset. */
|
|
262
|
+
retired: Uint32Array;
|
|
263
|
+
/** The field lengths in field-major order, with ordinalCapacity words per field. */
|
|
264
|
+
fieldLengths: Uint32Array;
|
|
265
|
+
/** The single-word live document count. */
|
|
266
|
+
totalDocuments: Uint32Array;
|
|
267
|
+
/** The live field length totals, indexed by field. */
|
|
268
|
+
totalFieldLengths: Float64Array;
|
|
269
|
+
/** One for a partial-word field, or zero, with one byte per field. */
|
|
270
|
+
partialFields: Uint8Array;
|
|
271
|
+
/** The document ordinal capacity of the segment. */
|
|
272
|
+
ordinalCapacity: number;
|
|
273
|
+
}
|
|
274
|
+
/** The prepared tokens of one text field, including an empty token region. @internal */
|
|
275
|
+
interface NativeFieldTokens {
|
|
276
|
+
/** The field ordinal, in ascending order across the request. */
|
|
277
|
+
field: number;
|
|
278
|
+
/** The eight-word token records returned by native analysis. */
|
|
279
|
+
tokens: Uint32Array;
|
|
280
|
+
/** The UTF-16 text referenced by the token records. */
|
|
281
|
+
units: Uint16Array;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* One value of a field passed by position: the field ordinal, then its token records, then its UTF-16 text,
|
|
285
|
+
* repeated once for each field in ascending field order. @internal
|
|
286
|
+
*/
|
|
287
|
+
type NativeFieldTokenArgument = number | Uint32Array | Uint16Array;
|
|
288
|
+
/** The operations that publish complete documents into keyword segments. @internal */
|
|
289
|
+
interface NativeSegmentCore {
|
|
290
|
+
/**
|
|
291
|
+
* Adds all the indexed text fields and the document count in one publication.
|
|
292
|
+
* @param segment - The writable keyword regions of one growing segment.
|
|
293
|
+
* @param generation - A positive integer that changes whenever the segment replaces any of its regions, so the
|
|
294
|
+
* binding reads every region again only when it changes.
|
|
295
|
+
* @param ordinal - The document ordinal, below the segment's capacity.
|
|
296
|
+
* @param fields - Each prepared field as its ordinal, token records, and text, present at most once in
|
|
297
|
+
* ascending field order.
|
|
298
|
+
* @returns Zero on success, three when a region needs room, eight when a count requires a new segment,
|
|
299
|
+
* or another positive core status on refusal. Every nonzero status leaves all regions unchanged.
|
|
300
|
+
*/
|
|
301
|
+
indexTerms(segment: NativeGrowingSegment, generation: number, ordinal: number, ...fields: readonly NativeFieldTokenArgument[]): number;
|
|
302
|
+
/**
|
|
303
|
+
* Removes one document's keyword counts, surfaces, spellings, and field lengths.
|
|
304
|
+
* @param segment - The writable keyword regions of one growing segment.
|
|
305
|
+
* @param generation - The segment's region generation, as {@link NativeSegmentCore.indexTerms} describes it.
|
|
306
|
+
* @param ordinal - The document ordinal, below the segment's capacity.
|
|
307
|
+
* @param fields - Each of the document's analysed fields as its ordinal, token records, and text, in
|
|
308
|
+
* ascending field order.
|
|
309
|
+
* @returns Zero on success, including an ordinal already retired, or a positive core status on refusal.
|
|
310
|
+
* Every refusal leaves all regions unchanged.
|
|
311
|
+
*/
|
|
312
|
+
removeDocument(segment: NativeGrowingSegment, generation: number, ordinal: number, ...fields: readonly NativeFieldTokenArgument[]): number;
|
|
313
|
+
/**
|
|
314
|
+
* Compacts retired posting rows before a batch of writes.
|
|
315
|
+
* @param segment - The writable keyword regions of one growing segment.
|
|
316
|
+
* @param generation - The segment's region generation, as {@link NativeSegmentCore.indexTerms} describes it.
|
|
317
|
+
* @returns Zero on success, or a positive core status with every region unchanged on refusal.
|
|
318
|
+
*/
|
|
319
|
+
beginBatch(segment: NativeGrowingSegment, generation: number): number;
|
|
320
|
+
/**
|
|
321
|
+
* Compacts retired posting rows after a batch while preserving live counts and retired ordinals.
|
|
322
|
+
* @param segment - The writable keyword regions of one growing segment.
|
|
323
|
+
* @param generation - The segment's region generation, as {@link NativeSegmentCore.indexTerms} describes it.
|
|
324
|
+
* @returns Zero on success, or a positive core status with every region unchanged on refusal.
|
|
325
|
+
*/
|
|
326
|
+
endBatch(segment: NativeGrowingSegment, generation: number): number;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The native operations that group hits and combine grouped search results.
|
|
331
|
+
*
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
interface NativeGroupCore {
|
|
335
|
+
/**
|
|
336
|
+
* Groups hits by stored field equality and orders groups by their first member's score and document ID.
|
|
337
|
+
*
|
|
338
|
+
* @param values - The stored fields in grouping order, all using the same ordinal space.
|
|
339
|
+
* @param ordinals - The stored ordinal at each input hit position, in final hit order.
|
|
340
|
+
* @param scores - The score at each input hit position, with zero for an absent score.
|
|
341
|
+
* @param idRanks - The document ID rank at each input hit position, in code point order.
|
|
342
|
+
* @param maxPerGroup - The maximum number of retained hits in each group.
|
|
343
|
+
* @param limit - The maximum number of groups, or null to retain every group.
|
|
344
|
+
* @param outHeads - Receives each group's first input hit position, including when maxPerGroup is zero.
|
|
345
|
+
* @param outOffsets - Receives each group's first retained hit offset and the terminal offset, or one zero for no groups.
|
|
346
|
+
* @param outHits - Receives the retained input hit positions in their incoming order within each group.
|
|
347
|
+
* @param outMembers - Receives each group's full member count before truncation.
|
|
348
|
+
* @returns The group count, or a negative core status that leaves inputs and output regions unchanged.
|
|
349
|
+
*/
|
|
350
|
+
groupHits(values: readonly NativeStoredValues[], ordinals: Uint32Array, scores: Float64Array, idRanks: Uint32Array, maxPerGroup: number, limit: number | null, outHeads: Uint32Array, outOffsets: Uint32Array, outHits: Uint32Array, outMembers: Uint32Array): number;
|
|
351
|
+
/**
|
|
352
|
+
* Merges each group's entries and orders groups by their first retained score and document ID.
|
|
353
|
+
*
|
|
354
|
+
* @param keys - Group identities in source-list order, with repeated identities combined.
|
|
355
|
+
* @param offsets - Each input group's first entry, followed by the total entry count.
|
|
356
|
+
* @param scores - Raw entry scores, or null when every score is absent.
|
|
357
|
+
* @param scorePresent - Bits marking present scores, or null when every supplied score is present.
|
|
358
|
+
* @param ranks - Cross-list entry ranks by sort values and document ID when sorted, or by document ID otherwise.
|
|
359
|
+
* @param idRanks - Cross-list document ID ranks in code point order.
|
|
360
|
+
* @param sorted - Whether ranks determine entry order independently of scores.
|
|
361
|
+
* @param maxPerGroup - The maximum number of entries retained in each group.
|
|
362
|
+
* @param limit - The maximum number of groups returned, or null to retain every group.
|
|
363
|
+
* @param outKeys - Receives the retained group identities in result order.
|
|
364
|
+
* @param outOffsets - Receives each output group's first entry and the final entry count, or one zero for no groups.
|
|
365
|
+
* @param outSources - Receives each retained entry's input group position.
|
|
366
|
+
* @param outIndices - Receives each retained entry's position within its input group.
|
|
367
|
+
* @returns The group count, or a negative core status that leaves inputs and output regions unchanged.
|
|
368
|
+
*/
|
|
369
|
+
mergeGroups(keys: Uint32Array, offsets: Uint32Array, scores: Float64Array | null, scorePresent: Uint32Array | null, ranks: Uint32Array, idRanks: Uint32Array, sorted: boolean, maxPerGroup: number, limit: number | null, outKeys: Uint32Array, outOffsets: Uint32Array, outSources: Uint32Array, outIndices: Uint32Array): number;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** An open read-only file that the core retains until its last operation finishes. @internal */
|
|
373
|
+
interface NativePagedFileHandle {
|
|
374
|
+
/** The stable identity that distinguishes this open file from every other handle. */
|
|
375
|
+
readonly identity: bigint;
|
|
376
|
+
/** The file length in bytes when the core opened it. */
|
|
377
|
+
readonly length: bigint;
|
|
378
|
+
}
|
|
379
|
+
/** The page storage and lookup regions that one searching thread owns. @internal */
|
|
380
|
+
interface NativePageCache {
|
|
381
|
+
/** The page slots, each occupying 65,536 bytes. */
|
|
382
|
+
bytes: Uint8Array;
|
|
383
|
+
/** The stable file identity of each slot, or zero for an unused slot. */
|
|
384
|
+
files: BigUint64Array;
|
|
385
|
+
/** The absolute section offset of each slot. */
|
|
386
|
+
offsets: BigUint64Array;
|
|
387
|
+
/** The page number within the section of each slot. */
|
|
388
|
+
pages: BigUint64Array;
|
|
389
|
+
/** The number of valid bytes in each slot. */
|
|
390
|
+
lengths: Uint32Array;
|
|
391
|
+
/** The expected CRC32 of each slot. */
|
|
392
|
+
checksums: Uint32Array;
|
|
393
|
+
}
|
|
394
|
+
/** The location and page checksums of one section in an open file. @internal */
|
|
395
|
+
interface NativePageSection {
|
|
396
|
+
/** The file that holds the section. */
|
|
397
|
+
file: NativePagedFileHandle;
|
|
398
|
+
/** The absolute byte offset from the start of the file. */
|
|
399
|
+
offset: bigint;
|
|
400
|
+
/** The section length in bytes. */
|
|
401
|
+
length: bigint;
|
|
402
|
+
/** The page length, either 16,384 or 65,536 bytes. */
|
|
403
|
+
pageBytes: number;
|
|
404
|
+
/** One little-endian uint32 CRC32 for each page. */
|
|
405
|
+
checksums: Uint8Array;
|
|
406
|
+
}
|
|
407
|
+
/** The vector rows and deletion bits of one file within a field. @internal */
|
|
408
|
+
interface NativePagedVectorFile {
|
|
409
|
+
/** The first global vector number in the file. */
|
|
410
|
+
first: number;
|
|
411
|
+
/** The number of vectors in the file. */
|
|
412
|
+
count: number;
|
|
413
|
+
/** The manifest's local deletion bits in bytes, or null when every vector is live. */
|
|
414
|
+
dead: Uint8Array | null;
|
|
415
|
+
/** The full-precision float32 vector rows. */
|
|
416
|
+
vectors: NativePageSection;
|
|
417
|
+
/** The packed OSQ records, or null for an unquantised field. */
|
|
418
|
+
records: NativePageSection | null;
|
|
419
|
+
}
|
|
420
|
+
/** The resident node metadata and paged neighbour lists of one graph part. @internal */
|
|
421
|
+
interface NativePagedGraphPart {
|
|
422
|
+
/** The first global vector number in the part. */
|
|
423
|
+
first: number;
|
|
424
|
+
/** The number of vector positions in the part. */
|
|
425
|
+
count: number;
|
|
426
|
+
/** Each node's number of layers, with zero for a missing node. */
|
|
427
|
+
levels: Uint8Array;
|
|
428
|
+
/** Each node's byte offset in neighbours, followed by the end of the last node. */
|
|
429
|
+
nodeOffsets: Uint32Array;
|
|
430
|
+
/** The counted uint32 neighbour lists. */
|
|
431
|
+
neighbours: NativePageSection;
|
|
432
|
+
}
|
|
433
|
+
/** The files and graph parts that describe one disk vector field. @internal */
|
|
434
|
+
interface NativePagedVectorField {
|
|
435
|
+
/** The number of float32 components in each vector. */
|
|
436
|
+
dimension: number;
|
|
437
|
+
/** Zero for cosine, one for dot product, or two for Euclidean distance. */
|
|
438
|
+
metric: number;
|
|
439
|
+
/** The number of vector positions across every file. */
|
|
440
|
+
total: number;
|
|
441
|
+
/** The first node to visit, or null to choose a node on the highest layer. */
|
|
442
|
+
entryPoint: number | null;
|
|
443
|
+
/** The highest permitted layer in the field. */
|
|
444
|
+
maxLayer: number;
|
|
445
|
+
/** The OSQ width and centroid, or null for full-precision traversal. */
|
|
446
|
+
codes: {
|
|
447
|
+
bits: number;
|
|
448
|
+
centroid: Float32Array;
|
|
449
|
+
} | null;
|
|
450
|
+
/** The vector files in gap-free global vector order. */
|
|
451
|
+
files: readonly NativePagedVectorFile[];
|
|
452
|
+
/** The graph parts in gap-free global vector order. */
|
|
453
|
+
graphParts: readonly NativePagedGraphPart[];
|
|
454
|
+
}
|
|
455
|
+
/** The resolved search settings and admission masks of a paged vector query. @internal */
|
|
456
|
+
interface NativePagedVectorRequest {
|
|
457
|
+
/** The finite float32 query components. */
|
|
458
|
+
query: Float32Array;
|
|
459
|
+
/** The result count before the host resolves document ID ties. */
|
|
460
|
+
k: number;
|
|
461
|
+
/** The number of candidates that the graph walk retains. */
|
|
462
|
+
ef: number;
|
|
463
|
+
/** The number of quantised candidates to score with full-precision vectors. */
|
|
464
|
+
rescoreDepth: number;
|
|
465
|
+
/** Whether the caller supplied a rescore window. */
|
|
466
|
+
explicitRescoreWindow: boolean;
|
|
467
|
+
/** The numeric score floor, including negative infinity. */
|
|
468
|
+
minSimilarity: number;
|
|
469
|
+
/** The admitted global vector numbers in uint32 words, or null for every live vector. */
|
|
470
|
+
accepted: Uint32Array | null;
|
|
471
|
+
/** The excluded global vector numbers in uint32 words, or null for none. */
|
|
472
|
+
excluded: Uint32Array | null;
|
|
473
|
+
}
|
|
474
|
+
/** The core operations that read checksummed pages and search disk vector fields. @internal */
|
|
475
|
+
interface NativePagedCore {
|
|
476
|
+
/**
|
|
477
|
+
* Opens an immutable file for positional reads.
|
|
478
|
+
* @param path - The path of the file to open.
|
|
479
|
+
* @returns The open handle, or a negative status when the file cannot be opened.
|
|
480
|
+
*/
|
|
481
|
+
openPagedFile(path: string): NativePagedFileHandle | number;
|
|
482
|
+
/**
|
|
483
|
+
* Releases an open handle after every operation that uses it has finished.
|
|
484
|
+
* @param file - The handle to close.
|
|
485
|
+
* @returns Zero on success, or a negative status for an invalid handle.
|
|
486
|
+
*/
|
|
487
|
+
closePagedFile(file: NativePagedFileHandle): number;
|
|
488
|
+
/**
|
|
489
|
+
* Copies one verified page into the supplied output.
|
|
490
|
+
* @param section - The file section to read.
|
|
491
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
492
|
+
* @param page - The page number within the section.
|
|
493
|
+
* @param output - Receives the page bytes only after its checksum passes.
|
|
494
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
495
|
+
* @returns Zero on success, or a negative status that leaves output unchanged.
|
|
496
|
+
*/
|
|
497
|
+
readPage(section: NativePageSection, cache: NativePageCache | null, page: bigint, output: Uint8Array, fault: BigUint64Array): number;
|
|
498
|
+
/**
|
|
499
|
+
* Reads a verified page on a background thread while retaining its file until completion.
|
|
500
|
+
* @param section - The file section, whose checksums the core copies before reading.
|
|
501
|
+
* @param cache - An exclusively held cache with shared buffers, or null.
|
|
502
|
+
* @param page - The page number within the section.
|
|
503
|
+
* @param output - Shared bytes that receive the page after its checksum passes.
|
|
504
|
+
* @param fault - Three shared uint64 words for the file identity, section offset, and page number.
|
|
505
|
+
* @returns Zero on success, or a negative status, immediately on refusal or after completion.
|
|
506
|
+
* A refusal leaves output unchanged.
|
|
507
|
+
*/
|
|
508
|
+
readPageAsync(section: NativePageSection, cache: NativePageCache | null, page: bigint, output: Uint8Array, fault: BigUint64Array): number | Promise<number>;
|
|
509
|
+
/**
|
|
510
|
+
* Copies a posting list after checking its pages, ordinals, fields, and order.
|
|
511
|
+
* @param section - The paged postings section.
|
|
512
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
513
|
+
* @param first - The list's first posting offset.
|
|
514
|
+
* @param count - The number of postings in the list.
|
|
515
|
+
* @param documents - The segment's document count.
|
|
516
|
+
* @param fields - The segment's field count.
|
|
517
|
+
* @param output - Receives little-endian document, frequency, and field columns, occupying eight bytes per posting.
|
|
518
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
519
|
+
* @returns Zero on success, or a negative status that leaves output unchanged.
|
|
520
|
+
*/
|
|
521
|
+
readPagedPostings(section: NativePageSection, cache: NativePageCache | null, first: number, count: number, documents: number, fields: number, output: Uint8Array, fault: BigUint64Array): number;
|
|
522
|
+
/**
|
|
523
|
+
* Reads a posting list's positions and rebases its offsets to the returned values.
|
|
524
|
+
* @param offsetSection - The section that holds absolute position offsets.
|
|
525
|
+
* @param valueSection - The section that holds the uint32 positions.
|
|
526
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
527
|
+
* @param first - The first posting whose positions to read.
|
|
528
|
+
* @param count - The number of postings to read.
|
|
529
|
+
* @param offsets - Receives count plus one offsets relative to values.
|
|
530
|
+
* @param values - Receives the positions after the core checks each posting's order.
|
|
531
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
532
|
+
* @returns Zero on success, or a negative status that leaves both output arrays unchanged.
|
|
533
|
+
*/
|
|
534
|
+
readPagedPositions(offsetSection: NativePageSection, valueSection: NativePageSection, cache: NativePageCache | null, first: number, count: number, offsets: Uint32Array, values: Uint32Array, fault: BigUint64Array): number;
|
|
535
|
+
/**
|
|
536
|
+
* Reads the sorted token and frequency pairs for one removed document.
|
|
537
|
+
* @param offsetSection - The section that holds the document offsets in uint32 words.
|
|
538
|
+
* @param valueSection - The section that holds token and frequency pairs.
|
|
539
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
540
|
+
* @param ordinal - The document ordinal within the segment.
|
|
541
|
+
* @param tokens - The segment's token count.
|
|
542
|
+
* @param values - Receives the token and frequency pairs after every check passes.
|
|
543
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
544
|
+
* @returns The number of uint32 words written, or a negative status that leaves values unchanged.
|
|
545
|
+
*/
|
|
546
|
+
readPagedRemovals(offsetSection: NativePageSection, valueSection: NativePageSection, cache: NativePageCache | null, ordinal: number, tokens: number, values: Uint32Array, fault: BigUint64Array): number;
|
|
547
|
+
/**
|
|
548
|
+
* Reads one document ID after checking its offsets, pages, and UTF-8 bytes.
|
|
549
|
+
* @param offsetSection - The uint32 offsets into the ID section.
|
|
550
|
+
* @param valueSection - The section that holds the UTF-8 IDs.
|
|
551
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
552
|
+
* @param ordinal - The document ordinal within the segment.
|
|
553
|
+
* @param output - Receives the ID bytes after every check passes.
|
|
554
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
555
|
+
* @returns The ID length in bytes, or a negative status that leaves output unchanged.
|
|
556
|
+
*/
|
|
557
|
+
readPagedId(offsetSection: NativePageSection, valueSection: NativePageSection, cache: NativePageCache | null, ordinal: number, output: Uint8Array, fault: BigUint64Array): number;
|
|
558
|
+
/**
|
|
559
|
+
* Reads one ordinal from an ID order after checking its page and document range.
|
|
560
|
+
* @param section - The section that holds one uint32 ordinal per document.
|
|
561
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
562
|
+
* @param position - The position within the ID order.
|
|
563
|
+
* @param documents - The segment's document count.
|
|
564
|
+
* @param output - Receives the ordinal in its first uint32 word.
|
|
565
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
566
|
+
* @returns Zero on success, or a negative status that leaves output unchanged.
|
|
567
|
+
*/
|
|
568
|
+
readPagedOrdinal(section: NativePageSection, cache: NativePageCache | null, position: number, documents: number, output: Uint32Array, fault: BigUint64Array): number;
|
|
569
|
+
/**
|
|
570
|
+
* Reads finite, non-negative term totals after checking every requested page.
|
|
571
|
+
* @param section - The section that holds one float64 total per token.
|
|
572
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
573
|
+
* @param first - The first token whose total to read.
|
|
574
|
+
* @param count - The number of consecutive totals to read.
|
|
575
|
+
* @param output - Receives the totals after every value passes validation.
|
|
576
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
577
|
+
* @returns Zero on success, or a negative status that leaves output unchanged.
|
|
578
|
+
*/
|
|
579
|
+
readPagedTotals(section: NativePageSection, cache: NativePageCache | null, first: number, count: number, output: Float64Array, fault: BigUint64Array): number;
|
|
580
|
+
/**
|
|
581
|
+
* Reads a document's sequence number and primary term after checking both pages.
|
|
582
|
+
* @param sequences - The section that holds the uint64 sequence numbers.
|
|
583
|
+
* @param terms - The section that holds the uint64 primary terms.
|
|
584
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
585
|
+
* @param ordinal - The document ordinal within the segment.
|
|
586
|
+
* @param output - Receives the sequence number and primary term in its first two words.
|
|
587
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
588
|
+
* @returns Zero on success, or a negative status that leaves output unchanged.
|
|
589
|
+
*/
|
|
590
|
+
readPagedWriteRecord(sequences: NativePageSection, terms: NativePageSection, cache: NativePageCache | null, ordinal: number, output: BigUint64Array, fault: BigUint64Array): number;
|
|
591
|
+
/**
|
|
592
|
+
* Searches a paged graph and retains every score tie at the requested cutoff.
|
|
593
|
+
* @param field - The resident metadata and open file sections.
|
|
594
|
+
* @param request - The query, resolved search settings, and admission masks.
|
|
595
|
+
* @param cache - The calling thread's page cache, or null to retain no pages.
|
|
596
|
+
* @param meter - The shared int64 work count followed by its cap.
|
|
597
|
+
* @param stop - One uint32 that becomes one when the search stops.
|
|
598
|
+
* @param deadline - One uint64 monotonic deadline, or zero for none.
|
|
599
|
+
* @param ordinals - Receives the selected global vector numbers.
|
|
600
|
+
* @param scores - Receives their relevance scores in descending score order.
|
|
601
|
+
* @param fault - Receives the file identity, section offset, and page number on a page failure.
|
|
602
|
+
* @returns The candidate count, or a negative status. Page failures, invalid arguments, allocation failures,
|
|
603
|
+
* and short outputs preserve both candidate arrays. A stop or work-cap status leaves their contents undefined.
|
|
604
|
+
*/
|
|
605
|
+
searchPagedVectors(field: NativePagedVectorField, request: NativePagedVectorRequest, cache: NativePageCache | null, meter: BigInt64Array, stop: Uint32Array, deadline: BigUint64Array, ordinals: Uint32Array, scores: Float64Array, fault: BigUint64Array): number;
|
|
606
|
+
/**
|
|
607
|
+
* Searches disk vectors on a background thread while retaining the file handles until completion.
|
|
608
|
+
* @param field - The resident metadata and open files, copied before the background search starts.
|
|
609
|
+
* @param request - The query and admission regions, copied before the background search starts.
|
|
610
|
+
* @param cache - An exclusively held cache whose regions use shared buffers, or null.
|
|
611
|
+
* @param meter - The shared int64 work count followed by its cap.
|
|
612
|
+
* @param stop - One shared uint32 that the caller can set atomically to stop the search.
|
|
613
|
+
* @param deadline - One uint64 monotonic deadline, copied before the background search starts.
|
|
614
|
+
* @param ordinals - A shared output region for selected global vector numbers.
|
|
615
|
+
* @param scores - A shared output region for their scores.
|
|
616
|
+
* @param fault - Three shared uint64 words for the file identity, section offset, and page number.
|
|
617
|
+
* @returns The candidate count or a negative status, immediately on refusal or after completion.
|
|
618
|
+
* Candidate output follows the same preservation rules as {@link NativePagedCore.searchPagedVectors}.
|
|
619
|
+
*/
|
|
620
|
+
searchPagedVectorsAsync(field: NativePagedVectorField, request: NativePagedVectorRequest, cache: NativePageCache | null, meter: BigInt64Array, stop: Uint32Array, deadline: BigUint64Array, ordinals: Uint32Array, scores: Float64Array, fault: BigUint64Array): number | Promise<number>;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/** The UTF-8 strings and stored counts of an immutable keyword table. @internal */
|
|
624
|
+
interface NativeFrozenStrings {
|
|
625
|
+
/** The concatenated UTF-8 text. */
|
|
626
|
+
text: Uint8Array;
|
|
627
|
+
/** The text boundaries, with two strings per surface entry and one per other entry. */
|
|
628
|
+
offsets: Uint32Array;
|
|
629
|
+
/** The stored count of each entry. */
|
|
630
|
+
counts: Uint32Array;
|
|
631
|
+
}
|
|
632
|
+
/** The optional reverse posting index for removing a frozen document. @internal */
|
|
633
|
+
interface NativeFrozenRemovalIndex {
|
|
634
|
+
/** Each document's first row reference, followed by the terminal reference count. */
|
|
635
|
+
starts: Uint32Array;
|
|
636
|
+
/** The posting row references, in ascending order within each document. */
|
|
637
|
+
rows: Uint32Array;
|
|
638
|
+
/** The sorted term ordinal for each payload slot. */
|
|
639
|
+
termOfSlot: Uint32Array;
|
|
640
|
+
}
|
|
641
|
+
/** The immutable keyword regions of a frozen segment. @internal */
|
|
642
|
+
interface NativeFrozenSegment {
|
|
643
|
+
/** The terms in code point order, with their stored document frequencies. */
|
|
644
|
+
terms: NativeFrozenStrings;
|
|
645
|
+
/** The posting slot for each sorted term ordinal. */
|
|
646
|
+
payloadSlots: Uint32Array;
|
|
647
|
+
/** Each payload slot's first posting, followed by the terminal posting count. */
|
|
648
|
+
postingOffsets: Uint32Array;
|
|
649
|
+
/** The document ordinal of each posting. */
|
|
650
|
+
postingDocuments: Uint32Array;
|
|
651
|
+
/** The capped term frequency of each posting. */
|
|
652
|
+
postingFrequencies: Uint16Array;
|
|
653
|
+
/** The field ordinal of each posting. */
|
|
654
|
+
postingFields: Uint16Array;
|
|
655
|
+
/** The surface and token pairs, or null when surfaces are absent. */
|
|
656
|
+
surfaces: NativeFrozenStrings | null;
|
|
657
|
+
/** The spellings in spelling and token order, or null when partial words are absent. */
|
|
658
|
+
spellings: NativeFrozenStrings | null;
|
|
659
|
+
/** The sorted term ordinal of each spelling, or an empty region when spellings are absent. */
|
|
660
|
+
spellingTokens: Uint32Array;
|
|
661
|
+
/** The reverse posting index, or null to scan the posting lists. */
|
|
662
|
+
removalIndex: NativeFrozenRemovalIndex | null;
|
|
663
|
+
/** One for each partial-word field and zero for every other field. */
|
|
664
|
+
partialFields: Uint8Array;
|
|
665
|
+
/** The number of document ordinals in this segment. */
|
|
666
|
+
documentCount: number;
|
|
667
|
+
}
|
|
668
|
+
/** The removal regions that one copy holds separately from a shared frozen segment. @internal */
|
|
669
|
+
interface NativeFrozenSegmentState {
|
|
670
|
+
/** The removed document ordinals in the uint32 bitset layout. */
|
|
671
|
+
tombstones: Uint32Array;
|
|
672
|
+
/** The single-word count of removed documents. */
|
|
673
|
+
tombstoneCount: Uint32Array;
|
|
674
|
+
/** The removed document count for each sorted term. */
|
|
675
|
+
removedDocuments: Uint32Array;
|
|
676
|
+
/** The removed capped term frequencies for each sorted term. */
|
|
677
|
+
removedOccurrences: Float64Array;
|
|
678
|
+
/** The removed occurrences of each surface entry. */
|
|
679
|
+
removedSurfaces: Uint32Array;
|
|
680
|
+
/** The removed occurrences of each spelling entry. */
|
|
681
|
+
removedSpellings: Uint32Array;
|
|
682
|
+
/** Eight words, holding the pending document count, the pending token count, and the pending unit count. */
|
|
683
|
+
pendingHeader: Uint32Array;
|
|
684
|
+
/** The tombstoned ordinals whose counts the removed regions do not hold yet, in removal order. */
|
|
685
|
+
pendingDocuments: Uint32Array;
|
|
686
|
+
/** Five words for each pending token: its field, term offset, term length, surface offset, and surface length. */
|
|
687
|
+
pendingTokens: Uint32Array;
|
|
688
|
+
/** The UTF-16 code units that the pending tokens point into. */
|
|
689
|
+
pendingUnits: Uint16Array;
|
|
690
|
+
}
|
|
691
|
+
/** The paged sections that hold the removal entries of a segment whose postings remain on disk. @internal */
|
|
692
|
+
interface NativeFrozenPagedRemovals {
|
|
693
|
+
/** The section that holds the first word of each document's removal entry. */
|
|
694
|
+
offsets: NativePageSection;
|
|
695
|
+
/** The section that holds each removal entry's sorted term and frequency pairs. */
|
|
696
|
+
values: NativePageSection;
|
|
697
|
+
/** The page cache of the calling thread, or null to read every page from the file. */
|
|
698
|
+
cache: NativePageCache | null;
|
|
699
|
+
/** Receives the file identity, section offset, and page number of a page that the core cannot read. */
|
|
700
|
+
fault: BigUint64Array;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* The regions of a {@link NativeFrozenSegment} and of its {@link NativeFrozenSegmentState}, as thirty positional
|
|
704
|
+
* arguments in the order that the native binding reads them, so that the binding looks up no property by name.
|
|
705
|
+
* An absent surface table, spelling table, or reverse posting index passes null in each of its positions.
|
|
706
|
+
* @internal
|
|
707
|
+
*/
|
|
708
|
+
type NativeFrozenRegionArguments = [
|
|
709
|
+
documentCount: number,
|
|
710
|
+
termText: Uint8Array,
|
|
711
|
+
termOffsets: Uint32Array,
|
|
712
|
+
termCounts: Uint32Array,
|
|
713
|
+
surfaceText: Uint8Array | null,
|
|
714
|
+
surfaceOffsets: Uint32Array | null,
|
|
715
|
+
surfaceCounts: Uint32Array | null,
|
|
716
|
+
spellingText: Uint8Array | null,
|
|
717
|
+
spellingOffsets: Uint32Array | null,
|
|
718
|
+
spellingCounts: Uint32Array | null,
|
|
719
|
+
payloadSlots: Uint32Array,
|
|
720
|
+
postingOffsets: Uint32Array,
|
|
721
|
+
postingDocuments: Uint32Array,
|
|
722
|
+
postingFrequencies: Uint16Array,
|
|
723
|
+
postingFields: Uint16Array,
|
|
724
|
+
partialFields: Uint8Array,
|
|
725
|
+
spellingTokens: Uint32Array,
|
|
726
|
+
removalStarts: Uint32Array | null,
|
|
727
|
+
removalRows: Uint32Array | null,
|
|
728
|
+
removalTermOfSlot: Uint32Array | null,
|
|
729
|
+
tombstones: Uint32Array,
|
|
730
|
+
tombstoneCount: Uint32Array,
|
|
731
|
+
removedDocuments: Uint32Array,
|
|
732
|
+
removedOccurrences: Float64Array,
|
|
733
|
+
removedSurfaces: Uint32Array,
|
|
734
|
+
removedSpellings: Uint32Array,
|
|
735
|
+
pendingHeader: Uint32Array,
|
|
736
|
+
pendingDocuments: Uint32Array,
|
|
737
|
+
pendingTokens: Uint32Array,
|
|
738
|
+
pendingUnits: Uint16Array
|
|
739
|
+
];
|
|
740
|
+
/** The operations that remove documents from immutable keyword segments. @internal */
|
|
741
|
+
interface NativeFrozenSegmentCore {
|
|
742
|
+
/**
|
|
743
|
+
* Prepares a frozen removal for publication after the host finishes the document's other changes.
|
|
744
|
+
* @param parameters - The segment's and the state's regions as {@link NativeFrozenRegionArguments}, then the
|
|
745
|
+
* document ordinal below the segment's document count, then the document's analysed tokens whose surface differs
|
|
746
|
+
* from their term or whose field is a partial field, grouped by ascending field ordinal. Then come the entries that
|
|
747
|
+
* receive a region kind and an element index for each changed value, where the kinds are 4 for tombstone words,
|
|
748
|
+
* 5 for the tombstone count, and 6 for pending header words, then the replacement values in the same order, and
|
|
749
|
+
* last the paged removal sections, or null for a segment that holds its postings in memory. The call writes the
|
|
750
|
+
* pending document and tokens past the pending counts, and it settles the pending regions first when they are full.
|
|
751
|
+
* @returns The number of changes, or a negative core status that leaves every region unchanged.
|
|
752
|
+
* The host must keep the publication write gate until it copies every prepared value into its region.
|
|
753
|
+
*/
|
|
754
|
+
prepareFrozenRemoval(...parameters: [
|
|
755
|
+
...NativeFrozenRegionArguments,
|
|
756
|
+
ordinal: number,
|
|
757
|
+
fields: readonly NativeFieldTokens[],
|
|
758
|
+
entries: Uint32Array,
|
|
759
|
+
values: Float64Array,
|
|
760
|
+
paged: NativeFrozenPagedRemovals | null
|
|
761
|
+
]): number;
|
|
762
|
+
/**
|
|
763
|
+
* Records one document's removal in the pending regions while preserving the shared segment regions.
|
|
764
|
+
* @param parameters - The segment's and the state's regions as {@link NativeFrozenRegionArguments}, then the
|
|
765
|
+
* document ordinal below the segment's document count, then the document's analysed tokens whose surface differs
|
|
766
|
+
* from their term or whose field is a partial field, grouped by ascending field ordinal, and last the paged removal
|
|
767
|
+
* sections, or null for a segment that holds its postings in memory. The core appends every token that it
|
|
768
|
+
* receives to the pending regions.
|
|
769
|
+
* @returns Zero on success, including an ordinal already removed, or a positive core status on refusal.
|
|
770
|
+
* Every refusal leaves the source and removal regions unchanged.
|
|
771
|
+
*/
|
|
772
|
+
removeFrozenDocument(...parameters: [
|
|
773
|
+
...NativeFrozenRegionArguments,
|
|
774
|
+
ordinal: number,
|
|
775
|
+
fields: readonly NativeFieldTokens[],
|
|
776
|
+
paged: NativeFrozenPagedRemovals | null
|
|
777
|
+
]): number;
|
|
778
|
+
/**
|
|
779
|
+
* Adds every pending removal to the removed regions and empties the pending regions.
|
|
780
|
+
* @param parameters - The segment's and the state's regions as {@link NativeFrozenRegionArguments}, then the paged
|
|
781
|
+
* removal sections, or null for a segment that holds its postings in memory.
|
|
782
|
+
* @returns Zero on success, or a positive core status that leaves every region unchanged.
|
|
783
|
+
*/
|
|
784
|
+
settleFrozenState(...parameters: [...NativeFrozenRegionArguments, paged: NativeFrozenPagedRemovals | null]): number;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** The frozen spelling index that narrows substring candidates. @internal */
|
|
788
|
+
interface NativeFrozenRuns {
|
|
789
|
+
/** Three Unicode code points per run, in ascending order. */
|
|
790
|
+
runs: Uint32Array;
|
|
791
|
+
/** The member offsets, including the terminal offset. */
|
|
792
|
+
offsets: Uint32Array;
|
|
793
|
+
/** The spelling ordinals of each run. */
|
|
794
|
+
members: Uint32Array;
|
|
795
|
+
}
|
|
796
|
+
/** The keyword and spelling regions of one partial-word source. @internal */
|
|
797
|
+
interface NativePartialSource {
|
|
798
|
+
/** The keyword regions and their current removal counts. */
|
|
799
|
+
segment: NativeExpansionSegment;
|
|
800
|
+
/** The frozen run index, or null for a growing source or an absent spelling table. */
|
|
801
|
+
runs: NativeFrozenRuns | null;
|
|
802
|
+
}
|
|
803
|
+
/** The analysed words and typo settings of one partial-word request. @internal */
|
|
804
|
+
interface NativePartialRequest {
|
|
805
|
+
/** The unstemmed word in UTF-16. */
|
|
806
|
+
written: Uint16Array;
|
|
807
|
+
/** The indexed query token in UTF-16. */
|
|
808
|
+
own: Uint16Array;
|
|
809
|
+
/** The edit distance whose matches must be excluded. */
|
|
810
|
+
tolerance: number;
|
|
811
|
+
/** The leading code points that a typo match must share. */
|
|
812
|
+
prefixLength: number;
|
|
813
|
+
}
|
|
814
|
+
/** The native operation that selects partial-word additions. @internal */
|
|
815
|
+
interface NativePartialExpansionCore {
|
|
816
|
+
/**
|
|
817
|
+
* Returns additions by partition document frequency and then code point order.
|
|
818
|
+
* Divides 50 additions among the first 50 requests whose written words have at least three code points.
|
|
819
|
+
* @param sources - Every keyword segment of the partition and its spelling index.
|
|
820
|
+
* @param requests - The analysed words in query order, including their typo exclusions.
|
|
821
|
+
* @param outStarts - Receives one offset per request and the terminal offset.
|
|
822
|
+
* @param outSegments - Receives the source segment index of each addition.
|
|
823
|
+
* @param outTokens - Receives the term ordinal in that source segment.
|
|
824
|
+
* @param outFactors - Receives each addition's binary64 factor.
|
|
825
|
+
* @returns The addition count, or a negative status that leaves every output unchanged.
|
|
826
|
+
*/
|
|
827
|
+
expandPartialWords(sources: readonly NativePartialSource[], requests: readonly NativePartialRequest[], outStarts: Uint32Array, outSegments: Uint32Array, outTokens: Uint32Array, outFactors: Float64Array): number;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/** The keyword regions and removal state of one query expansion source. @internal */
|
|
831
|
+
interface NativeExpansionSegment {
|
|
832
|
+
/** The mutable keyword regions, or null for a frozen source. */
|
|
833
|
+
growing: NativeGrowingSegment | null;
|
|
834
|
+
/** The immutable keyword regions, or null for a growing source. */
|
|
835
|
+
frozen: NativeFrozenSegment | null;
|
|
836
|
+
/** The frozen source's removal counts, or null for a growing source. */
|
|
837
|
+
state: NativeFrozenSegmentState | null;
|
|
838
|
+
/** The frozen term totals by payload slot, when the source keeps its postings on disk. */
|
|
839
|
+
occurrences?: Float64Array | null;
|
|
840
|
+
}
|
|
841
|
+
/** The native operations that expand analysed query words. @internal */
|
|
842
|
+
interface NativeExpansionCore extends NativePartialExpansionCore {
|
|
843
|
+
/**
|
|
844
|
+
* Returns term suggestions by document frequency and then code point order.
|
|
845
|
+
* @param segments - Every keyword segment of the partition and its current removal counts.
|
|
846
|
+
* @param typed - The unstemmed prefix in UTF-16.
|
|
847
|
+
* @param stemmed - The stemmed prefix, used in segments without surface forms.
|
|
848
|
+
* @param limit - The maximum number of suggestions.
|
|
849
|
+
* @param outTerms - Receives triples of source index, term ordinal, and document frequency.
|
|
850
|
+
* @param outStarts - Receives one spelling offset per suggestion and the terminal offset.
|
|
851
|
+
* @param outSpellings - Receives triples of source index, kind, and ordinal. Kind 0 identifies a token and kind 1 a surface form.
|
|
852
|
+
* @param outOccurrences - Receives each spelling's summed occurrence count, in spelling order.
|
|
853
|
+
* @returns The suggestion count, or a negative status that leaves every output unchanged.
|
|
854
|
+
*/
|
|
855
|
+
suggestTerms(segments: readonly NativeExpansionSegment[], typed: Uint16Array, stemmed: Uint16Array, limit: number, outTerms: Uint32Array, outStarts: Uint32Array, outSpellings: Uint32Array, outOccurrences: Float64Array): number;
|
|
856
|
+
/**
|
|
857
|
+
* Returns up to 50 completions by partition document frequency and then code point order.
|
|
858
|
+
* @param segments - Every keyword segment of the partition and its current removal counts.
|
|
859
|
+
* @param typed - The unstemmed last query word in UTF-16.
|
|
860
|
+
* @param stemmed - The stemmed last query word, used when the partition has no surface forms.
|
|
861
|
+
* @param own - The query token whose code point length determines each completion's factor.
|
|
862
|
+
* @param outSegments - Receives the source segment index of each completion.
|
|
863
|
+
* @param outTokens - Receives the term ordinal in that source segment.
|
|
864
|
+
* @param outFactors - Receives each completion's binary64 factor.
|
|
865
|
+
* @returns The completion count, or a negative status that leaves every output unchanged.
|
|
866
|
+
*/
|
|
867
|
+
expandPrefix(segments: readonly NativeExpansionSegment[], typed: Uint16Array, stemmed: Uint16Array, own: Uint16Array, outSegments: Uint32Array, outTokens: Uint32Array, outFactors: Float64Array): number;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* The typed regions of reduced sort values, indexed by ordinal or dictionary position.
|
|
872
|
+
*
|
|
873
|
+
* @internal
|
|
874
|
+
*/
|
|
875
|
+
interface NativeSortValues {
|
|
876
|
+
/** Marks missing, number, string, false, and true values with tags 0 through 4. */
|
|
877
|
+
kinds: Uint8Array;
|
|
878
|
+
/** Holds the finite number at each position whose tag is 1. */
|
|
879
|
+
numbers: Float64Array;
|
|
880
|
+
/** Holds the first UTF-16 unit of each string in units. */
|
|
881
|
+
textStart: Uint32Array;
|
|
882
|
+
/** Holds each string's UTF-16 length, covering at most 512 code points. */
|
|
883
|
+
textLength: Uint32Array;
|
|
884
|
+
/** Holds the UTF-16 units of the strings. */
|
|
885
|
+
units: Uint16Array;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* The current values and the last built order of one sort column.
|
|
889
|
+
*
|
|
890
|
+
* @internal
|
|
891
|
+
*/
|
|
892
|
+
interface NativeSortColumn {
|
|
893
|
+
/** Holds each ordinal's current reduced value. */
|
|
894
|
+
current: NativeSortValues;
|
|
895
|
+
/** Holds the distinct present values of the built order. */
|
|
896
|
+
values: NativeSortValues;
|
|
897
|
+
/** Holds each built ordinal's even dictionary rank, or -1 for missing. */
|
|
898
|
+
ranks: Int32Array;
|
|
899
|
+
/** Holds the built present ordinals in ascending rank order. */
|
|
900
|
+
ordered: Uint32Array;
|
|
901
|
+
/** Marks the ordinals whose current values differ from the built order. */
|
|
902
|
+
dirty: Uint32Array;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Reductions of stored fields for sorting.
|
|
906
|
+
*
|
|
907
|
+
* @internal
|
|
908
|
+
*/
|
|
909
|
+
interface NativeSortCore {
|
|
910
|
+
/**
|
|
911
|
+
* Selects ordinals by each field's rank and current value, retaining every cutoff tie.
|
|
912
|
+
*
|
|
913
|
+
* @param columns - The sort columns in field priority order.
|
|
914
|
+
* @param directions - One direction per column, with 0 for ascending and 1 for descending.
|
|
915
|
+
* @param filter - The bitmap of ordinals that pass the filter.
|
|
916
|
+
* @param live - The bitmap of live document ordinals.
|
|
917
|
+
* @param limit - The requested ordinal count before retaining equal sort keys.
|
|
918
|
+
* @param anchorRanks - One rank per anchor field, or null for no anchor.
|
|
919
|
+
* @param anchorValues - One reduced value per anchor field, or null with no anchor ranks.
|
|
920
|
+
* @param output - Receives the selected ordinals, including keys equal to the anchor.
|
|
921
|
+
* @returns The selected count, or a negative status with the output unchanged. The caller orders equal keys by document ID and removes IDs at or before an equal anchor.
|
|
922
|
+
*/
|
|
923
|
+
sortSelect(columns: readonly NativeSortColumn[], directions: Uint8Array, filter: Uint32Array, live: Uint32Array, limit: number, anchorRanks: Int32Array | null, anchorValues: NativeSortValues | null, output: Uint32Array): number;
|
|
924
|
+
/**
|
|
925
|
+
* Selects live values within text bounds in folded and raw sort order.
|
|
926
|
+
*
|
|
927
|
+
* @param column - The current values and built order of the field.
|
|
928
|
+
* @param lower - The lower UTF-16 bound, or null for no lower bound.
|
|
929
|
+
* @param lowerInclusive - Whether a value equal to the lower bound qualifies.
|
|
930
|
+
* @param upper - The upper UTF-16 bound, or null for no upper bound.
|
|
931
|
+
* @param upperInclusive - Whether a value equal to the upper bound qualifies.
|
|
932
|
+
* @param live - The bitmap of live ordinals in the current values.
|
|
933
|
+
* @param output - Receives the matching ordinals, with padding bits cleared.
|
|
934
|
+
* @returns 0 on success, or a negative status with the output unchanged.
|
|
935
|
+
*/
|
|
936
|
+
textRange(column: NativeSortColumn, lower: Uint16Array | null, lowerInclusive: boolean, upper: Uint16Array | null, upperInclusive: boolean, live: Uint32Array, output: Uint32Array): number;
|
|
937
|
+
/**
|
|
938
|
+
* Builds an ascending dictionary and ranks for the live sort values.
|
|
939
|
+
*
|
|
940
|
+
* @param current - The current values, indexed by document ordinal.
|
|
941
|
+
* @param live - The bitmap of live document ordinals.
|
|
942
|
+
* @param values - Receives the distinct present values in ascending order.
|
|
943
|
+
* @param ranks - Receives each ordinal's even dictionary rank, or -1 for missing and dead ordinals.
|
|
944
|
+
* @param ordered - Receives the live present ordinals in rank order, with equal values in ordinal order.
|
|
945
|
+
* @param dirty - Receives cleared words through the current ordinal capacity.
|
|
946
|
+
* @param counts - Receives the distinct-value count and present-ordinal count in its first two entries.
|
|
947
|
+
* @returns 0 on success, or a negative status with every output region unchanged.
|
|
948
|
+
*/
|
|
949
|
+
buildSortOrder(current: NativeSortValues, live: Uint32Array, values: NativeSortValues, ranks: Int32Array, ordered: Uint32Array, dirty: Uint32Array, counts: Uint32Array): number;
|
|
950
|
+
/**
|
|
951
|
+
* Reduces a stored field to its sort value under the requested array mode.
|
|
952
|
+
*
|
|
953
|
+
* @param values - The eight typed regions of the stored field.
|
|
954
|
+
* @param ordinal - The document's position in the field regions.
|
|
955
|
+
* @param mode - 0 for min, 1 for max, 2 for avg, or 3 for median. Scalar fields bypass array reduction.
|
|
956
|
+
* @param outNumber - Receives a numeric result in its first entry, with capacity for at least one entry.
|
|
957
|
+
* @param outText - Receives a string's start and UTF-16 length in values.units, with capacity for at least two entries.
|
|
958
|
+
* @returns 0 for missing, 1 for number, 2 for string, 3 for false, or 4 for true. A negative status leaves both output regions unchanged. Missing and boolean results also leave both regions unchanged.
|
|
959
|
+
*/
|
|
960
|
+
sortValue(values: NativeStoredValues, ordinal: number, mode: number, outNumber: Float64Array, outText: Uint32Array): number;
|
|
961
|
+
}
|
|
962
|
+
|
|
87
963
|
/**
|
|
88
964
|
* Creates a search engine that runs inside your process, with no server to
|
|
89
965
|
* provision.
|
|
@@ -102,22 +978,92 @@ declare function getStopWords(name: string): StopWordOverride;
|
|
|
102
978
|
declare function createNarsil(config?: NarsilConfig): Promise<Narsil>;
|
|
103
979
|
|
|
104
980
|
/**
|
|
105
|
-
*
|
|
106
|
-
* create and load an index with a field whose type includes `partial`.
|
|
981
|
+
* Sets how many normalised tokens the engine keeps cached.
|
|
107
982
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
983
|
+
* Normalising a token costs the same work every time the same word arrives, so
|
|
984
|
+
* the engine remembers the result. It sizes the cache from the host's memory
|
|
985
|
+
* on start-up; raise it for a corpus with a large vocabulary, and lower it on
|
|
986
|
+
* a memory-tight host.
|
|
112
987
|
*
|
|
113
|
-
* @param
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* other object.
|
|
988
|
+
* @param maxSize - Entries to keep. Zero switches the cache off.
|
|
989
|
+
* @throws A `NarsilError` with `CONFIG_INVALID` for a negative or non-finite
|
|
990
|
+
* size.
|
|
117
991
|
*
|
|
118
992
|
* @public
|
|
119
993
|
*/
|
|
120
|
-
declare function
|
|
994
|
+
declare function configureNormalizationCache(maxSize: number): void;
|
|
995
|
+
/**
|
|
996
|
+
* Empties the normalisation cache while keeping the size you configured.
|
|
997
|
+
*
|
|
998
|
+
* Call it to release the memory the cache holds after a large load, or after
|
|
999
|
+
* registering a language module that normalises differently from the one whose
|
|
1000
|
+
* results are cached.
|
|
1001
|
+
*
|
|
1002
|
+
* @public
|
|
1003
|
+
*/
|
|
1004
|
+
declare function clearNormalizationCache(): void;
|
|
1005
|
+
/**
|
|
1006
|
+
* Empties the normalisation cache and returns its size to the value the engine
|
|
1007
|
+
* derives from the host's memory, undoing
|
|
1008
|
+
* {@link configureNormalizationCache}.
|
|
1009
|
+
*
|
|
1010
|
+
* @public
|
|
1011
|
+
*/
|
|
1012
|
+
declare function resetNormalizationCache(): void;
|
|
1013
|
+
/**
|
|
1014
|
+
* Returns the number of normalised tokens the cache currently holds, which is
|
|
1015
|
+
* what you watch to decide whether the configured size fits your vocabulary.
|
|
1016
|
+
*
|
|
1017
|
+
* @returns Entries held, across every language.
|
|
1018
|
+
*
|
|
1019
|
+
* @public
|
|
1020
|
+
*/
|
|
1021
|
+
declare function getNormalizationCacheSize(): number;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* A typed region of a field index, stored values, or a pattern index.
|
|
1025
|
+
*
|
|
1026
|
+
* @internal
|
|
1027
|
+
*/
|
|
1028
|
+
type NativeFieldMergeRegion = Uint8Array | Uint16Array | Uint32Array | Float64Array | BigUint64Array;
|
|
1029
|
+
/**
|
|
1030
|
+
* One source field and its document mapping.
|
|
1031
|
+
*
|
|
1032
|
+
* @internal
|
|
1033
|
+
*/
|
|
1034
|
+
interface NativeFieldMergeSource {
|
|
1035
|
+
/** Each source ordinal's target, or 0xFFFFFFFF for a dropped document. */
|
|
1036
|
+
mapping: Uint32Array;
|
|
1037
|
+
/** The field's regions in the order that the merge kind defines. */
|
|
1038
|
+
regions: readonly NativeFieldMergeRegion[];
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* The operations that combine field regions across segments.
|
|
1042
|
+
*
|
|
1043
|
+
* @internal
|
|
1044
|
+
*/
|
|
1045
|
+
interface NativeFieldMergeCore {
|
|
1046
|
+
/**
|
|
1047
|
+
* Measures the regions of one merged field after document remapping.
|
|
1048
|
+
*
|
|
1049
|
+
* @param kind - 1 numeric, 2 boolean, 3 enum, 4 geo, 5 stored values, or 6 pattern.
|
|
1050
|
+
* @param sources - The source fields and disjoint mappings that cover the target ordinals. Numeric regions contain values and ordinals; boolean regions contain true and false bitmaps; enum regions contain units, text offsets, posting offsets, postings, and suffix order; geo regions contain codes, latitudes, longitudes, and ordinals; stored regions contain shapes, starts, kinds, numbers, text starts, text lengths, units, and bytes; pattern regions contain present ordinals, runs, offsets, and postings.
|
|
1051
|
+
* @param documentCount - The number of target documents.
|
|
1052
|
+
* @param sizes - Receives eight region lengths in elements, with unused entries set to zero.
|
|
1053
|
+
* @returns 0 on success, or an existing positive status that leaves all supplied regions unchanged.
|
|
1054
|
+
*/
|
|
1055
|
+
measureFieldMerge(kind: number, sources: readonly NativeFieldMergeSource[], documentCount: number, sizes: Uint32Array): number;
|
|
1056
|
+
/**
|
|
1057
|
+
* Writes the merged field into the measured target regions.
|
|
1058
|
+
*
|
|
1059
|
+
* @param kind - The field kind used by {@link NativeFieldMergeCore.measureFieldMerge}.
|
|
1060
|
+
* @param sources - The source regions and document mappings used for measurement.
|
|
1061
|
+
* @param documentCount - The number of target documents.
|
|
1062
|
+
* @param output - The target regions in source-region order, each with the measured capacity and no overlap with another target or an input.
|
|
1063
|
+
* @returns 0 on success, 3 when a target is too short, or another existing positive status; every refusal leaves all supplied regions unchanged.
|
|
1064
|
+
*/
|
|
1065
|
+
writeFieldMerge(kind: number, sources: readonly NativeFieldMergeSource[], documentCount: number, output: readonly NativeFieldMergeRegion[]): number;
|
|
1066
|
+
}
|
|
121
1067
|
|
|
122
1068
|
/**
|
|
123
1069
|
* This makes pattern search available to every index whose schema declares a
|
|
@@ -137,65 +1083,907 @@ declare function registerPartialWordSearch(module: PartialWordSearch): void;
|
|
|
137
1083
|
*/
|
|
138
1084
|
declare function registerPatternSearch(module: PatternSearch): void;
|
|
139
1085
|
|
|
1086
|
+
/** The keyword regions and selected ordinals of one merge source. @internal */
|
|
1087
|
+
interface NativeKeywordMergeInput {
|
|
1088
|
+
/** The growing keyword regions, when the source uses mutable slices. Frozen posting columns are ignored. */
|
|
1089
|
+
growing?: NativeGrowingSegment | null;
|
|
1090
|
+
/** The UTF-8 terms and their stored document counts. */
|
|
1091
|
+
terms: NativeFrozenStrings;
|
|
1092
|
+
/** The posting slot of each term. */
|
|
1093
|
+
payloadSlots: Uint32Array;
|
|
1094
|
+
/** The first posting of each slot, followed by the terminal posting count. */
|
|
1095
|
+
postingOffsets: Uint32Array;
|
|
1096
|
+
/** The source document ordinal of each posting. */
|
|
1097
|
+
postingDocuments: Uint32Array;
|
|
1098
|
+
/** The capped frequency of each posting. */
|
|
1099
|
+
postingFrequencies: Uint16Array;
|
|
1100
|
+
/** The source field ordinal of each posting. */
|
|
1101
|
+
postingFields: Uint16Array;
|
|
1102
|
+
/** The first position of each posting and the terminal count, or null without positions. */
|
|
1103
|
+
positionOffsets: Uint32Array | null;
|
|
1104
|
+
/** The position values, or null without positions. */
|
|
1105
|
+
positionValues: Uint32Array | null;
|
|
1106
|
+
/** The target ordinal of each source document, or UINT32_MAX for a dropped document. */
|
|
1107
|
+
mapping: Uint32Array;
|
|
1108
|
+
/** The target field ordinal of each source field. */
|
|
1109
|
+
fieldMapping: Uint16Array;
|
|
1110
|
+
/** The source field length columns, with null for a field without lengths. */
|
|
1111
|
+
fieldLengths: readonly (Uint32Array | null)[];
|
|
1112
|
+
/** The number of source document ordinals. */
|
|
1113
|
+
documentCount: number;
|
|
1114
|
+
/** The surface and token pairs, with counts already restricted to the selected documents. */
|
|
1115
|
+
surfaces: NativeFrozenStrings | null;
|
|
1116
|
+
/** The spelling and token pairs, with counts already restricted to the selected documents. */
|
|
1117
|
+
spellings: NativeFrozenStrings | null;
|
|
1118
|
+
}
|
|
1119
|
+
/** The caller-owned columns that receive one merged keyword segment. @internal */
|
|
1120
|
+
interface NativeKeywordMergeOutput {
|
|
1121
|
+
/** The terms in code point order, with their live document counts. */
|
|
1122
|
+
terms: NativeFrozenStrings;
|
|
1123
|
+
/** The first posting of each term and the terminal posting count. */
|
|
1124
|
+
postingOffsets: Uint32Array;
|
|
1125
|
+
/** The target document ordinal of each posting, ascending within each term. */
|
|
1126
|
+
postingDocuments: Uint32Array;
|
|
1127
|
+
/** The unchanged capped posting frequencies. */
|
|
1128
|
+
postingFrequencies: Uint16Array;
|
|
1129
|
+
/** The target field ordinals, preserving the source order within each document. */
|
|
1130
|
+
postingFields: Uint16Array;
|
|
1131
|
+
/** The position boundaries, or null when every source omits positions. */
|
|
1132
|
+
positionOffsets: Uint32Array | null;
|
|
1133
|
+
/** The unchanged posting positions, or null when every source omits positions. */
|
|
1134
|
+
positionValues: Uint32Array | null;
|
|
1135
|
+
/** The merged field length columns in field-major order. */
|
|
1136
|
+
fieldLengths: Uint32Array;
|
|
1137
|
+
/** The length total of each target field. */
|
|
1138
|
+
totalFieldLengths: Float64Array;
|
|
1139
|
+
/** The merged surface and token pairs in surface order. */
|
|
1140
|
+
surfaces: NativeFrozenStrings;
|
|
1141
|
+
/** The merged spelling and token pairs in spelling and token order. */
|
|
1142
|
+
spellings: NativeFrozenStrings;
|
|
1143
|
+
}
|
|
1144
|
+
/** The columns that receive a merged paged posting list. @internal */
|
|
1145
|
+
interface NativePostingMergeOutput {
|
|
1146
|
+
/** The target document ordinals in ascending order. */
|
|
1147
|
+
documents: Uint32Array;
|
|
1148
|
+
/** The unchanged frequencies, with the same capacity as documents. */
|
|
1149
|
+
frequencies: Uint16Array;
|
|
1150
|
+
/** The mapped fields in ascending order within each document, with the same capacity as documents. */
|
|
1151
|
+
fields: Uint16Array;
|
|
1152
|
+
/** The first position of each output row, followed by the terminal position count. */
|
|
1153
|
+
positionOffsets: Uint32Array;
|
|
1154
|
+
/** The unchanged positions of the retained rows. */
|
|
1155
|
+
positions: Uint32Array;
|
|
1156
|
+
/** Receives the distinct document count and the total frequency in its first two entries. */
|
|
1157
|
+
totals: Float64Array;
|
|
1158
|
+
}
|
|
1159
|
+
/** The operations that measure and write immutable keyword merges. @internal */
|
|
1160
|
+
interface NativeSegmentMergeCore {
|
|
1161
|
+
/**
|
|
1162
|
+
* Remaps and orders the selected posting rows by target document and field for paged storage.
|
|
1163
|
+
* @param inputs - Frozen source rows for one term, with document and field mappings.
|
|
1164
|
+
* @param documentCount - The target document count.
|
|
1165
|
+
* @param fieldCount - The target field count, at most 65,536.
|
|
1166
|
+
* @param output - The writable columns. Position offsets need one more entry than the retained row count.
|
|
1167
|
+
* @returns The retained row count, or a negative status that leaves every output unchanged.
|
|
1168
|
+
*/
|
|
1169
|
+
mergePostings(inputs: readonly NativeKeywordMergeInput[], documentCount: number, fieldCount: number, output: NativePostingMergeOutput): number;
|
|
1170
|
+
/**
|
|
1171
|
+
* Measures the regions needed by a keyword merge without changing its sources.
|
|
1172
|
+
* @param inputs - The source columns, document mappings, and prepared surface and spelling counts.
|
|
1173
|
+
* @param documentCount - The target document count. Kept mappings must cover each target ordinal exactly once.
|
|
1174
|
+
* @param fieldCount - The target field count, at most 65,536.
|
|
1175
|
+
* @param sizes - Receives nine uint32 values: term count, term bytes, posting count, position count,
|
|
1176
|
+
* position presence, surface count, surface bytes, spelling count, and spelling bytes.
|
|
1177
|
+
* @param retainedTerms - The completed paged term table, when merging metadata after streaming postings.
|
|
1178
|
+
* Sources must then have empty term and posting regions. The output includes this table and no postings.
|
|
1179
|
+
* @returns Zero on success, eight when a surface or spelling count requires split outputs,
|
|
1180
|
+
* or another positive core status. Every refusal leaves all regions unchanged.
|
|
1181
|
+
*/
|
|
1182
|
+
measureMerge(inputs: readonly NativeKeywordMergeInput[], documentCount: number, fieldCount: number, sizes: Uint32Array, retainedTerms?: NativeFrozenStrings | null): number;
|
|
1183
|
+
/**
|
|
1184
|
+
* Writes a merged keyword segment into the supplied regions.
|
|
1185
|
+
* @param inputs - The unchanged sources and mappings used for measurement.
|
|
1186
|
+
* @param documentCount - The target document count.
|
|
1187
|
+
* @param fieldCount - The target field count.
|
|
1188
|
+
* @param output - The writable regions, with capacities obtained from measureMerge.
|
|
1189
|
+
* @param retainedTerms - The completed paged term table supplied to measureMerge, or null for a full merge.
|
|
1190
|
+
* @returns Zero on success, three for a short region, eight when a count requires split outputs,
|
|
1191
|
+
* or another positive core status. Every refusal leaves all regions unchanged.
|
|
1192
|
+
*/
|
|
1193
|
+
writeMerge(inputs: readonly NativeKeywordMergeInput[], documentCount: number, fieldCount: number, output: NativeKeywordMergeOutput, retainedTerms?: NativeFrozenStrings | null): number;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
140
1196
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
1197
|
+
* A set of stop words that the native search core holds, which an analysis call takes in place of the
|
|
1198
|
+
* language's own list.
|
|
143
1199
|
*
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
1200
|
+
* @internal
|
|
1201
|
+
*/
|
|
1202
|
+
type NativeStopWordSetHandle = object;
|
|
1203
|
+
/**
|
|
1204
|
+
* The text analysis operations of the native search core, which split, normalise, and stem text for every
|
|
1205
|
+
* language module that the package ships.
|
|
147
1206
|
*
|
|
148
|
-
* @
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1207
|
+
* @internal
|
|
1208
|
+
*/
|
|
1209
|
+
interface NativeAnalysisCore {
|
|
1210
|
+
/** Returns the number of language modules that the core analyses. */
|
|
1211
|
+
languageCount(): number;
|
|
1212
|
+
/**
|
|
1213
|
+
* Returns the name of one of the core's language modules.
|
|
1214
|
+
*
|
|
1215
|
+
* @param language - The module's index, from 0 up to {@link NativeAnalysisCore.languageCount}.
|
|
1216
|
+
* @returns The name that the module registers under.
|
|
1217
|
+
*/
|
|
1218
|
+
languageName(language: number): string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Returns the revision of one of the core's language modules, which equals the revision of the TypeScript
|
|
1221
|
+
* module with the same name.
|
|
1222
|
+
*
|
|
1223
|
+
* @param language - The module's index.
|
|
1224
|
+
* @returns The module's revision.
|
|
1225
|
+
*/
|
|
1226
|
+
languageRevision(language: number): string;
|
|
1227
|
+
/**
|
|
1228
|
+
* Returns the stop words of one of the core's language modules.
|
|
1229
|
+
*
|
|
1230
|
+
* @param language - The module's index.
|
|
1231
|
+
* @returns Every stop word of the module, in code unit order.
|
|
1232
|
+
*/
|
|
1233
|
+
languageStopWords(language: number): string[];
|
|
1234
|
+
/**
|
|
1235
|
+
* Gives the core a set of stop words for later analysis calls.
|
|
1236
|
+
*
|
|
1237
|
+
* @param words - The stop words.
|
|
1238
|
+
* @returns The handle that an analysis call takes, which the core releases once nothing refers to it.
|
|
1239
|
+
*/
|
|
1240
|
+
createStopWordSet(words: string[]): NativeStopWordSetHandle;
|
|
1241
|
+
/**
|
|
1242
|
+
* Splits a text into tokens and analyses each one.
|
|
1243
|
+
*
|
|
1244
|
+
* @param language - The index of the language module to analyse with.
|
|
1245
|
+
* @param flags - The analysis steps to take, as bits from the core's header.
|
|
1246
|
+
* @param text - The text.
|
|
1247
|
+
* @param stopWords - The stop words to remove, or `null` for the module's own list.
|
|
1248
|
+
* @param records - The array that receives the token count in its first entry and then eight entries for
|
|
1249
|
+
* each token: its position, the offset and length of its term, the offset and length of its surface form
|
|
1250
|
+
* (an offset of 0xffffffff where it has none), the offset and length of its original spelling, and its cache slot.
|
|
1251
|
+
* @returns The text that every offset points into, `null` where `records` holds too few entries for every
|
|
1252
|
+
* token (its first entry then holds the token count), or a negative status code from the core's header.
|
|
1253
|
+
*/
|
|
1254
|
+
analyse(language: number, flags: number, text: string, stopWords: NativeStopWordSetHandle | null, records: Uint32Array): string | number | null;
|
|
1255
|
+
/**
|
|
1256
|
+
* Splits a text into tokens and packs them for a keyword write into the caller's buffers, so a caller can reuse
|
|
1257
|
+
* the same two buffers for every text.
|
|
1258
|
+
*
|
|
1259
|
+
* @param language - The index of the language module to analyse with.
|
|
1260
|
+
* @param flags - The analysis steps to take, as bits from the core's header.
|
|
1261
|
+
* @param text - The text.
|
|
1262
|
+
* @param stopWords - The stop words to remove, or `null` for the module's own list.
|
|
1263
|
+
* @param records - At least two entries, filled with the token count and then eight words for each token, laid
|
|
1264
|
+
* out as {@link NativeAnalysisCore.analyse} lays them out, with offsets into `units`, zero original-spelling
|
|
1265
|
+
* words, and a cache slot of 0xffffffff.
|
|
1266
|
+
* @param units - The array that receives the term and surface text of every token.
|
|
1267
|
+
* @returns The number of units written, `null` where either array holds too few entries (the first entry of
|
|
1268
|
+
* `records` then holds the token count and the second the number of units needed), or a negative status code
|
|
1269
|
+
* from the core's header.
|
|
1270
|
+
*/
|
|
1271
|
+
analysePacked(language: number, flags: number, text: string, stopWords: NativeStopWordSetHandle | null, records: Uint32Array, units: Uint16Array): number | null;
|
|
1272
|
+
/**
|
|
1273
|
+
* Normalises and stems one token without splitting it.
|
|
1274
|
+
*
|
|
1275
|
+
* @param language - The index of the language module to analyse with.
|
|
1276
|
+
* @param flags - The stem and diacritic bits from the core's header.
|
|
1277
|
+
* @param token - The token.
|
|
1278
|
+
* @returns The transformed token, or a negative status code from the core's header.
|
|
1279
|
+
*/
|
|
1280
|
+
transform(language: number, flags: number, token: string): string | number;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* The keyword scoring operation of the native search core, which scores the documents of one segment by BM25
|
|
1285
|
+
* from posting lists that the engine describes as offsets into the segment's posting arrays.
|
|
152
1286
|
*
|
|
153
|
-
* @
|
|
1287
|
+
* @internal
|
|
154
1288
|
*/
|
|
155
|
-
|
|
1289
|
+
interface NativeKeywordCore {
|
|
1290
|
+
/**
|
|
1291
|
+
* Scores the documents of one segment for a keyword query and writes the best of them, best first, into
|
|
1292
|
+
* buffers that the caller owns.
|
|
1293
|
+
*
|
|
1294
|
+
* @param poolDocIds - The document ordinals of every posting that the segment holds.
|
|
1295
|
+
* @param poolFrequencies - The term frequency of each of those postings.
|
|
1296
|
+
* @param poolFields - The field index of each of those postings.
|
|
1297
|
+
* @param rowDocIds - The document ordinals of the rows that the engine copied for this query.
|
|
1298
|
+
* @param rowFrequencies - The frequency of each copied row, which can pass 65,535 for a synonym row.
|
|
1299
|
+
* @param rowFields - The field index of each copied row.
|
|
1300
|
+
* @param slots - Four numbers per slot: its kind, its query term, the end of its lists, and the end of its values.
|
|
1301
|
+
* @param lists - Three numbers per list: its flags, its first posting, and its posting count.
|
|
1302
|
+
* @param listValues - Two numbers per list: its document frequency, or its factor and its partial factor.
|
|
1303
|
+
* @param slotValues - The document frequency of each group, and the document frequencies of each phrase.
|
|
1304
|
+
* @param searchable - 1 for each field that the query searches, and 0 for each other field.
|
|
1305
|
+
* @param partialMarks - 1 for each field that partial-word search covers, and 0 for each other field.
|
|
1306
|
+
* @param nameRanks - The position of each field's name in code point order.
|
|
1307
|
+
* @param fieldNumbers - Four columns of one number per field: the boost, the average length, `k1`, and `b`.
|
|
1308
|
+
* @param lengths - The length column of each field, or null for a field that records no lengths.
|
|
1309
|
+
* @param filter - The ordinals that the query's filters keep, or null for every ordinal.
|
|
1310
|
+
* @param live - The ordinals of the segment's live documents.
|
|
1311
|
+
* @param removed - The ordinals whose rows the segment retired or tombstoned.
|
|
1312
|
+
* @param settings - The slot count, term count, capacity, document count, term match, anchor, limit, minimum score, and collect flag.
|
|
1313
|
+
* @param ordinals - Receives the ordinals of the documents that the call returns, one place per ordinal of the capacity.
|
|
1314
|
+
* @param scores - Receives the score of each returned ordinal.
|
|
1315
|
+
* @param matched - Receives every kept ordinal where the settings ask for them.
|
|
1316
|
+
* @param outcome - Receives the count of returned ordinals and the count of kept ordinals, followed, when it has a
|
|
1317
|
+
* third place, by how the core scored the segment: 0 in full, 1 by pruning, and 2 in full after a pruning check failed.
|
|
1318
|
+
* @returns 0 when the call scored the segment, or the core's status code when it refused the request.
|
|
1319
|
+
*/
|
|
1320
|
+
keywordScore(poolDocIds: Uint32Array, poolFrequencies: Uint16Array, poolFields: Uint16Array, rowDocIds: Uint32Array, rowFrequencies: Float64Array, rowFields: Uint16Array, slots: Uint32Array, lists: Uint32Array, listValues: Float64Array, slotValues: Float64Array, searchable: Uint8Array, partialMarks: Uint8Array, nameRanks: Uint16Array, fieldNumbers: Float64Array, lengths: ReadonlyArray<Uint32Array | null>, filter: Uint32Array | null, live: Uint32Array, removed: Uint32Array, settings: Float64Array, ordinals: Int32Array, scores: Float64Array, matched: Uint32Array, outcome: Float64Array): number;
|
|
1321
|
+
}
|
|
156
1322
|
|
|
157
1323
|
/**
|
|
158
|
-
*
|
|
1324
|
+
* The native operations that count field values and combine facet counts.
|
|
159
1325
|
*
|
|
160
|
-
*
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
1326
|
+
* @internal
|
|
1327
|
+
*/
|
|
1328
|
+
interface NativeFacetCore {
|
|
1329
|
+
/**
|
|
1330
|
+
* Counts matched documents once per range using stored numbers and direct numeric array elements.
|
|
1331
|
+
*
|
|
1332
|
+
* @param values - The field's stored values, indexed by document ordinal.
|
|
1333
|
+
* @param matched - The matched ordinals, in at least one bitmap word.
|
|
1334
|
+
* @param ranges - The inclusive lower and exclusive upper bounds in successive pairs.
|
|
1335
|
+
* @param outCounts - Receives one count per range, with zero for any NaN bound.
|
|
1336
|
+
* @returns 0 on success, or a negative status that leaves the output region unchanged.
|
|
1337
|
+
*/
|
|
1338
|
+
storedRangeFacet(values: NativeStoredValues, matched: Uint32Array, ranges: Float64Array, outCounts: Uint32Array): number;
|
|
1339
|
+
/**
|
|
1340
|
+
* Counts stored scalar values and array elements from matched documents.
|
|
1341
|
+
*
|
|
1342
|
+
* @param values - The field's stored values, indexed by document ordinal.
|
|
1343
|
+
* @param matched - The matched ordinals, in at least one bitmap word.
|
|
1344
|
+
* @param outValues - Receives the first matched element position for each distinct value.
|
|
1345
|
+
* @param outCounts - Receives each value's occurrence count, excluding null and encoded objects.
|
|
1346
|
+
* @returns The bucket count, or a negative status that leaves the output regions unchanged.
|
|
1347
|
+
*/
|
|
1348
|
+
valueFacet(values: NativeStoredValues, matched: Uint32Array, outValues: Uint32Array, outCounts: Uint32Array): number;
|
|
1349
|
+
/**
|
|
1350
|
+
* Counts matched documents for each enum value's posting list.
|
|
1351
|
+
*
|
|
1352
|
+
* @param offsets - The posting start of each value, followed by the terminal offset.
|
|
1353
|
+
* @param postings - The document ordinals in all posting lists.
|
|
1354
|
+
* @param matched - The matched ordinals, in at least one bitmap word.
|
|
1355
|
+
* @param outCounts - Receives one matched document count per value, including zero for an empty list.
|
|
1356
|
+
* @returns 0 on success, or a negative status that leaves the output region unchanged.
|
|
1357
|
+
*/
|
|
1358
|
+
enumFacet(offsets: Uint32Array, postings: Uint32Array, matched: Uint32Array, outCounts: Uint32Array): number;
|
|
1359
|
+
/**
|
|
1360
|
+
* Counts matched documents for each distinct numeric value in ascending order.
|
|
1361
|
+
*
|
|
1362
|
+
* @param values - The field entries in ascending numeric order.
|
|
1363
|
+
* @param ordinals - The document ordinal of each entry, with the same length as values.
|
|
1364
|
+
* @param matched - The matched ordinals, in at least one bitmap word.
|
|
1365
|
+
* @param outValues - Receives the distinct values, with signed zeros combined.
|
|
1366
|
+
* @param outCounts - Receives each value's matched document count.
|
|
1367
|
+
* @returns The bucket count, or a negative status that leaves the output regions unchanged.
|
|
1368
|
+
*/
|
|
1369
|
+
numberFacet(values: Float64Array, ordinals: Uint32Array, matched: Uint32Array, outValues: Float64Array, outCounts: Uint32Array): number;
|
|
1370
|
+
/**
|
|
1371
|
+
* Counts matched documents once in each numeric range that contains one of their values.
|
|
1372
|
+
*
|
|
1373
|
+
* @param values - The field entries in ascending numeric order.
|
|
1374
|
+
* @param ordinals - The document ordinal of each entry, with the same length as values.
|
|
1375
|
+
* @param matched - The matched ordinals, in at least one bitmap word.
|
|
1376
|
+
* @param ranges - The inclusive lower and exclusive upper bounds of each range in successive pairs.
|
|
1377
|
+
* @param outCounts - Receives one count per range, including zero for any range with a NaN bound.
|
|
1378
|
+
* @returns 0 on success, or a negative status that leaves the output region unchanged.
|
|
1379
|
+
*/
|
|
1380
|
+
rangeFacet(values: Float64Array, ordinals: Uint32Array, matched: Uint32Array, ranges: Float64Array, outCounts: Uint32Array): number;
|
|
1381
|
+
/**
|
|
1382
|
+
* Counts matched documents for each boolean value.
|
|
1383
|
+
*
|
|
1384
|
+
* @param trueBits - The ordinals that hold true, in at least one bitmap word.
|
|
1385
|
+
* @param falseBits - The ordinals that hold false, in at least one bitmap word.
|
|
1386
|
+
* @param matched - The matched ordinals, in at least one bitmap word.
|
|
1387
|
+
* @param counts - Receives the true count and false count in its first two entries.
|
|
1388
|
+
* @returns 0 on success, or a negative status with the output unchanged.
|
|
1389
|
+
*/
|
|
1390
|
+
booleanFacet(trueBits: Uint32Array, falseBits: Uint32Array, matched: Uint32Array, counts: Uint32Array): number;
|
|
1391
|
+
/**
|
|
1392
|
+
* Combines facet counts and returns the selected buckets with their error bound.
|
|
1393
|
+
*
|
|
1394
|
+
* @param offsets - Each source list's start in the flattened arrays, followed by the total entry count.
|
|
1395
|
+
* @param values - The value key of each bucket, which indexes valueRanks.
|
|
1396
|
+
* @param counts - The count of each bucket in source-list order.
|
|
1397
|
+
* @param bounds - Each source list's largest omitted count.
|
|
1398
|
+
* @param valueRanks - The code point order of the bucket keys, indexed by value key.
|
|
1399
|
+
* @param ascending - Whether counts order lowest first, with bucket keys deciding ties.
|
|
1400
|
+
* @param limit - The number of buckets to keep, or null to keep every bucket.
|
|
1401
|
+
* @param outValues - Receives the selected value keys.
|
|
1402
|
+
* @param outCounts - Receives each selected value's combined count.
|
|
1403
|
+
* @param outBound - Receives the error bound in its first word, including for an empty merge.
|
|
1404
|
+
* @returns The bucket count, or a negative core status that leaves inputs and output regions unchanged.
|
|
1405
|
+
*/
|
|
1406
|
+
mergeFacets(offsets: Uint32Array, values: Uint32Array, counts: Uint32Array, bounds: Uint32Array, valueRanks: Uint32Array, ascending: boolean, limit: number | null, outValues: Uint32Array, outCounts: Uint32Array, outBound: Uint32Array): number;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* A typed field region that a filter plan reads.
|
|
164
1411
|
*
|
|
165
|
-
* @
|
|
166
|
-
|
|
167
|
-
|
|
1412
|
+
* @internal
|
|
1413
|
+
*/
|
|
1414
|
+
type NativeFilterRegion = Uint16Array | Uint32Array | Float64Array | BigUint64Array;
|
|
1415
|
+
/**
|
|
1416
|
+
* The native operation that evaluates field tests and boolean expressions.
|
|
168
1417
|
*
|
|
169
|
-
* @
|
|
1418
|
+
* @internal
|
|
170
1419
|
*/
|
|
171
|
-
|
|
1420
|
+
interface NativeFilterCore {
|
|
1421
|
+
/**
|
|
1422
|
+
* Writes the live document ordinals that pass a postfix filter plan.
|
|
1423
|
+
*
|
|
1424
|
+
* @param plan - Groups of four words containing opcode, field, operator, and operand.
|
|
1425
|
+
* @param numbers - Numeric operands, with each numeric list preceded by its item count.
|
|
1426
|
+
* @param units - The UTF-16 code units of string operands.
|
|
1427
|
+
* @param offsets - Each string's start, followed by the terminal code-unit offset.
|
|
1428
|
+
* @param lists - Pairs containing the first string and item count of each string list.
|
|
1429
|
+
* @param bitsets - Operand bitmaps for pattern tests, text ranges, and complete sets.
|
|
1430
|
+
* @param kinds - Each field's kind: 0 absent, 1 numeric, 2 boolean, 3 enum, or 4 geo.
|
|
1431
|
+
* @param fields - Each field's present bitmap followed by its regions. Numeric fields take values and ordinals; boolean fields take true and false bitmaps; enum fields take units, offsets, posting offsets, postings, and suffix order; geo fields take codes, latitudes, longitudes, and ordinals.
|
|
1432
|
+
* @param live - The live ordinals, in at least one bitmap word.
|
|
1433
|
+
* @param into - Receives one word per live bitmap word, without overlapping an input region.
|
|
1434
|
+
* @returns 0 on success, or a negative status that leaves the output unchanged.
|
|
1435
|
+
*/
|
|
1436
|
+
evaluateFilter(plan: Uint32Array, numbers: Float64Array, units: Uint16Array, offsets: Uint32Array, lists: Uint32Array, bitsets: readonly Uint32Array[], kinds: Uint8Array, fields: readonly (readonly NativeFilterRegion[])[], live: Uint32Array, into: Uint32Array): number;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/** The analysed words that determine which text spans receive highlight tags. @internal */
|
|
1440
|
+
interface NativeHighlightQuery {
|
|
1441
|
+
/** The stemmed query words and the edit distance that each word permits. */
|
|
1442
|
+
terms: readonly {
|
|
1443
|
+
term: Uint16Array;
|
|
1444
|
+
tolerance: number;
|
|
1445
|
+
}[];
|
|
1446
|
+
/** The number of leading code points that a fuzzy match must preserve. */
|
|
1447
|
+
prefixLength: number;
|
|
1448
|
+
/** The unstemmed final query word, or null when prefix matching is disabled. */
|
|
1449
|
+
prefix: Uint16Array | null;
|
|
1450
|
+
/** The stemmed synonyms and phrase words that match exactly. */
|
|
1451
|
+
synonyms: readonly Uint16Array[];
|
|
1452
|
+
/** The words that may match inside longer written spellings. */
|
|
1453
|
+
partialWords: readonly Uint16Array[] | null;
|
|
1454
|
+
}
|
|
1455
|
+
/** The native operation that marks matching spans in the original text. @internal */
|
|
1456
|
+
interface NativeHighlightCore {
|
|
1457
|
+
/**
|
|
1458
|
+
* Returns highlighted text and its positions in the original UTF-16 text.
|
|
1459
|
+
* @param language - The built-in language index.
|
|
1460
|
+
* @param text - The original text in UTF-16.
|
|
1461
|
+
* @param query - The analysed words and their matching rules.
|
|
1462
|
+
* @param preTag - The UTF-16 text before each matching span.
|
|
1463
|
+
* @param postTag - The UTF-16 text after each matching span.
|
|
1464
|
+
* @param maxSnippetLength - The window length before tags and ellipses, or zero for the full text.
|
|
1465
|
+
* @param outSnippet - Receives the snippet's UTF-16 units.
|
|
1466
|
+
* @param outPositions - Receives pairs of start and end positions in the original text.
|
|
1467
|
+
* @param outLength - Receives the snippet's unit count in its first element.
|
|
1468
|
+
* @returns The position count, or a negative status that leaves every output unchanged.
|
|
1469
|
+
*/
|
|
1470
|
+
highlight(language: number, text: Uint16Array, query: NativeHighlightQuery, preTag: Uint16Array, postTag: Uint16Array, maxSnippetLength: number, outSnippet: Uint16Array, outPositions: Uint32Array, outLength: Uint32Array): number;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
172
1473
|
/**
|
|
173
|
-
*
|
|
1474
|
+
* The regions of one HNSW graph that the native search core reads and writes.
|
|
174
1475
|
*
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
1476
|
+
* @internal
|
|
1477
|
+
*/
|
|
1478
|
+
interface NativeGraphMemory {
|
|
1479
|
+
/** The graph's header words, which hold the entry point, the top layer, the link limits, the counts, and the graph lock. */
|
|
1480
|
+
graphHeader: Int32Array;
|
|
1481
|
+
/** The top layer of each node, one byte for each ordinal. */
|
|
1482
|
+
nodeLevels: Uint8Array;
|
|
1483
|
+
/** The neighbour lists on layer 0, a fixed number of words for each ordinal. */
|
|
1484
|
+
level0: Int32Array;
|
|
1485
|
+
/** The position in {@link NativeGraphMemory.upper} where each node's upper-layer lists start, one word for each ordinal. */
|
|
1486
|
+
upperBase: Int32Array;
|
|
1487
|
+
/** The neighbour lists on every layer above layer 0. */
|
|
1488
|
+
upper: Int32Array;
|
|
1489
|
+
/** One lock word for each node, which a writer takes before it changes that node's lists. */
|
|
1490
|
+
locks: Int32Array;
|
|
1491
|
+
/** One byte for each ordinal, which the core sets once it removes that node. */
|
|
1492
|
+
tombstones: Uint8Array;
|
|
1493
|
+
/** The number of neighbour lists that hold each node, one word for each ordinal. */
|
|
1494
|
+
incoming: Int32Array;
|
|
1495
|
+
/** One byte for each ordinal, which the core sets when that node's links have to be checked again. */
|
|
1496
|
+
nearestLinkDue: Uint8Array;
|
|
1497
|
+
/** The locks that each thread slot holds, 32 words for each slot. */
|
|
1498
|
+
heldLocks: Int32Array;
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* The regions and layout of one vector store that the native search core reads.
|
|
178
1502
|
*
|
|
179
|
-
* @
|
|
1503
|
+
* @internal
|
|
180
1504
|
*/
|
|
181
|
-
|
|
1505
|
+
interface NativeStoreMemory {
|
|
1506
|
+
/** The store's header words, which hold the slot count, the live count, and the calibration state. */
|
|
1507
|
+
storeHeader: Int32Array;
|
|
1508
|
+
/** The number of values in each vector. */
|
|
1509
|
+
dimension: number;
|
|
1510
|
+
/** The number of bits for each value in a quantised code, or 0 when the store keeps no codes. */
|
|
1511
|
+
bits: number;
|
|
1512
|
+
/** The number of quantised records that each code block holds. */
|
|
1513
|
+
recordsPerBlock: number;
|
|
1514
|
+
/** The number of full-precision vectors that each vector block holds. */
|
|
1515
|
+
vectorsPerBlock: number;
|
|
1516
|
+
/** The number of bytes from the start of one vector to the start of the next in a vector block. */
|
|
1517
|
+
vectorStrideBytes: number;
|
|
1518
|
+
/** One byte for each ordinal, set when that ordinal has a quantised code. */
|
|
1519
|
+
codePresent: Uint8Array;
|
|
1520
|
+
/** The mean vector that the quantised codes are measured from. */
|
|
1521
|
+
centroid: Float32Array;
|
|
1522
|
+
/** The length of each full-precision vector, one value for each ordinal. */
|
|
1523
|
+
magnitudes: Float64Array;
|
|
1524
|
+
/** One byte for each ordinal, set when that ordinal holds a vector. */
|
|
1525
|
+
present: Uint8Array;
|
|
1526
|
+
/** For each ordinal, the position in {@link NativeStoreMemory.vectorFiles} of the file that holds its vector, or -1 when the vector is in a block. */
|
|
1527
|
+
vectorFile: Int32Array;
|
|
1528
|
+
/** For each ordinal whose vector is in a file, the vector's offset within that file. */
|
|
1529
|
+
vectorOffset: Uint32Array;
|
|
1530
|
+
/** The paths of the files that hold full-precision vectors. */
|
|
1531
|
+
vectorFiles: string[];
|
|
1532
|
+
/** The blocks of quantised codes, in ordinal order. */
|
|
1533
|
+
codeBlocks: Uint8Array[];
|
|
1534
|
+
/** The blocks of full-precision vectors, in ordinal order, with `null` in place of a block that the store holds no memory for. */
|
|
1535
|
+
vectorBlocks: Array<Uint8Array | null>;
|
|
1536
|
+
/** For each ordinal, the sequence of the write that added its vector. */
|
|
1537
|
+
bornAt: BigInt64Array;
|
|
1538
|
+
/** For each ordinal, the sequence of the write that removed or replaced its document, or 0. */
|
|
1539
|
+
retiredAt: BigInt64Array;
|
|
1540
|
+
/** For each thread slot, the oldest pin that the thread holds plus 1, or 0. */
|
|
1541
|
+
pins: BigInt64Array;
|
|
1542
|
+
}
|
|
182
1543
|
/**
|
|
183
|
-
*
|
|
184
|
-
* derives from the host's memory, undoing
|
|
185
|
-
* {@link configureNormalizationCache}.
|
|
1544
|
+
* A graph that the native search core has attached.
|
|
186
1545
|
*
|
|
187
|
-
* @
|
|
1546
|
+
* @internal
|
|
188
1547
|
*/
|
|
189
|
-
|
|
1548
|
+
type NativeGraphHandle = object;
|
|
190
1549
|
/**
|
|
191
|
-
*
|
|
192
|
-
* what you watch to decide whether the configured size fits your vocabulary.
|
|
1550
|
+
* A vector store that the native search core has attached.
|
|
193
1551
|
*
|
|
194
|
-
* @
|
|
1552
|
+
* @internal
|
|
1553
|
+
*/
|
|
1554
|
+
type NativeStoreHandle = object;
|
|
1555
|
+
/**
|
|
1556
|
+
* The candidates that a search on a native thread found.
|
|
195
1557
|
*
|
|
196
|
-
* @
|
|
1558
|
+
* @internal
|
|
197
1559
|
*/
|
|
198
|
-
|
|
1560
|
+
interface NativeSearchResult {
|
|
1561
|
+
/** The number of candidates found, or a negative status code when the search failed. */
|
|
1562
|
+
count: number;
|
|
1563
|
+
/** The ordinal of each candidate, of which the first `count` entries hold results. */
|
|
1564
|
+
ordinals: Int32Array;
|
|
1565
|
+
/** The distance of each candidate, in the same order as {@link NativeSearchResult.ordinals}. */
|
|
1566
|
+
distances: Float64Array;
|
|
1567
|
+
}
|
|
1568
|
+
/**
|
|
1569
|
+
* The distances that a scoring call on a native thread measured.
|
|
1570
|
+
*
|
|
1571
|
+
* @internal
|
|
1572
|
+
*/
|
|
1573
|
+
interface NativeScoreResult {
|
|
1574
|
+
/** A status code from the core's header. */
|
|
1575
|
+
status: number;
|
|
1576
|
+
/** One distance for each ordinal that the call measured. */
|
|
1577
|
+
distances: Float64Array;
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* The outcome of a connecting pass that ran on a native thread.
|
|
1581
|
+
*
|
|
1582
|
+
* @internal
|
|
1583
|
+
*/
|
|
1584
|
+
interface NativeConnectResult {
|
|
1585
|
+
/** A status code from the core's header. */
|
|
1586
|
+
status: number;
|
|
1587
|
+
/** The count of waiting writers to wake in its first word, followed by their ordinals. */
|
|
1588
|
+
wakes: Int32Array;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* The native operations that match stored text and measure search deadlines.
|
|
1593
|
+
*
|
|
1594
|
+
* @internal
|
|
1595
|
+
*/
|
|
1596
|
+
interface NativePatternCore {
|
|
1597
|
+
/**
|
|
1598
|
+
* Adds the ordinals whose stored strings match a pattern to a bitmap.
|
|
1599
|
+
*
|
|
1600
|
+
* @param documents - The field's document ordinals in ascending order.
|
|
1601
|
+
* @param runs - Sorted triples of folded code points from the pattern index.
|
|
1602
|
+
* @param offsets - Each triple's first posting, followed by the terminal posting offset.
|
|
1603
|
+
* @param postings - The ascending document ordinals for each triple.
|
|
1604
|
+
* @param values - The stored field regions in the index's ordinal space.
|
|
1605
|
+
* @param text - The pattern's UTF-16 code units.
|
|
1606
|
+
* @param options - Five words containing the operator, case-fold flag, typo tolerance, preparation-count flag, and matcher byte budget. Operators are 0 equal, 1 prefix, 2 suffix, 3 substring, 4 wildcard, and 5 regular expression. Tolerance is 0, 1, 2, or 3 for automatic selection.
|
|
1607
|
+
* @param meter - Two signed 64-bit words containing the atomic work counter and its non-negative cap.
|
|
1608
|
+
* @param stop - One atomic word containing 0 to continue or 1 to stop.
|
|
1609
|
+
* @param deadline - One unsigned 64-bit monotonic deadline in nanoseconds, or 0 for no deadline.
|
|
1610
|
+
* @param into - Receives matching bits, with at least one word and enough words for every stored ordinal. Output and counter regions must not overlap any input or each other.
|
|
1611
|
+
* @returns 0 on success, or a negative status. Invalid arguments and allocation refusals leave outputs unchanged; stopping or exceeding the work cap may leave partial output.
|
|
1612
|
+
*/
|
|
1613
|
+
patternTest(documents: Uint32Array, runs: Uint32Array, offsets: Uint32Array, postings: Uint32Array, values: NativeStoredValues, text: Uint16Array, options: Uint32Array, meter: BigInt64Array, stop: Uint32Array, deadline: BigUint64Array, into: Uint32Array): number;
|
|
1614
|
+
/**
|
|
1615
|
+
* Writes the current monotonic clock value in nanoseconds.
|
|
1616
|
+
*
|
|
1617
|
+
* @param into - Receives the clock value in its first word, or the largest unsigned 64-bit value if the clock fails.
|
|
1618
|
+
* @returns 0 on success, or a negative status that leaves the output unchanged.
|
|
1619
|
+
*/
|
|
1620
|
+
clockNow(into: BigUint64Array): number;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* The postings and stored positions of one phrase token.
|
|
1625
|
+
*
|
|
1626
|
+
* @internal
|
|
1627
|
+
*/
|
|
1628
|
+
interface NativePhrasePostings {
|
|
1629
|
+
/** Each posting's document ordinal. */
|
|
1630
|
+
documents: Uint32Array;
|
|
1631
|
+
/** Each posting's field index. */
|
|
1632
|
+
fields: Uint16Array;
|
|
1633
|
+
/** Each posting's first position in positions. */
|
|
1634
|
+
positionStarts: Uint32Array;
|
|
1635
|
+
/** Each posting's number of positions. */
|
|
1636
|
+
positionCounts: Uint32Array;
|
|
1637
|
+
/** The stored positions, ascending within each posting. */
|
|
1638
|
+
positions: Uint32Array;
|
|
1639
|
+
/** Whether the postings are already in document order. */
|
|
1640
|
+
ordered: boolean;
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* The phrase tokens, searchable fields, and document masks of one segment.
|
|
1644
|
+
*
|
|
1645
|
+
* @internal
|
|
1646
|
+
*/
|
|
1647
|
+
interface NativePhraseRequest {
|
|
1648
|
+
/** The postings of each distinct token, with an empty list for a missing token. */
|
|
1649
|
+
postings: readonly NativePhrasePostings[];
|
|
1650
|
+
/** Each phrase's start in tokens and offsets, followed by the total entry count. */
|
|
1651
|
+
starts: Uint32Array;
|
|
1652
|
+
/** The posting-list index of each phrase token, in phrase order. */
|
|
1653
|
+
tokens: Uint32Array;
|
|
1654
|
+
/** Each token's position relative to the phrase start. */
|
|
1655
|
+
offsets: Uint32Array;
|
|
1656
|
+
/** One for each searchable field, or zero for an excluded field. */
|
|
1657
|
+
searchable: Uint8Array;
|
|
1658
|
+
/** The permitted document ordinals, or null to search every document. */
|
|
1659
|
+
filter: Uint32Array | null;
|
|
1660
|
+
/** The removed document ordinals. */
|
|
1661
|
+
removed: Uint32Array;
|
|
1662
|
+
/** The logical document capacity of the segment. */
|
|
1663
|
+
ordinalCount: number;
|
|
1664
|
+
/** Whether the operation returns each matching document and field. */
|
|
1665
|
+
collect: boolean;
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* The operation that matches positional phrases and counts their work.
|
|
1669
|
+
*
|
|
1670
|
+
* @internal
|
|
1671
|
+
*/
|
|
1672
|
+
interface NativePhraseCore {
|
|
1673
|
+
/**
|
|
1674
|
+
* Finds documents that contain every phrase within a searchable field.
|
|
1675
|
+
*
|
|
1676
|
+
* @param request - The segment postings, phrases, and document masks.
|
|
1677
|
+
* @param meter - The shared int64 work count followed by its cap.
|
|
1678
|
+
* @param stop - One uint32 that is zero until the search stops.
|
|
1679
|
+
* @param deadline - One uint64 clock deadline, or zero for no deadline.
|
|
1680
|
+
* @param matched - Receives the document bitmap, with padding bits cleared.
|
|
1681
|
+
* @param starts - Receives one row offset per phrase in request order, followed by the row count.
|
|
1682
|
+
* @param documents - Receives each matching row's document ordinal.
|
|
1683
|
+
* @param fields - Receives each matching row's field index.
|
|
1684
|
+
* @param frequencies - Receives each matching row's number of phrase starts.
|
|
1685
|
+
* @returns The row count, or a negative status. Invalid requests and short outputs leave every region unchanged.
|
|
1686
|
+
* A work-cap or stop status leaves the output undefined. When collect is true, every row output must hold the sum
|
|
1687
|
+
* of the smallest posting count in each phrase, so that capacity refusal happens before the operation counts work.
|
|
1688
|
+
*/
|
|
1689
|
+
matchPhrases(request: NativePhraseRequest, meter: BigInt64Array, stop: Uint32Array, deadline: BigUint64Array, matched: Uint32Array, starts: Uint32Array, documents: Uint32Array, fields: Uint16Array, frequencies: Uint32Array): number;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
/** The native operations that assemble search results. @internal */
|
|
1693
|
+
interface NativeResultCore {
|
|
1694
|
+
/**
|
|
1695
|
+
* Places pins in a ranking and returns the source position of each entry.
|
|
1696
|
+
*
|
|
1697
|
+
* @param count - The ranked entry count, at most 2^31 - 1.
|
|
1698
|
+
* @param ranked - Each pin's ranked position, or -1 for an absent pin, with at most 2^31 - 1 pins.
|
|
1699
|
+
* @param positions - The requested position of each pin, in request order.
|
|
1700
|
+
* @param depth - Pins at or beyond this depth are skipped, or null to place every pin.
|
|
1701
|
+
* @param output - Receives original ranked positions, or -1 minus the pin's index in the supplied pin arrays.
|
|
1702
|
+
* @returns The entry count, or a negative core status that leaves inputs and output regions unchanged.
|
|
1703
|
+
*/
|
|
1704
|
+
placePinned(count: number, ranked: Int32Array, positions: Uint32Array, depth: number | null, output: Int32Array): number;
|
|
1705
|
+
/**
|
|
1706
|
+
* Merges scored lists by descending score, document ID, and source-list order for ties.
|
|
1707
|
+
*
|
|
1708
|
+
* @param offsets - The start of each list in the flattened arrays, followed by the total entry count.
|
|
1709
|
+
* @param scores - The scores in source-list order, including non-finite scores.
|
|
1710
|
+
* @param idRanks - The document ID ranks, comparable across all lists.
|
|
1711
|
+
* @param limit - The maximum number of entries to return.
|
|
1712
|
+
* @param lists - Receives each entry's source-list position, counting empty lists.
|
|
1713
|
+
* @param indices - Receives each entry's position within its source list.
|
|
1714
|
+
* @returns The count, or a negative core status that leaves inputs and output regions unchanged.
|
|
1715
|
+
*/
|
|
1716
|
+
mergeRankings(offsets: Uint32Array, scores: Float64Array, idRanks: Uint32Array, limit: number, lists: Uint32Array, indices: Uint32Array): number;
|
|
1717
|
+
/**
|
|
1718
|
+
* Merges sorted lists by their shared sort ranks, preserving source-list order for ties.
|
|
1719
|
+
*
|
|
1720
|
+
* @param offsets - The start of each list in the flattened ranks, followed by the total entry count.
|
|
1721
|
+
* @param ranks - The ranks by sort values and document ID, comparable across all lists.
|
|
1722
|
+
* @param limit - The maximum number of entries to return.
|
|
1723
|
+
* @param lists - Receives each entry's source-list position, counting empty lists.
|
|
1724
|
+
* @param indices - Receives each entry's position within its source list.
|
|
1725
|
+
* @returns The count, or a negative core status that leaves inputs and output regions unchanged.
|
|
1726
|
+
*/
|
|
1727
|
+
mergeSorted(offsets: Uint32Array, ranks: Uint32Array, limit: number, lists: Uint32Array, indices: Uint32Array): number;
|
|
1728
|
+
/**
|
|
1729
|
+
* Combines text and vector rankings and writes them in descending score order, and then document ID order for equal scores.
|
|
1730
|
+
*
|
|
1731
|
+
* @param strategy - 0 for reciprocal rank fusion, or 1 for a linear combination.
|
|
1732
|
+
* @param k - The reciprocal rank constant.
|
|
1733
|
+
* @param alpha - The vector weight in a linear combination.
|
|
1734
|
+
* @param textKeys - The candidate keys in the text ranking.
|
|
1735
|
+
* @param textScores - The score at each position of the text ranking.
|
|
1736
|
+
* @param vectorKeys - The candidate keys in the vector ranking.
|
|
1737
|
+
* @param vectorScores - The score at each position of the vector ranking.
|
|
1738
|
+
* @param idRanks - The code point order of document IDs, indexed by candidate key.
|
|
1739
|
+
* @param keys - Receives the fused candidate keys.
|
|
1740
|
+
* @param scores - Receives the fused scores.
|
|
1741
|
+
* @returns The result count, or a negative core status that leaves the output regions unchanged.
|
|
1742
|
+
*/
|
|
1743
|
+
fuse(strategy: number, k: number, alpha: number, textKeys: Uint32Array, textScores: Float64Array, vectorKeys: Uint32Array, vectorScores: Float64Array, idRanks: Uint32Array, keys: Uint32Array, scores: Float64Array): number;
|
|
1744
|
+
/**
|
|
1745
|
+
* Returns the first result after a cursor anchor.
|
|
1746
|
+
*
|
|
1747
|
+
* @param count - The logical result count.
|
|
1748
|
+
* @param sorted - Whether the anchor bitmap alone decides order.
|
|
1749
|
+
* @param scores - Result scores, or null when all are absent.
|
|
1750
|
+
* @param scorePresent - Score validity bits, or null when all supplied scores are present.
|
|
1751
|
+
* @param afterAnchor - Result positions after the anchor by document ID, or by sort values followed by document ID when sorted.
|
|
1752
|
+
* @param anchorScore - The anchor score, or null when absent.
|
|
1753
|
+
* @returns The start position, count when exhausted, or a negative core status.
|
|
1754
|
+
*/
|
|
1755
|
+
pageStart(count: number, sorted: boolean, scores: Float64Array | null, scorePresent: Uint32Array | null, afterAnchor: Uint32Array, anchorScore: number | null): number;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
* The analysed synonym rules and the tokens that open each rule.
|
|
1760
|
+
*
|
|
1761
|
+
* @internal
|
|
1762
|
+
*/
|
|
1763
|
+
interface NativeSynonymTable {
|
|
1764
|
+
/** The tokens in UTF-8 and code point order. */
|
|
1765
|
+
tokens: Uint8Array;
|
|
1766
|
+
/** Each token's byte start, followed by the total byte count. */
|
|
1767
|
+
offsets: Uint32Array;
|
|
1768
|
+
/** Each rule's start in ruleTokens, followed by the entry count. */
|
|
1769
|
+
ruleStart: Uint32Array;
|
|
1770
|
+
/** The source token of each one-way rule, or -1 for a two-way rule. */
|
|
1771
|
+
ruleSource: Int32Array;
|
|
1772
|
+
/** The token indexes in each rule. */
|
|
1773
|
+
ruleTokens: Uint32Array;
|
|
1774
|
+
/** Each token's start in tokenRules, followed by the entry count. */
|
|
1775
|
+
tokenStart: Uint32Array;
|
|
1776
|
+
/** The rules that each token opens. */
|
|
1777
|
+
tokenRules: Uint32Array;
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* The operation that expands query tokens through analysed synonym rules.
|
|
1781
|
+
*
|
|
1782
|
+
* @internal
|
|
1783
|
+
*/
|
|
1784
|
+
interface NativeSynonymCore {
|
|
1785
|
+
/**
|
|
1786
|
+
* Shares fifty synonyms among distinct query tokens in query order.
|
|
1787
|
+
*
|
|
1788
|
+
* @param table - The analysed synonym table.
|
|
1789
|
+
* @param units - The query tokens in UTF-16.
|
|
1790
|
+
* @param starts - Each query token's unit start, followed by the total unit count.
|
|
1791
|
+
* @param queries - Receives the input position of each token with synonyms.
|
|
1792
|
+
* @param offsets - Receives each returned group's start in tokens, followed by the total entry count.
|
|
1793
|
+
* @param tokens - Receives each group's token indexes in code point order, without repeats.
|
|
1794
|
+
* @returns The group count, or a negative status that leaves every output unchanged. An empty success writes zero to offsets[0].
|
|
1795
|
+
*/
|
|
1796
|
+
expandSynonyms(table: NativeSynonymTable, units: Uint16Array, starts: Uint32Array, queries: Uint32Array, offsets: Uint32Array, tokens: Uint32Array): number;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* The operations of the native search core, which each return a status code from the core's header, or, for a
|
|
1801
|
+
* search, the number of candidates found.
|
|
1802
|
+
*
|
|
1803
|
+
* @internal
|
|
1804
|
+
*/
|
|
1805
|
+
interface NativeCore extends NativeAnalysisCore, NativeExpansionCore, NativeKeywordCore, NativeFacetCore, NativeFieldMergeCore, NativeFilterCore, NativeFrozenSegmentCore, NativeGroupCore, NativeHighlightCore, NativePagedCore, NativePatternCore, NativePhraseCore, NativeResultCore, NativeSegmentCore, NativeSegmentMergeCore, NativeSortCore, NativeSynonymCore, NativeTermCore {
|
|
1806
|
+
/** Returns the version of the core's binary interface, which the engine compares with the version that it was built for. */
|
|
1807
|
+
abiVersion(): number;
|
|
1808
|
+
/** Returns the number of bytes that the core's working memory holds. */
|
|
1809
|
+
workspaceBytes(): number;
|
|
1810
|
+
/**
|
|
1811
|
+
* Writes into each place of `results` the value of one deterministic maths function at the same place of
|
|
1812
|
+
* `first`, computed with the fdlibm algorithms that the specification fixes, so that a port of these functions
|
|
1813
|
+
* in another language can compare its results with the core's beyond the published test vectors. The call
|
|
1814
|
+
* counts no work.
|
|
1815
|
+
*
|
|
1816
|
+
* @param operation - The function's index from the core's header: ln, sin, cos, tan, asin, atan, or atan2.
|
|
1817
|
+
* @param first - The argument at each place, or `y` at each place for atan2. It must hold as many values as
|
|
1818
|
+
* `results`, or the core refuses the call.
|
|
1819
|
+
* @param second - `x` at each place for atan2, which must then hold as many values as `results`. Every other
|
|
1820
|
+
* function ignores it.
|
|
1821
|
+
* @param results - The array that receives one result for each place of `first`.
|
|
1822
|
+
* @returns A status code from the core's header.
|
|
1823
|
+
*/
|
|
1824
|
+
applyMath(operation: number, first: Float64Array, second: Float64Array, results: Float64Array): number;
|
|
1825
|
+
/**
|
|
1826
|
+
* Attaches the memory of one graph to the core.
|
|
1827
|
+
*
|
|
1828
|
+
* @param memory - The graph's regions.
|
|
1829
|
+
* @returns The handle that every later call on this graph takes.
|
|
1830
|
+
*/
|
|
1831
|
+
attachGraph(memory: NativeGraphMemory): NativeGraphHandle;
|
|
1832
|
+
/**
|
|
1833
|
+
* Attaches the memory of one vector store to the core.
|
|
1834
|
+
*
|
|
1835
|
+
* @param memory - The store's regions and layout.
|
|
1836
|
+
* @returns The handle that every later call on this store takes.
|
|
1837
|
+
*/
|
|
1838
|
+
attachStore(memory: NativeStoreMemory): NativeStoreHandle;
|
|
1839
|
+
/**
|
|
1840
|
+
* Releases a store that {@link NativeCore.attachStore} returned.
|
|
1841
|
+
*
|
|
1842
|
+
* @param store - The store to release.
|
|
1843
|
+
* @returns A status code.
|
|
1844
|
+
*/
|
|
1845
|
+
detachStore(store: NativeStoreHandle): number;
|
|
1846
|
+
/**
|
|
1847
|
+
* Finds the nodes nearest to a query by walking the graph.
|
|
1848
|
+
*
|
|
1849
|
+
* @param graph - The graph to walk.
|
|
1850
|
+
* @param store - The store that holds the graph's vectors.
|
|
1851
|
+
* @param query - The query vector.
|
|
1852
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1853
|
+
* @param candidateCount - The number of candidates to keep.
|
|
1854
|
+
* @param pin - The write sequence that the search reads the store at, so that it returns only the ordinals that this pin admits.
|
|
1855
|
+
* @param threadSlot - The slot of the calling thread.
|
|
1856
|
+
* @param ordinals - Receives the ordinal of each candidate.
|
|
1857
|
+
* @param distances - Receives the distance of each candidate.
|
|
1858
|
+
* @param accepted - A bit set of the ordinals that a search may return, or `null` to accept every ordinal.
|
|
1859
|
+
* @returns The number of candidates found.
|
|
1860
|
+
*/
|
|
1861
|
+
search(graph: NativeGraphHandle, store: NativeStoreHandle, query: Float32Array, metric: number, candidateCount: number, pin: number, threadSlot: number, ordinals: Int32Array, distances: Float64Array, accepted: Uint8Array | null): number;
|
|
1862
|
+
/**
|
|
1863
|
+
* Measures the distance from a query to each of the given ordinals.
|
|
1864
|
+
*
|
|
1865
|
+
* @param store - The store that holds the vectors.
|
|
1866
|
+
* @param query - The query vector.
|
|
1867
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1868
|
+
* @param ordinals - The ordinals to measure.
|
|
1869
|
+
* @param count - The number of ordinals to read from `ordinals`.
|
|
1870
|
+
* @param pin - The write sequence that the scores read the store at, so that every ordinal that this pin leaves out scores infinity.
|
|
1871
|
+
* @param distances - Receives one distance for each ordinal.
|
|
1872
|
+
* @returns A status code.
|
|
1873
|
+
*/
|
|
1874
|
+
score(store: NativeStoreHandle, query: Float32Array, metric: number, ordinals: Int32Array, count: number, pin: number, distances: Float64Array): number;
|
|
1875
|
+
/**
|
|
1876
|
+
* Finds the nodes nearest to a query on a native thread, so the calling thread stays free while the core walks
|
|
1877
|
+
* the graph. A core without its own threads leaves this out.
|
|
1878
|
+
*
|
|
1879
|
+
* @param graph - The graph to walk.
|
|
1880
|
+
* @param store - The store that holds the graph's vectors.
|
|
1881
|
+
* @param query - The query vector, which the core copies before the promise settles.
|
|
1882
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1883
|
+
* @param candidateCount - The number of candidates to keep.
|
|
1884
|
+
* @param pin - The write sequence that the search reads the store at, so that it returns only the ordinals that this pin admits.
|
|
1885
|
+
* @param threadSlot - A slot that no other thread uses until the promise settles.
|
|
1886
|
+
* @param accepted - A bit set of the ordinals that a search may return, or `null` to accept every ordinal.
|
|
1887
|
+
* @returns The candidates found.
|
|
1888
|
+
*/
|
|
1889
|
+
searchAsync?(graph: NativeGraphHandle, store: NativeStoreHandle, query: Float32Array, metric: number, candidateCount: number, pin: number, threadSlot: number, accepted: Uint8Array | null): Promise<NativeSearchResult>;
|
|
1890
|
+
/**
|
|
1891
|
+
* Measures the distance from a query to each of the given ordinals on a native thread. A core without its own
|
|
1892
|
+
* threads leaves this out.
|
|
1893
|
+
*
|
|
1894
|
+
* @param store - The store that holds the vectors.
|
|
1895
|
+
* @param query - The query vector, which the core copies before the promise settles.
|
|
1896
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1897
|
+
* @param ordinals - The ordinals to measure, which the core copies before the promise settles.
|
|
1898
|
+
* @param count - The number of ordinals to read from `ordinals`.
|
|
1899
|
+
* @param pin - The write sequence that the scores read the store at, so that every ordinal that this pin leaves out scores infinity.
|
|
1900
|
+
* @param threadSlot - A slot that no other thread uses until the promise settles.
|
|
1901
|
+
* @returns The status and one distance for each ordinal.
|
|
1902
|
+
*/
|
|
1903
|
+
scoreAsync?(store: NativeStoreHandle, query: Float32Array, metric: number, ordinals: Int32Array, count: number, pin: number, threadSlot: number): Promise<NativeScoreResult>;
|
|
1904
|
+
/**
|
|
1905
|
+
* Links a new node into the graph.
|
|
1906
|
+
*
|
|
1907
|
+
* @param graph - The graph to change.
|
|
1908
|
+
* @param store - The store that holds the node's vector.
|
|
1909
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1910
|
+
* @param ordinal - The node to link.
|
|
1911
|
+
* @param topLayer - The highest layer that the node joins.
|
|
1912
|
+
* @param graphHeldAlone - 1 when the caller holds the graph alone, and 0 otherwise.
|
|
1913
|
+
* @param threadSlot - The slot of the calling thread.
|
|
1914
|
+
* @param wakes - Receives the count of waiting writers to wake in its first word, followed by their ordinals.
|
|
1915
|
+
* @returns A status code.
|
|
1916
|
+
*/
|
|
1917
|
+
place(graph: NativeGraphHandle, store: NativeStoreHandle, metric: number, ordinal: number, topLayer: number, graphHeldAlone: number, threadSlot: number, wakes: Int32Array): number;
|
|
1918
|
+
/**
|
|
1919
|
+
* Marks a node as removed and unlinks it from its neighbours.
|
|
1920
|
+
*
|
|
1921
|
+
* @param graph - The graph to change.
|
|
1922
|
+
* @param ordinal - The node to remove.
|
|
1923
|
+
* @param threadSlot - The slot of the calling thread.
|
|
1924
|
+
* @param wakes - Receives the count of waiting writers to wake in its first word, followed by their ordinals.
|
|
1925
|
+
* @returns A status code.
|
|
1926
|
+
*/
|
|
1927
|
+
remove(graph: NativeGraphHandle, ordinal: number, threadSlot: number, wakes: Int32Array): number;
|
|
1928
|
+
/**
|
|
1929
|
+
* Repairs the links of the nodes that pointed at removed nodes.
|
|
1930
|
+
*
|
|
1931
|
+
* @param graph - The graph to change.
|
|
1932
|
+
* @param store - The store that holds the graph's vectors.
|
|
1933
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1934
|
+
* @param threadSlot - The slot of the calling thread.
|
|
1935
|
+
* @param wakes - Receives the count of waiting writers to wake in its first word, followed by their ordinals.
|
|
1936
|
+
* @returns A status code.
|
|
1937
|
+
*/
|
|
1938
|
+
compact(graph: NativeGraphHandle, store: NativeStoreHandle, metric: number, threadSlot: number, wakes: Int32Array): number;
|
|
1939
|
+
/**
|
|
1940
|
+
* Links the nodes that no other node points at to nearby nodes.
|
|
1941
|
+
*
|
|
1942
|
+
* @param graph - The graph to change.
|
|
1943
|
+
* @param store - The store that holds the graph's vectors.
|
|
1944
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1945
|
+
* @param nearby - The nodes that the core may link the unreached nodes to.
|
|
1946
|
+
* @param threadSlot - The slot of the calling thread.
|
|
1947
|
+
* @param wakes - Receives the count of waiting writers to wake in its first word, followed by their ordinals.
|
|
1948
|
+
* @returns A status code.
|
|
1949
|
+
*/
|
|
1950
|
+
connectUnreached(graph: NativeGraphHandle, store: NativeStoreHandle, metric: number, nearby: Int32Array, threadSlot: number, wakes: Int32Array): number;
|
|
1951
|
+
/**
|
|
1952
|
+
* Links the nodes that no other node points at to nearby nodes on a native thread, so the calling thread stays free
|
|
1953
|
+
* while the core walks the graph. The call takes the graph lock alone before it returns, and the native thread
|
|
1954
|
+
* releases it once the pass ends. Where another thread holds the lock, the call runs no pass and settles with the
|
|
1955
|
+
* status that reports the graph as held elsewhere. A core without its own threads leaves this out.
|
|
1956
|
+
*
|
|
1957
|
+
* @param graph - The graph to change.
|
|
1958
|
+
* @param store - The store that holds the graph's vectors.
|
|
1959
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1960
|
+
* @param nearby - The nodes that the core may link the unreached nodes to, which the core copies before the promise settles.
|
|
1961
|
+
* @param threadSlot - A slot that no other thread uses until the promise settles.
|
|
1962
|
+
* @returns The status, and the waiting writers to wake.
|
|
1963
|
+
*/
|
|
1964
|
+
connectUnreachedAsync?(graph: NativeGraphHandle, store: NativeStoreHandle, metric: number, nearby: Int32Array, threadSlot: number): Promise<NativeConnectResult>;
|
|
1965
|
+
/**
|
|
1966
|
+
* Adds the given vectors to running totals, which the engine uses to calibrate quantisation.
|
|
1967
|
+
*
|
|
1968
|
+
* @param store - The store that holds the vectors.
|
|
1969
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1970
|
+
* @param ordinals - The ordinals to add.
|
|
1971
|
+
* @param count - The number of ordinals to read from `ordinals`.
|
|
1972
|
+
* @param totals - The sum of each axis, then the sum of squared lengths, then the number of vectors.
|
|
1973
|
+
* @returns A status code.
|
|
1974
|
+
*/
|
|
1975
|
+
measure(store: NativeStoreHandle, metric: number, ordinals: Int32Array, count: number, totals: Float64Array): number;
|
|
1976
|
+
/**
|
|
1977
|
+
* Writes a quantised code for each of the given ordinals.
|
|
1978
|
+
*
|
|
1979
|
+
* @param store - The store that holds the vectors.
|
|
1980
|
+
* @param metric - The distance metric, where 0 is cosine, 1 is dot product, and 2 is Euclidean.
|
|
1981
|
+
* @param ordinals - The ordinals to quantise.
|
|
1982
|
+
* @param count - The number of ordinals to read from `ordinals`.
|
|
1983
|
+
* @returns A status code.
|
|
1984
|
+
*/
|
|
1985
|
+
quantise(store: NativeStoreHandle, metric: number, ordinals: Int32Array, count: number): number;
|
|
1986
|
+
}
|
|
199
1987
|
|
|
200
1988
|
/**
|
|
201
1989
|
* Makes a language available to indexes that name it.
|
|
@@ -222,6 +2010,294 @@ declare function registerLanguage(module: LanguageModule): void;
|
|
|
222
2010
|
*/
|
|
223
2011
|
declare function getLanguage(name: string): LanguageModule;
|
|
224
2012
|
|
|
2013
|
+
/**
|
|
2014
|
+
* Call this to give the engine the partial-word search code, so that it can
|
|
2015
|
+
* create and load an index with a field whose type includes `partial`.
|
|
2016
|
+
*
|
|
2017
|
+
* A Node process loads that code by itself, so only a browser app has to
|
|
2018
|
+
* make this call. In a browser, import `partialWordSearch` from
|
|
2019
|
+
* `@delali/narsil/partial-words` and pass it here before the app creates or
|
|
2020
|
+
* loads an index with a `partial` field.
|
|
2021
|
+
*
|
|
2022
|
+
* @param module - Pass the `partialWordSearch` object that
|
|
2023
|
+
* `@delali/narsil/partial-words` exports.
|
|
2024
|
+
* @throws The engine throws a `NarsilError` with `CONFIG_INVALID` for any
|
|
2025
|
+
* other object.
|
|
2026
|
+
*
|
|
2027
|
+
* @public
|
|
2028
|
+
*/
|
|
2029
|
+
declare function registerPartialWordSearch(module: PartialWordSearch): void;
|
|
2030
|
+
|
|
2031
|
+
/**
|
|
2032
|
+
* Call this to give the engine its synonym code, so that it can create and
|
|
2033
|
+
* load an index that holds a synonym set.
|
|
2034
|
+
*
|
|
2035
|
+
* A Node process loads that code by itself, so only a browser app has to make
|
|
2036
|
+
* this call. In a browser, import `synonyms` from `@delali/narsil/synonyms` and
|
|
2037
|
+
* pass it here before the app creates or loads an index with a synonym set.
|
|
2038
|
+
*
|
|
2039
|
+
* @param module - Pass the `synonyms` object that `@delali/narsil/synonyms`
|
|
2040
|
+
* exports.
|
|
2041
|
+
* @throws The engine throws a `NarsilError` with `CONFIG_INVALID` for any
|
|
2042
|
+
* other object.
|
|
2043
|
+
*
|
|
2044
|
+
* @public
|
|
2045
|
+
*/
|
|
2046
|
+
declare function registerSynonyms(module: SynonymSearch): void;
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* The status of one file or directory in an app's private storage.
|
|
2050
|
+
*
|
|
2051
|
+
* @internal
|
|
2052
|
+
*/
|
|
2053
|
+
interface ReactNativeFileStatus {
|
|
2054
|
+
/** The size of the file in bytes. */
|
|
2055
|
+
size: number;
|
|
2056
|
+
/** Whether the path is a directory. */
|
|
2057
|
+
isDirectory: boolean;
|
|
2058
|
+
/** Whether the path is a regular file. */
|
|
2059
|
+
isFile: boolean;
|
|
2060
|
+
/** The device that holds the file, as a decimal string. */
|
|
2061
|
+
device: string;
|
|
2062
|
+
/** The file's inode number, as a decimal string. */
|
|
2063
|
+
inode: string;
|
|
2064
|
+
/** The time of the file's last change, in milliseconds since the Unix epoch. */
|
|
2065
|
+
modifiedMs: number;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* One entry of a directory in an app's private storage.
|
|
2069
|
+
*
|
|
2070
|
+
* @internal
|
|
2071
|
+
*/
|
|
2072
|
+
interface ReactNativeDirectoryEntry {
|
|
2073
|
+
/** The entry's name within its directory. */
|
|
2074
|
+
name: string;
|
|
2075
|
+
/** Whether the entry is a directory. */
|
|
2076
|
+
isDirectory: boolean;
|
|
2077
|
+
/** Whether the entry is a regular file. */
|
|
2078
|
+
isFile: boolean;
|
|
2079
|
+
}
|
|
2080
|
+
/**
|
|
2081
|
+
* Synchronous file calls that the phone's native module answers. Each call
|
|
2082
|
+
* throws an `Error` whose `code` holds the POSIX error name, such as `ENOENT`.
|
|
2083
|
+
*
|
|
2084
|
+
* @internal
|
|
2085
|
+
*/
|
|
2086
|
+
interface ReactNativeFiles {
|
|
2087
|
+
/**
|
|
2088
|
+
* Opens a file.
|
|
2089
|
+
*
|
|
2090
|
+
* @param path - The file's path.
|
|
2091
|
+
* @param flags - The open mode, as Node.js writes it, such as `r` or `w+`.
|
|
2092
|
+
* @returns The file descriptor.
|
|
2093
|
+
*/
|
|
2094
|
+
open(path: string, flags: string): number;
|
|
2095
|
+
/**
|
|
2096
|
+
* Closes a file descriptor once every call in progress on it has finished.
|
|
2097
|
+
*
|
|
2098
|
+
* @param descriptor - The descriptor to close.
|
|
2099
|
+
*/
|
|
2100
|
+
close(descriptor: number): void;
|
|
2101
|
+
/**
|
|
2102
|
+
* Reads bytes from a file into a buffer.
|
|
2103
|
+
*
|
|
2104
|
+
* @param descriptor - The file to read.
|
|
2105
|
+
* @param target - Receives the bytes.
|
|
2106
|
+
* @param position - The offset in the file to read from.
|
|
2107
|
+
* @returns The number of bytes read.
|
|
2108
|
+
*/
|
|
2109
|
+
read(descriptor: number, target: Uint8Array, position: number): number;
|
|
2110
|
+
/**
|
|
2111
|
+
* Writes bytes from a buffer to a file.
|
|
2112
|
+
*
|
|
2113
|
+
* @param descriptor - The file to write.
|
|
2114
|
+
* @param source - The bytes to write.
|
|
2115
|
+
* @param position - The offset in the file to write at.
|
|
2116
|
+
* @returns The number of bytes written.
|
|
2117
|
+
*/
|
|
2118
|
+
write(descriptor: number, source: Uint8Array, position: number): number;
|
|
2119
|
+
/**
|
|
2120
|
+
* Flushes a file to storage, with `F_FULLFSYNC` on iOS.
|
|
2121
|
+
*
|
|
2122
|
+
* @param descriptor - The file to flush.
|
|
2123
|
+
*/
|
|
2124
|
+
sync(descriptor: number): void;
|
|
2125
|
+
/**
|
|
2126
|
+
* Reads bytes from a file into a buffer on a native thread. Calls on one
|
|
2127
|
+
* descriptor finish in the order that the engine makes them.
|
|
2128
|
+
*
|
|
2129
|
+
* @param descriptor - The file to read.
|
|
2130
|
+
* @param target - Receives the bytes.
|
|
2131
|
+
* @param position - The offset in the file to read from, or -1 for the current offset.
|
|
2132
|
+
* @returns The number of bytes read.
|
|
2133
|
+
*/
|
|
2134
|
+
readAsync(descriptor: number, target: Uint8Array, position: number): Promise<number>;
|
|
2135
|
+
/**
|
|
2136
|
+
* Writes bytes from a buffer to a file on a native thread. The call copies
|
|
2137
|
+
* the bytes before it returns, so the caller can reuse the buffer at once.
|
|
2138
|
+
* Calls on one descriptor finish in the order that the engine makes them.
|
|
2139
|
+
*
|
|
2140
|
+
* @param descriptor - The file to write.
|
|
2141
|
+
* @param source - The bytes to write.
|
|
2142
|
+
* @param position - The offset in the file to write at, or -1 for the current offset.
|
|
2143
|
+
* @returns The number of bytes written.
|
|
2144
|
+
*/
|
|
2145
|
+
writeAsync(descriptor: number, source: Uint8Array, position: number): Promise<number>;
|
|
2146
|
+
/**
|
|
2147
|
+
* Flushes a file to storage on a native thread, with `F_FULLFSYNC` on iOS,
|
|
2148
|
+
* once every earlier call on the descriptor has finished.
|
|
2149
|
+
*
|
|
2150
|
+
* @param descriptor - The file to flush.
|
|
2151
|
+
*/
|
|
2152
|
+
syncAsync(descriptor: number): Promise<void>;
|
|
2153
|
+
/**
|
|
2154
|
+
* Sets the length of a file.
|
|
2155
|
+
*
|
|
2156
|
+
* @param descriptor - The file to change.
|
|
2157
|
+
* @param byteLength - The new length in bytes.
|
|
2158
|
+
*/
|
|
2159
|
+
truncate(descriptor: number, byteLength: number): void;
|
|
2160
|
+
/**
|
|
2161
|
+
* Returns the status of an open file.
|
|
2162
|
+
*
|
|
2163
|
+
* @param descriptor - The file to describe.
|
|
2164
|
+
*/
|
|
2165
|
+
descriptorStatus(descriptor: number): ReactNativeFileStatus;
|
|
2166
|
+
/**
|
|
2167
|
+
* Returns the status of a path.
|
|
2168
|
+
*
|
|
2169
|
+
* @param path - The path to describe.
|
|
2170
|
+
*/
|
|
2171
|
+
pathStatus(path: string): ReactNativeFileStatus;
|
|
2172
|
+
/**
|
|
2173
|
+
* Creates a directory.
|
|
2174
|
+
*
|
|
2175
|
+
* @param path - The directory to create.
|
|
2176
|
+
*/
|
|
2177
|
+
makeDirectory(path: string): void;
|
|
2178
|
+
/**
|
|
2179
|
+
* Lists the entries of a directory.
|
|
2180
|
+
*
|
|
2181
|
+
* @param path - The directory to list.
|
|
2182
|
+
*/
|
|
2183
|
+
readDirectory(path: string): ReactNativeDirectoryEntry[];
|
|
2184
|
+
/**
|
|
2185
|
+
* Renames a file or directory, replacing any file at the new path.
|
|
2186
|
+
*
|
|
2187
|
+
* @param from - The current path.
|
|
2188
|
+
* @param to - The new path.
|
|
2189
|
+
*/
|
|
2190
|
+
rename(from: string, to: string): void;
|
|
2191
|
+
/**
|
|
2192
|
+
* Deletes a file.
|
|
2193
|
+
*
|
|
2194
|
+
* @param path - The file to delete.
|
|
2195
|
+
*/
|
|
2196
|
+
unlink(path: string): void;
|
|
2197
|
+
/**
|
|
2198
|
+
* Deletes an empty directory.
|
|
2199
|
+
*
|
|
2200
|
+
* @param path - The directory to delete.
|
|
2201
|
+
*/
|
|
2202
|
+
removeDirectory(path: string): void;
|
|
2203
|
+
/**
|
|
2204
|
+
* Creates a hard link to a file.
|
|
2205
|
+
*
|
|
2206
|
+
* @param existingPath - The file to link to.
|
|
2207
|
+
* @param newPath - The path of the new link.
|
|
2208
|
+
*/
|
|
2209
|
+
link(existingPath: string, newPath: string): void;
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* What `@delali/narsil-react-native` installs on the engine's runtime, so that
|
|
2213
|
+
* the engine can reach memory, files, compression, and the search core that
|
|
2214
|
+
* Hermes lacks.
|
|
2215
|
+
*
|
|
2216
|
+
* @internal
|
|
2217
|
+
*/
|
|
2218
|
+
interface ReactNativeHost {
|
|
2219
|
+
/**
|
|
2220
|
+
* Reserves address space that the system backs with memory only as each page is first written.
|
|
2221
|
+
*
|
|
2222
|
+
* @param bytes - The number of bytes to reserve.
|
|
2223
|
+
* @returns A buffer over the reserved space, which reads as zeros until written.
|
|
2224
|
+
*/
|
|
2225
|
+
reserveMemory(bytes: number): ArrayBuffer;
|
|
2226
|
+
/**
|
|
2227
|
+
* Allocates zeroed memory that the native module owns.
|
|
2228
|
+
*
|
|
2229
|
+
* @param bytes - The number of bytes to allocate.
|
|
2230
|
+
* @returns A buffer over the allocated memory.
|
|
2231
|
+
*/
|
|
2232
|
+
allocateMemory(bytes: number): ArrayBuffer;
|
|
2233
|
+
/**
|
|
2234
|
+
* Reports whether the native module allocated a buffer, which the search core requires of every region it reads.
|
|
2235
|
+
*
|
|
2236
|
+
* @param buffer - The buffer to check.
|
|
2237
|
+
*/
|
|
2238
|
+
ownsMemory(buffer: ArrayBufferLike): boolean;
|
|
2239
|
+
/**
|
|
2240
|
+
* Fills a buffer with random bytes from the system's secure random source.
|
|
2241
|
+
*
|
|
2242
|
+
* @param target - The buffer to fill.
|
|
2243
|
+
*/
|
|
2244
|
+
fillRandom(target: Uint8Array): void;
|
|
2245
|
+
/** Returns the app's process identifier. */
|
|
2246
|
+
processId(): number;
|
|
2247
|
+
/** Returns the time at which the native module loaded, in milliseconds since the Unix epoch. */
|
|
2248
|
+
processStartedAtMs(): number;
|
|
2249
|
+
/**
|
|
2250
|
+
* Reports whether a process with the given identifier is running.
|
|
2251
|
+
*
|
|
2252
|
+
* @param processId - The process to look for.
|
|
2253
|
+
*/
|
|
2254
|
+
processIsAlive(processId: number): boolean;
|
|
2255
|
+
/** Returns the app's resident memory and the memory that the system still allows it, both in bytes. */
|
|
2256
|
+
processMemory(): {
|
|
2257
|
+
residentBytes: number;
|
|
2258
|
+
availableBytes: number;
|
|
2259
|
+
};
|
|
2260
|
+
/**
|
|
2261
|
+
* Runs a full garbage collection on the engine's runtime, so that the memory of dropped indexes returns to the
|
|
2262
|
+
* system before the engine measures it again.
|
|
2263
|
+
*
|
|
2264
|
+
* @returns Whether a collection ran.
|
|
2265
|
+
*/
|
|
2266
|
+
collectGarbage(): boolean;
|
|
2267
|
+
/** Returns the absolute path of the app's private storage directory. */
|
|
2268
|
+
appStorageDirectory(): string;
|
|
2269
|
+
/**
|
|
2270
|
+
* Compresses bytes with raw deflate.
|
|
2271
|
+
*
|
|
2272
|
+
* @param raw - The bytes to compress.
|
|
2273
|
+
*/
|
|
2274
|
+
deflateRaw(raw: Uint8Array): Uint8Array;
|
|
2275
|
+
/**
|
|
2276
|
+
* Inflates raw deflate bytes of a known length.
|
|
2277
|
+
*
|
|
2278
|
+
* @param compressed - The compressed bytes.
|
|
2279
|
+
* @param rawByteLength - The length of the inflated bytes.
|
|
2280
|
+
*/
|
|
2281
|
+
inflateRaw(compressed: Uint8Array, rawByteLength: number): Uint8Array;
|
|
2282
|
+
/**
|
|
2283
|
+
* Compresses bytes into the gzip format.
|
|
2284
|
+
*
|
|
2285
|
+
* @param data - The bytes to compress.
|
|
2286
|
+
*/
|
|
2287
|
+
gzip(data: Uint8Array): Uint8Array;
|
|
2288
|
+
/**
|
|
2289
|
+
* Inflates gzip bytes, and throws an error whose `code` is `EFBIG` once the output passes the limit.
|
|
2290
|
+
*
|
|
2291
|
+
* @param compressed - The gzip bytes.
|
|
2292
|
+
* @param maxByteLength - The largest inflated length to accept.
|
|
2293
|
+
*/
|
|
2294
|
+
gunzip(compressed: Uint8Array, maxByteLength: number): Uint8Array;
|
|
2295
|
+
/** The file calls that the native module answers. */
|
|
2296
|
+
readonly files: ReactNativeFiles;
|
|
2297
|
+
/** The native search core. */
|
|
2298
|
+
readonly core: NativeCore;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
225
2301
|
/**
|
|
226
2302
|
* Reports whether the runtime can run the SIMD module that speeds up vector
|
|
227
2303
|
* distance work.
|
|
@@ -249,4 +2325,4 @@ declare function isSimdAvailable(): boolean;
|
|
|
249
2325
|
*/
|
|
250
2326
|
declare const VERSION = "0.1.0";
|
|
251
2327
|
|
|
252
|
-
export { CustomTokenizer, LanguageModule, Narsil, NarsilConfig, PartialWordSearch, PatternSearch, StopWordOverride, SynonymSearch, VERSION, clearNormalizationCache, configureNormalizationCache, createNarsil, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, isSimdAvailable, registerLanguage, registerPartialWordSearch, registerPatternSearch, registerStopWords, registerSynonyms, registerTokenizer, resetNormalizationCache };
|
|
2328
|
+
export { CustomTokenizer, LanguageModule, Narsil, NarsilConfig, type NativeAnalysisCore, type NativeConnectResult, type NativeCore, type NativeExpansionCore, type NativeExpansionSegment, type NativeFacetCore, type NativeFieldMergeCore, type NativeFieldMergeRegion, type NativeFieldMergeSource, type NativeFieldTokenArgument, type NativeFieldTokens, type NativeFilterCore, type NativeFilterRegion, type NativeFrozenPagedRemovals, type NativeFrozenRegionArguments, type NativeFrozenRemovalIndex, type NativeFrozenRuns, type NativeFrozenSegment, type NativeFrozenSegmentCore, type NativeFrozenSegmentState, type NativeFrozenStrings, type NativeGraphHandle, type NativeGraphMemory, type NativeGroupCore, type NativeGrowingSegment, type NativeHighlightCore, type NativeHighlightQuery, type NativeKeywordCore, type NativeKeywordMergeInput, type NativeKeywordMergeOutput, type NativePageCache, type NativePageSection, type NativePagedCore, type NativePagedFileHandle, type NativePagedGraphPart, type NativePagedVectorField, type NativePagedVectorFile, type NativePagedVectorRequest, type NativePartialExpansionCore, type NativePartialRequest, type NativePartialSource, type NativePatternCore, type NativePhraseCore, type NativePhrasePostings, type NativePhraseRequest, type NativePositionPool, type NativePostingMergeOutput, type NativePostingPool, type NativeResultCore, type NativeRunTable, type NativeScoreResult, type NativeSearchResult, type NativeSegmentCore, type NativeSegmentMergeCore, type NativeSliceAllocator, type NativeSortColumn, type NativeSortCore, type NativeSortValues, type NativeSpellingTable, type NativeStopWordSetHandle, type NativeStoreHandle, type NativeStoreMemory, NativeStoredValues, type NativeSurfaceTable, type NativeSynonymCore, type NativeSynonymTable, type NativeTermColumns, type NativeTermCore, type NativeTermDictionary, type NativeTermTable, PartialWordSearch, PatternSearch, type ReactNativeDirectoryEntry, type ReactNativeFileStatus, type ReactNativeFiles, type ReactNativeHost, StopWordOverride, SynonymSearch, VERSION, clearNormalizationCache, configureNormalizationCache, createNarsil, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, isSimdAvailable, registerLanguage, registerPartialWordSearch, registerPatternSearch, registerStopWords, registerSynonyms, registerTokenizer, resetNormalizationCache };
|