@delali/narsil 0.4.5 → 0.4.6-next.333
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/README.md +1 -1
- package/dist/browser/{chunk-VAPCFSMX.mjs → chunk-3PGIOK7Z.mjs} +16 -1
- package/dist/browser/{chunk-263ERYKA.mjs → chunk-75MBWQFW.mjs} +71 -27
- package/dist/browser/{chunk-VIVG3OXM.mjs → chunk-FBDTHGDR.mjs} +7 -3
- package/dist/browser/{chunk-56UNHLAF.mjs → chunk-HIC42RBU.mjs} +1 -1
- package/dist/browser/{optional-reads-NQO5DKM4.mjs → optional-reads-4O4CJ7TR.mjs} +1 -1
- package/dist/browser/{runtime-OMKE7DF4.mjs → runtime-AMEB4J2D.mjs} +2 -1
- package/dist/browser/{segment-codec-leaf-GXSRX5VT.mjs → segment-codec-leaf-NDVBIBJJ.mjs} +3 -0
- package/dist/browser/{storage-leaf-42IZEOJJ.mjs → storage-leaf-NCOXQTXQ.mjs} +32 -12
- package/dist/{capabilities-DaJKuKlG.d.ts → capabilities-YazdElfW.d.ts} +2 -2
- package/dist/{chunk-KGLBLKYF.mjs → chunk-26AKUBDX.mjs} +66 -51
- package/dist/{react-native/chunks/chunk-3BEUTRYM.mjs → chunk-2M55WPWK.mjs} +1 -1
- package/dist/{chunk-AAH5CD3M.mjs → chunk-34QTB6O7.mjs} +1 -1
- package/dist/{chunk-GLPBA2YZ.mjs → chunk-3EFLY5LQ.mjs} +2 -2
- package/dist/{chunk-GDCTK5LU.mjs → chunk-3TENTQKL.mjs} +2 -2
- package/dist/{chunk-3PO2MOFY.mjs → chunk-3UAYJW6R.mjs} +2 -2
- package/dist/{chunk-VV6P6LKJ.mjs → chunk-3WYTRM24.mjs} +80 -78
- package/dist/chunk-43UYNPPC.mjs +110 -0
- package/dist/{chunk-UDDZVZTV.mjs → chunk-47NXBGQG.mjs} +2 -2
- package/dist/{chunk-RXQZ53NV.mjs → chunk-5CYLXJYQ.mjs} +2 -2
- package/dist/{chunk-6RNOECOF.mjs → chunk-5E46Y42F.mjs} +2 -2
- package/dist/{chunk-FAK7Y3OX.mjs → chunk-6U4C7VAD.mjs} +37 -9
- package/dist/{chunk-EY5U4P5V.mjs → chunk-7NMLFP2T.mjs} +17 -2
- package/dist/{chunk-BVLR6S5J.mjs → chunk-E6CHNSMY.mjs} +5 -5
- package/dist/{chunk-CP4ZQR2X.mjs → chunk-FBGUKBW2.mjs} +15 -9
- package/dist/{chunk-ZGGZXRGM.mjs → chunk-GYQKMYPG.mjs} +85 -38
- package/dist/{chunk-ICOCO7R4.mjs → chunk-GZ4YU36L.mjs} +1 -1
- package/dist/{chunk-3Q6CDT32.mjs → chunk-H2R4BTSO.mjs} +3 -3
- package/dist/{chunk-7SMVY4AX.mjs → chunk-HFF2R73P.mjs} +11 -11
- package/dist/{chunk-CPAE2QJP.mjs → chunk-HJCYLTVA.mjs} +1 -1
- package/dist/{chunk-XX4SKT54.mjs → chunk-KFUHQC6X.mjs} +22 -12
- package/dist/{chunk-5SHWA6PE.mjs → chunk-L2GYY6KY.mjs} +1 -1
- package/dist/{chunk-DEYEVTFV.mjs → chunk-L2W4FGTD.mjs} +2 -2
- package/dist/{chunk-4JLHHEBN.mjs → chunk-M5RYB6FE.mjs} +1 -1
- package/dist/{chunk-PBUME456.mjs → chunk-NOEMVUBS.mjs} +1 -1
- package/dist/{chunk-UQFWTROO.mjs → chunk-NSMF4OHE.mjs} +3 -3
- package/dist/{chunk-C3OQQ3M6.mjs → chunk-OPWZ7PZZ.mjs} +1 -1
- package/dist/{chunk-H7IIA2KL.mjs → chunk-PBVLCGCW.mjs} +1 -1
- package/dist/{chunk-REM3KDXN.mjs → chunk-U6B3HHTP.mjs} +4 -4
- package/dist/{chunk-M2Z5WVWW.mjs → chunk-UGMOBSMD.mjs} +2 -0
- package/dist/{chunk-43T3P3BE.mjs → chunk-WW3RDS57.mjs} +1 -1
- package/dist/{client-DetSCqP2.d.ts → client-B9YNYYs_.d.ts} +38 -12
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +2 -2
- package/dist/{config-BB4MRAsB.d.ts → config-DJFXyHMZ.d.ts} +2 -2
- package/dist/{config-XEHd4MFx.d.ts → config-DlvP2PSi.d.ts} +2 -2
- package/dist/{direct-executor-TWLEPVQO.mjs → direct-executor-2Y3JPVXT.mjs} +3 -3
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +6 -2
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution/transport/tcp.mjs +24 -19
- package/dist/distribution.d.ts +14 -9
- package/dist/distribution.mjs +808 -646
- package/dist/{engine-DGG_yX0p.d.ts → engine-DP4PrdKM.d.ts} +51 -13
- package/dist/{index-fX_FbuRT.d.ts → index-CcivYH_R.d.ts} +1 -1
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +3 -3
- package/dist/index.react-native.mjs +3 -3
- package/dist/{long-query-thread-HK5FP64H.mjs → long-query-thread-6B2HXSBI.mjs} +13 -13
- package/dist/{msgpack-leaf-LIT7TKZW.mjs → msgpack-leaf-LTAJ5QGB.mjs} +2 -2
- package/dist/{optional-reads-ESDVS225.mjs → optional-reads-5QWIOFOU.mjs} +1 -1
- package/dist/{optional-writes-DPWRGFKK.mjs → optional-writes-27NHTIAL.mjs} +5 -5
- package/dist/{paged-partition-archive-NITVFYOC.mjs → paged-partition-archive-EFCEC4TD.mjs} +13 -13
- package/dist/partial-words.browser.mjs +3 -3
- package/dist/partial-words.mjs +3 -3
- package/dist/pattern.browser.mjs +2 -2
- package/dist/pattern.mjs +2 -2
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +10 -10
- package/dist/{query-actions-AA5LE2WV.mjs → query-actions-H6H54EJE.mjs} +3 -3
- package/dist/query-suggestions/merge-worker.mjs +6 -6
- package/dist/query-suggestions.browser.mjs +3 -3
- package/dist/query-suggestions.d.ts +2 -2
- package/dist/query-suggestions.mjs +4 -4
- package/dist/react-native/chunks/{chunk-6KVWTGEJ.mjs → chunk-7TURQEZZ.mjs} +84 -37
- package/dist/react-native/chunks/{chunk-ESVBC3AT.mjs → chunk-BIORJHQZ.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-AOLLV37A.mjs → chunk-CBG4EUYD.mjs} +17 -2
- package/dist/{chunk-7HVZVD2N.mjs → react-native/chunks/chunk-DYAAQB5R.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-HGZNA5A6.mjs → chunk-GCD64RZ2.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-OVYLUGEW.mjs → chunk-UTYWL2W6.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-ZZQ2RIYZ.mjs → chunk-XCJVLU6J.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-574N6ERF.mjs → chunk-YMIPG3VC.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-ZF3VSGEI.mjs → chunk-ZSJABTIE.mjs} +1 -1
- package/dist/react-native/chunks/{msgpack-leaf-FOUPTT7J.mjs → msgpack-leaf-Q4BPA4G7.mjs} +2 -2
- package/dist/react-native/chunks/{optional-reads-TN3PT6M4.mjs → optional-reads-M6F26KFO.mjs} +1 -1
- package/dist/react-native/chunks/{optional-writes-UYVKLJU6.mjs → optional-writes-NYFF5NTC.mjs} +4 -4
- package/dist/react-native/chunks/{restore-queue-AZIZ5ABX.mjs → restore-queue-4OXFRQ6N.mjs} +6 -6
- package/dist/react-native/chunks/{runtime-UOHD2XUJ.mjs → runtime-7UKADH3G.mjs} +2 -1
- package/dist/react-native/chunks/{segment-codec-leaf-TYO4LKQ6.mjs → segment-codec-leaf-YKUO5DU6.mjs} +4 -4
- package/dist/react-native/chunks/{segment-merge-leaf-KM52IXXQ.mjs → segment-merge-leaf-HIOWV5UN.mjs} +5 -5
- package/dist/react-native/chunks/{storage-leaf-HKJBZXIP.mjs → storage-leaf-H64VNQKE.mjs} +40 -20
- package/dist/react-native/chunks/{store-leaf-LS5LT25L.mjs → store-leaf-ZG5DR7QA.mjs} +5 -5
- package/dist/react-native/chunks/{suggestions-leaf-IJ3Z4EH3.mjs → suggestions-leaf-AJZ3SHZO.mjs} +5 -5
- package/dist/react-native/chunks/{worker-copies-VNXZRBVW.mjs → worker-copies-IY4ZIA6W.mjs} +4 -4
- package/dist/react-native/partial-words.mjs +3 -3
- package/dist/react-native/pattern.mjs +2 -2
- package/dist/react-native/query-suggestions.mjs +3 -3
- package/dist/react-native/sync.mjs +12 -7
- package/dist/react-native/synonyms.mjs +3 -3
- package/dist/react.d.ts +9 -9
- package/dist/{rerank-X4HOST2N.mjs → rerank-JTIQNROU.mjs} +25 -12
- package/dist/{restore-queue-CI72WRAF.mjs → restore-queue-JIJW3XKK.mjs} +6 -6
- package/dist/{runtime-USQYKN3I.mjs → runtime-WWFVQOBJ.mjs} +2 -1
- package/dist/{schema-CFnQ-WI3.d.ts → schema-CPQUdJTs.d.ts} +6 -0
- package/dist/{segment-codec-leaf-7R5H2IYU.mjs → segment-codec-leaf-LTIODLBH.mjs} +4 -4
- package/dist/{segment-merge-leaf-IWL4VH7C.mjs → segment-merge-leaf-CXOMXPAP.mjs} +4 -4
- package/dist/server.d.ts +22 -11
- package/dist/server.mjs +24 -20
- package/dist/{storage-leaf-6YCHFH2O.mjs → storage-leaf-VB5OG66O.mjs} +22 -22
- package/dist/{store-leaf-V5N2REHF.mjs → store-leaf-RBK3Y2H4.mjs} +5 -5
- package/dist/{suggestions-leaf-XFJ4L37A.mjs → suggestions-leaf-27TNMJ37.mjs} +7 -7
- package/dist/sync/filesystem.d.ts +3 -3
- package/dist/sync/filesystem.mjs +8 -8
- package/dist/sync/indexeddb.browser.mjs +1 -1
- package/dist/sync/indexeddb.d.ts +3 -3
- package/dist/sync/indexeddb.mjs +2 -2
- package/dist/sync.browser.mjs +7 -6
- package/dist/sync.d.ts +4 -4
- package/dist/sync.mjs +12 -7
- package/dist/synonyms.browser.mjs +3 -3
- package/dist/synonyms.mjs +3 -3
- package/dist/{tasks-Bpi5YNZF.d.ts → tasks-4rvZJuoN.d.ts} +8 -4
- package/dist/{thread-UQAIJ5CS.mjs → thread-J32AOE3H.mjs} +12 -12
- package/dist/{types-DGjk684l.d.ts → types-C3hkFf_3.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/{worker-copies-44MSY3IU.mjs → worker-copies-F2WVSQQO.mjs} +6 -6
- package/dist/workers/entry.mjs +9 -9
- package/openapi.json +58 -2
- package/package.json +5 -7
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Narsil is an open source search engine with full-text, vector, hybrid, and geose
|
|
|
15
15
|
The engine partitions large indexes across workers and merges the results of the partitions into a single ranked list. This TypeScript package is the reference implementation of the `.nrsl` format, and [a Rust crate and a Go module](#other-languages) hold the same engine for programs in those languages.
|
|
16
16
|
|
|
17
17
|
<!-- BENCH:headline START -->
|
|
18
|
-
On BEIR SciFact, the BM25 ranking of Narsil's TypeScript server scores 0.681 nDCG@10, which is within 0.002 of the Anserini reference of 0.679. Elasticsearch scores 0.679 and OpenSearch scores 0.679 on the same queries. A paired significance test over those queries finds no significant difference between Narsil, Elasticsearch, and OpenSearch. On SciFact, Narsil's TypeScript server answers
|
|
18
|
+
On BEIR SciFact, the BM25 ranking of Narsil's TypeScript server scores 0.681 nDCG@10, which is within 0.002 of the Anserini reference of 0.679. Elasticsearch scores 0.679 and OpenSearch scores 0.679 on the same queries. A paired significance test over those queries finds no significant difference between Narsil, Elasticsearch, and OpenSearch. On SciFact, Narsil's TypeScript server answers 34,198 keyword queries a second at its peak, and OpenSearch follows with 8,713. Narsil's Rust server answers 56,315 keyword queries a second at its peak. On DBpedia entities 1M with every engine held at 0.99 recall, Narsil's TypeScript server answers 1,659 vector queries a second at its peak, and OpenSearch answers 1,719. Narsil's Rust server answers 1,971 vector queries a second at its peak. With each engine's recommended production settings on the same set, Narsil's TypeScript server answers 3,766 vector queries a second at its peak, and OpenSearch follows with 2,849. Narsil's Rust server answers 3,847 vector queries a second at its peak. Narsil has the highest peak throughput in 20 of the 20 keyword, vector, and hybrid comparisons in the newest recorded run: all 12 with every engine on equal settings, and all 8 with each engine's recommended production settings. The harness recorded these figures on 2026-11-19 in run `20261119T135007Z`. GCP c3-standard-8 hardware in us-central1-a, us-east1-b, us-east4-a, us-south1-b, us-west1-a, us-west2-a, us-west3-b, and us-west4-a hosted the engines. You'll find every dataset, every engine's settings, and the full method in [`BENCHMARKS.md`](https://github.com/assetcorp/narsil/blob/main/BENCHMARKS.md).
|
|
19
19
|
<!-- BENCH:headline END -->
|
|
20
20
|
|
|
21
21
|
Try it in your browser at [narsil.sondelali.com/demo](https://narsil.sondelali.com/demo). Read the full documentation at [narsil.sondelali.com/docs](https://narsil.sondelali.com/docs).
|
|
@@ -1039,6 +1039,21 @@ function partialFieldsOf(schema) {
|
|
|
1039
1039
|
partialFieldsBySchema.set(schema, frozen);
|
|
1040
1040
|
return frozen;
|
|
1041
1041
|
}
|
|
1042
|
+
var vectorPathsBySchema = /* @__PURE__ */ new WeakMap();
|
|
1043
|
+
function vectorFieldSegmentsOf(schema) {
|
|
1044
|
+
const cached = vectorPathsBySchema.get(schema);
|
|
1045
|
+
if (cached !== void 0) return cached;
|
|
1046
|
+
const paths = [];
|
|
1047
|
+
for (const field of schemaFieldsOf(schema)) {
|
|
1048
|
+
if (field.base !== "vector") continue;
|
|
1049
|
+
const segments = field.path.split(".");
|
|
1050
|
+
Object.freeze(segments);
|
|
1051
|
+
paths.push(segments);
|
|
1052
|
+
}
|
|
1053
|
+
const frozen = Object.freeze(paths);
|
|
1054
|
+
vectorPathsBySchema.set(schema, frozen);
|
|
1055
|
+
return frozen;
|
|
1056
|
+
}
|
|
1042
1057
|
function extractVectorFieldsFromSchema(schema) {
|
|
1043
1058
|
const result = /* @__PURE__ */ new Map();
|
|
1044
1059
|
for (const field of schemaFieldsOf(schema)) {
|
|
@@ -1236,4 +1251,4 @@ function requireLoadedMessagePack() {
|
|
|
1236
1251
|
return loaded;
|
|
1237
1252
|
}
|
|
1238
1253
|
|
|
1239
|
-
export { ANTIMERIDIAN_SPAN_DEGREES, BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER, CHECKSUM_YIELD_CHUNK_BYTES, COMPACTION_ABSOLUTE_THRESHOLD, COMPACTION_TOMBSTONE_RATIO, CONNECT_RESTARTS_BEFORE_ONE_PASS, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, ClientErrorCodes, DEFAULT_EF_SEARCH, DEG_TO_RAD, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, DOCUMENT_REPLY_ENVELOPE_DEPTH, EARLIER_RELEASE_MIN_M, EARTH_RADIUS_METERS, ErrorCodes, FARTHEST_REJECTED_LINKS_KEPT, FULL_TURN_DEGREES, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, LOCATION_CELLS_PER_AXIS, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, MAX_DOCUMENT_ENCODING_DEPTH, MAX_DOCUMENT_NESTING_DEPTH, MAX_FILE_BYTES, MAX_LATITUDE_DEGREES, MAX_LAYER_CAP, MAX_LONGITUDE_DEGREES, MAX_M, MAX_NESTING_DEPTH, MAX_PATTERN_VALUE_LIMIT, MIN_M, MIN_PATTERN_VALUE_LIMIT, MIN_POLYGON_POINTS, NATIVE_CRC32_MIN_BYTES, NEAREST_LINK_FALLBACK_HOSTS, NarsilError, PLACEMENT_ROOM_REQUESTS, PROTOTYPE_POLLUTION_KEYS, SORT_MODES, SORT_VALUE_MAX_CODE_POINTS, ServerErrorCodes, VALID_HNSW_METRICS, VECTOR_PATTERN, codePointCount, compareCodePoints, createNarsilError, defaultSortMode, describeError, exceedsCodePoints, extractVectorFieldsFromSchema, flattenSchema, getFlatSchema, getNestedValue, getOrCreateFieldNameIndex, holdsUnpairedSurrogate, isGeopointOrVectorType, isLatitude, isListBase, isLongitude, isNarsilError, isPlainObject, isQuantizationMode, isSingleStringFieldType, isSortMode, isStorageMode, isStringValuedBase, isWordIndexedBase, isWordIndexedFieldType, loadMessagePack, loadedMessagePack, messagePackUpperBoundBytes, parseVectorDimension, parsedTypeOf, partialFieldsOf, raiseEarlierReleaseGraphSetting, requireCreatableSchema, requireDocumentWithinSizeLimit, requireLoadedMessagePack, requireValidFieldTypes, schemaFieldsOf, sortModeOf, textFieldsChanged, toComparableSortValue, tokenizeOptions, truncateSortString, validateDocument, validateDocumentStrict, validateRequiredFields, validateSchema, validateTextStorage, validateVectorPromotion, validateVectorStorage, vectorDimensionOf, withSortableOption, withUnpairedSurrogatesReplaced };
|
|
1254
|
+
export { ANTIMERIDIAN_SPAN_DEGREES, BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER, CHECKSUM_YIELD_CHUNK_BYTES, COMPACTION_ABSOLUTE_THRESHOLD, COMPACTION_TOMBSTONE_RATIO, CONNECT_RESTARTS_BEFORE_ONE_PASS, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, ClientErrorCodes, DEFAULT_EF_SEARCH, DEG_TO_RAD, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, DOCUMENT_REPLY_ENVELOPE_DEPTH, EARLIER_RELEASE_MIN_M, EARTH_RADIUS_METERS, ErrorCodes, FARTHEST_REJECTED_LINKS_KEPT, FULL_TURN_DEGREES, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, LOCATION_CELLS_PER_AXIS, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, MAX_DOCUMENT_ENCODING_DEPTH, MAX_DOCUMENT_NESTING_DEPTH, MAX_FILE_BYTES, MAX_LATITUDE_DEGREES, MAX_LAYER_CAP, MAX_LONGITUDE_DEGREES, MAX_M, MAX_NESTING_DEPTH, MAX_PATTERN_VALUE_LIMIT, MIN_M, MIN_PATTERN_VALUE_LIMIT, MIN_POLYGON_POINTS, NATIVE_CRC32_MIN_BYTES, NEAREST_LINK_FALLBACK_HOSTS, NarsilError, PLACEMENT_ROOM_REQUESTS, PROTOTYPE_POLLUTION_KEYS, SORT_MODES, SORT_VALUE_MAX_CODE_POINTS, ServerErrorCodes, VALID_HNSW_METRICS, VECTOR_PATTERN, codePointCount, compareCodePoints, createNarsilError, defaultSortMode, describeError, exceedsCodePoints, extractVectorFieldsFromSchema, flattenSchema, getFlatSchema, getNestedValue, getOrCreateFieldNameIndex, holdsUnpairedSurrogate, isGeopointOrVectorType, isLatitude, isListBase, isLongitude, isNarsilError, isPlainObject, isQuantizationMode, isSingleStringFieldType, isSortMode, isStorageMode, isStringValuedBase, isWordIndexedBase, isWordIndexedFieldType, loadMessagePack, loadedMessagePack, messagePackUpperBoundBytes, parseVectorDimension, parsedTypeOf, partialFieldsOf, raiseEarlierReleaseGraphSetting, requireCreatableSchema, requireDocumentWithinSizeLimit, requireLoadedMessagePack, requireValidFieldTypes, schemaFieldsOf, sortModeOf, textFieldsChanged, toComparableSortValue, tokenizeOptions, truncateSortString, validateDocument, validateDocumentStrict, validateRequiredFields, validateSchema, validateTextStorage, validateVectorPromotion, validateVectorStorage, vectorDimensionOf, vectorFieldSegmentsOf, withSortableOption, withUnpairedSurrogatesReplaced };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, storedText, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, discardStoredValues, bitsetIsEmpty, storedValuesOf, bitsetHas, createBitSet, bitsetSet, storedValueBytes, prepareStoredValues, cachedStoredFields, bitsetClear, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, buildStoredValues, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, checkedSize, fuzzyPrefixOf, boundedLevenshtein, installStoredFields, FILTER_OPERAND_COPY_DEPTH, fuzzyTermMatches, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES, bitsetIterator, GrowableUint32, bitsetFromSet } from './chunk-
|
|
1
|
+
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, storedText, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, discardStoredValues, bitsetIsEmpty, storedValuesOf, bitsetHas, createBitSet, bitsetSet, storedValueBytes, prepareStoredValues, cachedStoredFields, bitsetClear, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, buildStoredValues, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, checkedSize, fuzzyPrefixOf, boundedLevenshtein, installStoredFields, FILTER_OPERAND_COPY_DEPTH, fuzzyTermMatches, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES, bitsetIterator, GrowableUint32, bitsetFromSet } from './chunk-HIC42RBU.mjs';
|
|
2
2
|
import { newSyncEpoch, isSyncEpoch } from './chunk-YJHGOJAC.mjs';
|
|
3
|
-
import { parsedTypeOf, NarsilError, ErrorCodes, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, createNarsilError, withUnpairedSurrogatesReplaced, tokenizeOptions, getNestedValue, isPlainObject, MAX_NESTING_DEPTH, loadMessagePack, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, extractVectorFieldsFromSchema, loadedMessagePack, flattenSchema, vectorDimensionOf, isSingleStringFieldType, schemaFieldsOf, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, isStringValuedBase, compareCodePoints, isWordIndexedFieldType, messagePackUpperBoundBytes, toComparableSortValue, exceedsCodePoints, SORT_VALUE_MAX_CODE_POINTS, PROTOTYPE_POLLUTION_KEYS, sortModeOf, defaultSortMode, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, getOrCreateFieldNameIndex, isWordIndexedBase, holdsUnpairedSurrogate, validateRequiredFields, requireDocumentWithinSizeLimit, isNarsilError, PLACEMENT_ROOM_REQUESTS, NEAREST_LINK_FALLBACK_HOSTS, MIN_M, MAX_M, MAX_LAYER_CAP, MAX_FILE_BYTES, INITIAL_UPPER_SLOTS, INITIAL_LIST_CAPACITY, FARTHEST_REJECTED_LINKS_KEPT, EARLIER_RELEASE_MIN_M, DEFAULT_EF_SEARCH, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, CONNECT_RESTARTS_BEFORE_ONE_PASS, COMPACTION_TOMBSTONE_RATIO, COMPACTION_ABSOLUTE_THRESHOLD, requireValidFieldTypes, parseVectorDimension, isStorageMode, isQuantizationMode, VALID_HNSW_METRICS, MAX_DOCUMENT_NESTING_DEPTH, NATIVE_CRC32_MIN_BYTES, CHECKSUM_YIELD_CHUNK_BYTES, raiseEarlierReleaseGraphSetting, MAX_DOCUMENT_ENCODING_DEPTH, DOCUMENT_REPLY_ENVELOPE_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER, withSortableOption, VECTOR_PATTERN, isListBase, isGeopointOrVectorType, MAX_COVERING_CELLS, LOCATION_CODE_BITS_PER_AXIS, LOCATION_CELLS_PER_AXIS, FULL_TURN_DEGREES, EARTH_RADIUS_METERS, DEG_TO_RAD, ANTIMERIDIAN_SPAN_DEGREES, truncateSortString, SORT_MODES, isSortMode, codePointCount } from './chunk-
|
|
3
|
+
import { parsedTypeOf, NarsilError, ErrorCodes, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, createNarsilError, withUnpairedSurrogatesReplaced, tokenizeOptions, getNestedValue, isPlainObject, MAX_NESTING_DEPTH, loadMessagePack, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, extractVectorFieldsFromSchema, loadedMessagePack, flattenSchema, vectorDimensionOf, isSingleStringFieldType, schemaFieldsOf, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, isStringValuedBase, compareCodePoints, isWordIndexedFieldType, messagePackUpperBoundBytes, toComparableSortValue, exceedsCodePoints, vectorFieldSegmentsOf, SORT_VALUE_MAX_CODE_POINTS, PROTOTYPE_POLLUTION_KEYS, sortModeOf, defaultSortMode, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, getOrCreateFieldNameIndex, isWordIndexedBase, holdsUnpairedSurrogate, validateRequiredFields, requireDocumentWithinSizeLimit, isNarsilError, PLACEMENT_ROOM_REQUESTS, NEAREST_LINK_FALLBACK_HOSTS, MIN_M, MAX_M, MAX_LAYER_CAP, MAX_FILE_BYTES, INITIAL_UPPER_SLOTS, INITIAL_LIST_CAPACITY, FARTHEST_REJECTED_LINKS_KEPT, EARLIER_RELEASE_MIN_M, DEFAULT_EF_SEARCH, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, CONNECT_RESTARTS_BEFORE_ONE_PASS, COMPACTION_TOMBSTONE_RATIO, COMPACTION_ABSOLUTE_THRESHOLD, requireValidFieldTypes, parseVectorDimension, isStorageMode, isQuantizationMode, VALID_HNSW_METRICS, MAX_DOCUMENT_NESTING_DEPTH, NATIVE_CRC32_MIN_BYTES, CHECKSUM_YIELD_CHUNK_BYTES, raiseEarlierReleaseGraphSetting, MAX_DOCUMENT_ENCODING_DEPTH, DOCUMENT_REPLY_ENVELOPE_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER, withSortableOption, VECTOR_PATTERN, isListBase, isGeopointOrVectorType, MAX_COVERING_CELLS, LOCATION_CODE_BITS_PER_AXIS, LOCATION_CELLS_PER_AXIS, FULL_TURN_DEGREES, EARTH_RADIUS_METERS, DEG_TO_RAD, ANTIMERIDIAN_SPAN_DEGREES, truncateSortString, SORT_MODES, isSortMode, codePointCount } from './chunk-3PGIOK7Z.mjs';
|
|
4
4
|
|
|
5
5
|
// src/analysis/registry.ts
|
|
6
6
|
var tokenizers = /* @__PURE__ */ new Map();
|
|
@@ -2398,6 +2398,8 @@ function copyStoredValue(value) {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
|
|
2400
2400
|
// src/core/projection.ts
|
|
2401
|
+
var EVERY_FIELD = Object.freeze({ kind: "full" });
|
|
2402
|
+
var NO_FIELD = Object.freeze({ kind: "none" });
|
|
2401
2403
|
function requireFieldPathList(paths, option) {
|
|
2402
2404
|
if (paths === void 0) return;
|
|
2403
2405
|
if (!Array.isArray(paths)) {
|
|
@@ -2417,13 +2419,14 @@ function requireFieldPathList(paths, option) {
|
|
|
2417
2419
|
);
|
|
2418
2420
|
}
|
|
2419
2421
|
}
|
|
2420
|
-
function splitPaths(paths) {
|
|
2422
|
+
function splitPaths(paths, vectorFields) {
|
|
2421
2423
|
if (!paths) return [];
|
|
2422
2424
|
const split = [];
|
|
2423
2425
|
for (const path of paths) {
|
|
2424
2426
|
const segments2 = path.split(".").filter((segment) => segment.length > 0);
|
|
2425
2427
|
if (segments2.length === 0) continue;
|
|
2426
2428
|
if (segments2.some((segment) => PROTOTYPE_POLLUTION_KEYS.has(segment))) continue;
|
|
2429
|
+
if (vectorFields.some((field) => field.length < segments2.length && covers(field, segments2))) continue;
|
|
2427
2430
|
split.push(segments2);
|
|
2428
2431
|
}
|
|
2429
2432
|
return split;
|
|
@@ -2486,20 +2489,41 @@ function cloneExcept(value, path, exclude) {
|
|
|
2486
2489
|
}
|
|
2487
2490
|
return kept;
|
|
2488
2491
|
}
|
|
2489
|
-
function
|
|
2490
|
-
if (
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2492
|
+
function requireVectorsSwitch(vectors) {
|
|
2493
|
+
if (vectors === void 0 || typeof vectors === "boolean") return;
|
|
2494
|
+
throw new NarsilError(ErrorCodes.SEARCH_INVALID_FIELD, 'The "document.vectors" option takes true or false', {
|
|
2495
|
+
option: "document.vectors",
|
|
2496
|
+
received: vectors === null ? "null" : typeof vectors
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
function samePath(a, b) {
|
|
2500
|
+
return a.length === b.length && covers(a, b);
|
|
2501
|
+
}
|
|
2502
|
+
function returnsVectorField(field, vectors, include, returnVectors) {
|
|
2503
|
+
if (vectors !== void 0) return vectors;
|
|
2504
|
+
if (include?.some((included) => samePath(included, field))) return true;
|
|
2505
|
+
return returnVectors;
|
|
2506
|
+
}
|
|
2507
|
+
function resolveProjection(projection, index) {
|
|
2508
|
+
if (projection === false) return NO_FIELD;
|
|
2509
|
+
const shaped = typeof projection === "object" && projection !== null ? projection : void 0;
|
|
2510
|
+
if (shaped !== void 0) {
|
|
2511
|
+
requireFieldPathList(shaped.include, "include");
|
|
2512
|
+
requireFieldPathList(shaped.exclude, "exclude");
|
|
2513
|
+
requireVectorsSwitch(shaped.vectors);
|
|
2514
|
+
}
|
|
2515
|
+
const askedInclude = shaped !== void 0 && Array.isArray(shaped.include) && shaped.include.length > 0;
|
|
2516
|
+
const askedExclude = shaped !== void 0 && Array.isArray(shaped.exclude) && shaped.exclude.length > 0;
|
|
2517
|
+
const returnsEveryVector = shaped?.vectors ?? index.returnVectors === true;
|
|
2518
|
+
if (!askedInclude && !askedExclude && returnsEveryVector) return EVERY_FIELD;
|
|
2519
|
+
const vectorFields = vectorFieldSegmentsOf(index.schema);
|
|
2520
|
+
const include = askedInclude ? splitPaths(shaped.include, vectorFields) : null;
|
|
2521
|
+
const exclude = askedExclude ? splitPaths(shaped.exclude, vectorFields) : [];
|
|
2522
|
+
for (const field of vectorFields) {
|
|
2523
|
+
if (!returnsVectorField(field, shaped?.vectors, include, index.returnVectors === true)) exclude.push(field);
|
|
2524
|
+
}
|
|
2525
|
+
if (include === null && exclude.length === 0) return EVERY_FIELD;
|
|
2526
|
+
return { kind: "fields", include, exclude };
|
|
2503
2527
|
}
|
|
2504
2528
|
function projectionKeepsField(projection, fieldPath) {
|
|
2505
2529
|
if (projection.kind === "full") return true;
|
|
@@ -5322,6 +5346,12 @@ function validatePatternValueLimit(limit) {
|
|
|
5322
5346
|
);
|
|
5323
5347
|
}
|
|
5324
5348
|
}
|
|
5349
|
+
function validateReturnVectors(returnVectors) {
|
|
5350
|
+
if (returnVectors === void 0 || typeof returnVectors === "boolean") return;
|
|
5351
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "returnVectors must be true or false", {
|
|
5352
|
+
returnVectors: returnVectors === null ? "null" : typeof returnVectors
|
|
5353
|
+
});
|
|
5354
|
+
}
|
|
5325
5355
|
function requirePositiveSafeInteger(field, value) {
|
|
5326
5356
|
if (value === void 0) return;
|
|
5327
5357
|
if (!Number.isSafeInteger(value) || value < 1) {
|
|
@@ -12381,7 +12411,7 @@ function segmentsHostPart() {
|
|
|
12381
12411
|
|
|
12382
12412
|
// src/core/segment-codec-code.ts
|
|
12383
12413
|
var segmentCodec = codeLoader(async () => {
|
|
12384
|
-
const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-
|
|
12414
|
+
const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-NDVBIBJJ.mjs')]);
|
|
12385
12415
|
code7.bindSegmentCodecHost(optionalCodeHost(), msgpack);
|
|
12386
12416
|
return code7;
|
|
12387
12417
|
}, "segment codec");
|
|
@@ -13950,6 +13980,7 @@ function configurationPayloadOf(config, language, adapterName, analysisRevision,
|
|
|
13950
13980
|
...config.trackPositions !== void 0 ? { trackPositions: config.trackPositions } : {},
|
|
13951
13981
|
...config.textStorage !== void 0 ? { textStorage: config.textStorage } : {},
|
|
13952
13982
|
...config.strict !== void 0 ? { strict: config.strict } : {},
|
|
13983
|
+
...config.returnVectors !== void 0 ? { returnVectors: config.returnVectors } : {},
|
|
13953
13984
|
...config.required !== void 0 ? { required: config.required } : {},
|
|
13954
13985
|
...config.vectorPromotion !== void 0 ? { vectorPromotion: config.vectorPromotion } : {},
|
|
13955
13986
|
...config.patternValueLimit !== void 0 ? { patternValueLimit: config.patternValueLimit } : {},
|
|
@@ -14025,6 +14056,7 @@ async function createEngineIndex(core2, config, name, requestedConfig, creation
|
|
|
14025
14056
|
requirePatternSearchFor(schema);
|
|
14026
14057
|
requirePartialWordSearchFor(schema);
|
|
14027
14058
|
validatePatternValueLimit(indexConfig.patternValueLimit);
|
|
14059
|
+
validateReturnVectors(indexConfig.returnVectors);
|
|
14028
14060
|
requireSurfaceFormsForPartialFields(schema, indexConfig.surfaceForms);
|
|
14029
14061
|
validateVectorPromotion(indexConfig.vectorPromotion);
|
|
14030
14062
|
validateVectorStorage(indexConfig.vectorPromotion, core2.filesystemDurability);
|
|
@@ -19238,7 +19270,7 @@ var storageCode = codeLoader(async () => {
|
|
|
19238
19270
|
loadSegmentMerge(),
|
|
19239
19271
|
loadSuggestionStore(),
|
|
19240
19272
|
loadVectorCore(),
|
|
19241
|
-
import('./storage-leaf-
|
|
19273
|
+
import('./storage-leaf-NCOXQTXQ.mjs')
|
|
19242
19274
|
]);
|
|
19243
19275
|
code7.bindStorageHost(optionalCodeHost(), digest2, msgpack, segmentCodec2, segmentMerge2, suggestionStore2, vectorCore2);
|
|
19244
19276
|
return code7;
|
|
@@ -19990,7 +20022,7 @@ var loaded2 = null;
|
|
|
19990
20022
|
var loading3 = null;
|
|
19991
20023
|
function importOptionalReads() {
|
|
19992
20024
|
if (loaded2 !== null) return Promise.resolve(loaded2);
|
|
19993
|
-
loading3 ??= import('./optional-reads-
|
|
20025
|
+
loading3 ??= import('./optional-reads-4O4CJ7TR.mjs').then(
|
|
19994
20026
|
(code7) => {
|
|
19995
20027
|
code7.bindOptionalReadsHost(optionalCodeHost());
|
|
19996
20028
|
loaded2 = code7;
|
|
@@ -20768,7 +20800,7 @@ function createDirectExecutor(options) {
|
|
|
20768
20800
|
}
|
|
20769
20801
|
case "get": {
|
|
20770
20802
|
const entry = requireIndex(action.indexName);
|
|
20771
|
-
return entry.manager.get(action.docId);
|
|
20803
|
+
return entry.manager.get(action.docId, action.projection);
|
|
20772
20804
|
}
|
|
20773
20805
|
case "has": {
|
|
20774
20806
|
const entry = requireIndex(action.indexName);
|
|
@@ -21629,7 +21661,7 @@ function checkHeapAfterRecovery(core2) {
|
|
|
21629
21661
|
var loaded3 = null;
|
|
21630
21662
|
function loadRerankRuntime() {
|
|
21631
21663
|
if (loaded3 !== null) return Promise.resolve(loaded3);
|
|
21632
|
-
return import('./runtime-
|
|
21664
|
+
return import('./runtime-AMEB4J2D.mjs').then((runtime) => {
|
|
21633
21665
|
runtime.bindRerankHost(optionalCodeHost());
|
|
21634
21666
|
loaded3 = runtime;
|
|
21635
21667
|
return runtime;
|
|
@@ -22769,7 +22801,7 @@ async function runQuery(request, callerContext, pin) {
|
|
|
22769
22801
|
offset,
|
|
22770
22802
|
sortFields,
|
|
22771
22803
|
sortSignature,
|
|
22772
|
-
projection: resolveProjection(params.document),
|
|
22804
|
+
projection: resolveProjection(params.document, config),
|
|
22773
22805
|
placesPinned: context.partitionIds === void 0
|
|
22774
22806
|
},
|
|
22775
22807
|
highlighting: {
|
|
@@ -23117,6 +23149,7 @@ async function runEngineListDocuments(core2, indexName, params, partitionIds) {
|
|
|
23117
23149
|
manager,
|
|
23118
23150
|
schema: entry.config.schema,
|
|
23119
23151
|
strict: entry.config.strict,
|
|
23152
|
+
returnVectors: entry.config.returnVectors,
|
|
23120
23153
|
partitionIds,
|
|
23121
23154
|
patternWorkCap: core2.patternWorkCap
|
|
23122
23155
|
})
|
|
@@ -23276,20 +23309,31 @@ function createNarsilFromCore(core2, config) {
|
|
|
23276
23309
|
requireIndex(indexName);
|
|
23277
23310
|
return orchestrator.awaitWrites(indexName);
|
|
23278
23311
|
},
|
|
23279
|
-
async get(indexName, docId) {
|
|
23280
|
-
return withOpenIndex2(
|
|
23312
|
+
async get(indexName, docId, options) {
|
|
23313
|
+
return withOpenIndex2(
|
|
23314
|
+
indexName,
|
|
23315
|
+
() => executor.execute({
|
|
23316
|
+
type: "get",
|
|
23317
|
+
indexName,
|
|
23318
|
+
docId,
|
|
23319
|
+
requestId: docId,
|
|
23320
|
+
projection: resolveProjection(options?.document, requireIndex(indexName).config)
|
|
23321
|
+
})
|
|
23322
|
+
);
|
|
23281
23323
|
},
|
|
23282
|
-
async getMultiple(indexName, docIds) {
|
|
23324
|
+
async getMultiple(indexName, docIds, options) {
|
|
23283
23325
|
guardShutdown();
|
|
23284
23326
|
requireIndex(indexName);
|
|
23285
23327
|
return withOpenIndex2(indexName, async () => {
|
|
23328
|
+
const projection = resolveProjection(options?.document, requireIndex(indexName).config);
|
|
23286
23329
|
const result = /* @__PURE__ */ new Map();
|
|
23287
23330
|
for (const docId of docIds) {
|
|
23288
23331
|
const doc = await executor.execute({
|
|
23289
23332
|
type: "get",
|
|
23290
23333
|
indexName,
|
|
23291
23334
|
docId,
|
|
23292
|
-
requestId: docId
|
|
23335
|
+
requestId: docId,
|
|
23336
|
+
projection
|
|
23293
23337
|
});
|
|
23294
23338
|
if (doc !== void 0) result.set(docId, doc);
|
|
23295
23339
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NarsilError, ErrorCodes, loadMessagePack, ClientErrorCodes, ServerErrorCodes, describeError } from './chunk-
|
|
1
|
+
import { NarsilError, ErrorCodes, loadMessagePack, ClientErrorCodes, ServerErrorCodes, describeError } from './chunk-3PGIOK7Z.mjs';
|
|
2
2
|
|
|
3
3
|
// src/json-encoding.ts
|
|
4
4
|
function toPlainNumbers(key, value) {
|
|
@@ -290,7 +290,7 @@ function createBulkOperations(transport) {
|
|
|
290
290
|
const payload = await transport.json({
|
|
291
291
|
method: "POST",
|
|
292
292
|
path,
|
|
293
|
-
body: encodeJson({ docIds }),
|
|
293
|
+
body: encodeJson(options?.document === void 0 ? { docIds } : { docIds, document: options.document }),
|
|
294
294
|
contentType: "application/json",
|
|
295
295
|
repeatable: true,
|
|
296
296
|
options
|
|
@@ -701,7 +701,11 @@ function createDocumentOperations(transport) {
|
|
|
701
701
|
},
|
|
702
702
|
async get(indexName, docId, options) {
|
|
703
703
|
const path = documentPath(indexName, docId);
|
|
704
|
-
const
|
|
704
|
+
const vectors = options?.vectors;
|
|
705
|
+
const payload = await transport.jsonOrNull(
|
|
706
|
+
{ method: "GET", path, query: { vectors: vectors === void 0 ? void 0 : String(vectors) }, options },
|
|
707
|
+
ErrorCodes.DOC_NOT_FOUND
|
|
708
|
+
);
|
|
705
709
|
if (payload === null) return void 0;
|
|
706
710
|
return readObject(payload, "document", path);
|
|
707
711
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NarsilError, ErrorCodes, requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-
|
|
1
|
+
import { NarsilError, ErrorCodes, requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-3PGIOK7Z.mjs';
|
|
2
2
|
|
|
3
3
|
// src/core/stored-values/build.ts
|
|
4
4
|
var ORDINAL_LIMIT = 4294967295;
|
|
@@ -3148,7 +3148,7 @@ function executeListDocuments(params, context) {
|
|
|
3148
3148
|
const signature = sortSignatureOf(params.sort);
|
|
3149
3149
|
requireSortableFields(params.sort, schema, context.strict === true);
|
|
3150
3150
|
const filters = validQueryFilter(params.filters, schema);
|
|
3151
|
-
const projection = resolveProjection(params.document);
|
|
3151
|
+
const projection = resolveProjection(params.document, context);
|
|
3152
3152
|
const binding = listBindingOf(params.filters);
|
|
3153
3153
|
let cursor = null;
|
|
3154
3154
|
if (params.cursor !== void 0) {
|
|
@@ -326,7 +326,7 @@ async function runRerankedQuery(request, io) {
|
|
|
326
326
|
const offset = host.clampRowCount(request.offset, DEFAULT_OFFSET);
|
|
327
327
|
const cursorDepth = request.searchAfter === void 0 ? 0 : rerankCursorDepth(request.searchAfter, io.binding, host);
|
|
328
328
|
const depth = firstStageDepth(hybridDepth, plan.window, cursorDepth, offset, limit);
|
|
329
|
-
const projection = host.resolveProjection(request.document);
|
|
329
|
+
const projection = host.resolveProjection(request.document, io);
|
|
330
330
|
const { rerank: _rerank, pinned: _pinned, searchAfter: _searchAfter, highlight: _highlight, ...firstParams } = request;
|
|
331
331
|
const placesPins = request.searchAfter === void 0 && request.pinned !== void 0;
|
|
332
332
|
const countsApart = placesPins || request.vector !== void 0 && !fuses;
|
|
@@ -404,6 +404,7 @@ async function executeRerankedQuery(request, context, firstStage, host) {
|
|
|
404
404
|
const result = await runRerankedQuery(request, {
|
|
405
405
|
host,
|
|
406
406
|
schema: context.config.schema,
|
|
407
|
+
returnVectors: context.config.returnVectors,
|
|
407
408
|
maxWindow: runner.maxWindow,
|
|
408
409
|
binding: context.cursorBinding,
|
|
409
410
|
clampsPins: true,
|
|
@@ -111,6 +111,9 @@ function reconstructSchemaFromMetadata(metadata) {
|
|
|
111
111
|
if (metadata.strict !== void 0) {
|
|
112
112
|
config.strict = metadata.strict;
|
|
113
113
|
}
|
|
114
|
+
if (metadata.returnVectors !== void 0) {
|
|
115
|
+
config.returnVectors = metadata.returnVectors;
|
|
116
|
+
}
|
|
114
117
|
if (metadata.required !== void 0) {
|
|
115
118
|
config.required = metadata.required;
|
|
116
119
|
}
|
|
@@ -3484,6 +3484,7 @@ function readSharedConfigFields(source, reject) {
|
|
|
3484
3484
|
reject("textStorage must be 'memory' or 'disk'");
|
|
3485
3485
|
}
|
|
3486
3486
|
const strict = restoredBoolean(source.strict, "strict", reject);
|
|
3487
|
+
const returnVectors = restoredBoolean(source.returnVectors, "returnVectors", reject);
|
|
3487
3488
|
const required = restoredRequired(source.required, reject);
|
|
3488
3489
|
const vectorPromotion = restoredVectorPromotion(source.vectorPromotion, reject);
|
|
3489
3490
|
if (source.patternValueLimit !== void 0 && typeof source.patternValueLimit !== "number") {
|
|
@@ -3498,6 +3499,7 @@ function readSharedConfigFields(source, reject) {
|
|
|
3498
3499
|
...trackPositions !== void 0 ? { trackPositions } : {},
|
|
3499
3500
|
...textStorage === "memory" || textStorage === "disk" ? { textStorage } : {},
|
|
3500
3501
|
...strict !== void 0 ? { strict } : {},
|
|
3502
|
+
...returnVectors !== void 0 ? { returnVectors } : {},
|
|
3501
3503
|
...required !== void 0 ? { required } : {},
|
|
3502
3504
|
...vectorPromotion !== void 0 ? { vectorPromotion } : {},
|
|
3503
3505
|
...typeof source.patternValueLimit === "number" ? { patternValueLimit: source.patternValueLimit } : {}
|
|
@@ -8511,12 +8513,15 @@ function markerSlotOffset(slotIndex) {
|
|
|
8511
8513
|
function isRecord6(value) {
|
|
8512
8514
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8513
8515
|
}
|
|
8516
|
+
function invalidReplicationPayload(message) {
|
|
8517
|
+
return new NarsilError(ErrorCodes.REPLICATION_ENTRY_INVALID, message);
|
|
8518
|
+
}
|
|
8514
8519
|
function optionalIndexUuid(value, payloadName) {
|
|
8515
8520
|
if (value === void 0 || value === null) {
|
|
8516
8521
|
return void 0;
|
|
8517
8522
|
}
|
|
8518
8523
|
if (typeof value !== "string" || value.length === 0) {
|
|
8519
|
-
throw
|
|
8524
|
+
throw invalidReplicationPayload(`Invalid ${payloadName}: "indexUuid" must be a non-empty string or absent`);
|
|
8520
8525
|
}
|
|
8521
8526
|
return value;
|
|
8522
8527
|
}
|
|
@@ -8525,41 +8530,46 @@ function optionalPreviousPrimaryTerm(value, payloadName) {
|
|
|
8525
8530
|
return void 0;
|
|
8526
8531
|
}
|
|
8527
8532
|
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
8528
|
-
throw
|
|
8533
|
+
throw invalidReplicationPayload(
|
|
8534
|
+
`Invalid ${payloadName}: "previousPrimaryTerm" must be a non-negative integer or absent`
|
|
8535
|
+
);
|
|
8529
8536
|
}
|
|
8530
8537
|
return value;
|
|
8531
8538
|
}
|
|
8532
8539
|
function validateEntryPayload(decoded) {
|
|
8533
8540
|
if (!isRecord6(decoded) || !isRecord6(decoded.entry)) {
|
|
8534
|
-
throw
|
|
8541
|
+
throw invalidReplicationPayload('Invalid EntryPayload: missing or invalid "entry" field');
|
|
8535
8542
|
}
|
|
8536
8543
|
const entry = decoded.entry;
|
|
8537
8544
|
if (typeof entry.seqNo !== "number") {
|
|
8538
|
-
throw
|
|
8545
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.seqNo" must be a number');
|
|
8539
8546
|
}
|
|
8540
8547
|
if (typeof entry.primaryTerm !== "number") {
|
|
8541
|
-
throw
|
|
8548
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.primaryTerm" must be a number');
|
|
8542
8549
|
}
|
|
8543
8550
|
if (entry.operation !== "INDEX" && entry.operation !== "DELETE") {
|
|
8544
|
-
throw
|
|
8551
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.operation" must be "INDEX" or "DELETE"');
|
|
8545
8552
|
}
|
|
8546
8553
|
if (typeof entry.partitionId !== "number") {
|
|
8547
|
-
throw
|
|
8554
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.partitionId" must be a number');
|
|
8548
8555
|
}
|
|
8549
8556
|
if (typeof entry.indexName !== "string") {
|
|
8550
|
-
throw
|
|
8557
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.indexName" must be a string');
|
|
8551
8558
|
}
|
|
8552
8559
|
if (typeof entry.documentId !== "string") {
|
|
8553
|
-
throw
|
|
8560
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.documentId" must be a string');
|
|
8554
8561
|
}
|
|
8562
|
+
entry.document ??= null;
|
|
8555
8563
|
if (entry.document !== null && !(entry.document instanceof Uint8Array)) {
|
|
8556
|
-
throw
|
|
8564
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.document" must be binary or absent');
|
|
8557
8565
|
}
|
|
8558
8566
|
if ("previousDocument" in entry && entry.previousDocument !== null && !(entry.previousDocument instanceof Uint8Array)) {
|
|
8559
|
-
throw
|
|
8567
|
+
throw invalidReplicationPayload(
|
|
8568
|
+
'Invalid EntryPayload: "entry.previousDocument" must be Uint8Array or null where present'
|
|
8569
|
+
);
|
|
8560
8570
|
}
|
|
8561
8571
|
if (typeof entry.checksum !== "number") {
|
|
8562
|
-
throw
|
|
8572
|
+
throw invalidReplicationPayload('Invalid EntryPayload: "entry.checksum" must be a number');
|
|
8563
8573
|
}
|
|
8564
8574
|
optionalIndexUuid(decoded.indexUuid, "EntryPayload");
|
|
8565
8575
|
optionalPreviousPrimaryTerm(decoded.previousPrimaryTerm, "EntryPayload");
|
|
@@ -11735,6 +11745,9 @@ function metadataFromConfig(indexName, config, partitionCount, documentCount, sa
|
|
|
11735
11745
|
if (config.strict !== void 0) {
|
|
11736
11746
|
metadata.strict = config.strict;
|
|
11737
11747
|
}
|
|
11748
|
+
if (config.returnVectors !== void 0) {
|
|
11749
|
+
metadata.returnVectors = config.returnVectors;
|
|
11750
|
+
}
|
|
11738
11751
|
if (config.required !== void 0) {
|
|
11739
11752
|
metadata.required = config.required;
|
|
11740
11753
|
}
|
|
@@ -11790,6 +11803,7 @@ function metadataConfigOf(entry) {
|
|
|
11790
11803
|
...entry.config.trackPositions !== void 0 ? { trackPositions: entry.config.trackPositions } : {},
|
|
11791
11804
|
...entry.config.textStorage !== void 0 ? { textStorage: entry.config.textStorage } : {},
|
|
11792
11805
|
...entry.config.strict !== void 0 ? { strict: entry.config.strict } : {},
|
|
11806
|
+
...entry.config.returnVectors !== void 0 ? { returnVectors: entry.config.returnVectors } : {},
|
|
11793
11807
|
...entry.config.required !== void 0 ? { required: entry.config.required } : {},
|
|
11794
11808
|
...entry.config.vectorPromotion !== void 0 ? { vectorPromotion: entry.config.vectorPromotion } : {},
|
|
11795
11809
|
...entry.config.patternValueLimit !== void 0 ? { patternValueLimit: entry.config.patternValueLimit } : {},
|
|
@@ -12335,6 +12349,9 @@ function metadataToWire(meta) {
|
|
|
12335
12349
|
if (meta.strict !== void 0) {
|
|
12336
12350
|
wire.strict = meta.strict;
|
|
12337
12351
|
}
|
|
12352
|
+
if (meta.returnVectors !== void 0) {
|
|
12353
|
+
wire.return_vectors = meta.returnVectors;
|
|
12354
|
+
}
|
|
12338
12355
|
if (meta.required !== void 0) {
|
|
12339
12356
|
wire.required = meta.required;
|
|
12340
12357
|
}
|
|
@@ -12461,6 +12478,9 @@ function wireToMetadata(raw) {
|
|
|
12461
12478
|
if (typeof raw.strict === "boolean") {
|
|
12462
12479
|
meta.strict = raw.strict;
|
|
12463
12480
|
}
|
|
12481
|
+
if (typeof raw.return_vectors === "boolean") {
|
|
12482
|
+
meta.returnVectors = raw.return_vectors;
|
|
12483
|
+
}
|
|
12464
12484
|
if (Array.isArray(raw.required) && raw.required.every((field) => typeof field === "string")) {
|
|
12465
12485
|
meta.required = raw.required;
|
|
12466
12486
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as EmbeddingAdapter, R as RerankAdapter } from './adapters-8LcdNB77.js';
|
|
2
|
-
import { C as ClusterNamespace } from './config-
|
|
2
|
+
import { C as ClusterNamespace } from './config-DlvP2PSi.js';
|
|
3
3
|
import { l as RecordedQuery } from './query-suggestions-CBYkrQ5T.js';
|
|
4
|
-
import { E as ErrorDetail, j as TaskStore } from './tasks-
|
|
4
|
+
import { E as ErrorDetail, j as TaskStore } from './tasks-4rvZJuoN.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The settings of the device sync routes, `GET /indexes/{name}/sync/snapshot`
|