@yoch/frozenminisearch 1.0.0 → 1.0.2

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.
@@ -5,6 +5,7 @@ const main = mod.default || mod
5
5
 
6
6
  module.exports = main
7
7
  module.exports.default = main
8
+ module.exports.FrozenMiniSearch = main
8
9
 
9
10
  for (const key of Object.keys(mod)) {
10
11
  if (key !== 'default') {
@@ -411,6 +411,21 @@ interface FrozenPostingsLayout {
411
411
  /** Adaptive-width unsigned column (1/2/4 bytes per element) for field lengths and packed radix columns. */
412
412
  type FieldLengthArray = PackedIndexArray;
413
413
 
414
+ /**
415
+ * Runtime stored fields. Single store field → one column (no per-doc Record at rest).
416
+ * Wire format stays row JSON; encode/decode can skip intermediate row arrays when layout is known.
417
+ */
418
+ type StoredFieldsLayout = {
419
+ kind: 'none';
420
+ } | {
421
+ kind: 'single';
422
+ field: string;
423
+ values: unknown[];
424
+ } | {
425
+ kind: 'multi';
426
+ rows: (Record<string, unknown> | undefined)[];
427
+ };
428
+
414
429
  interface FrozenMemoryBreakdown {
415
430
  termCount: number;
416
431
  documentCount: number;
@@ -456,7 +471,7 @@ interface FrozenAssembleParams<T = any> {
456
471
  fieldCount: number;
457
472
  externalIds: unknown[];
458
473
  idLookup: IdToShortIdLookup;
459
- storedFields: (Record<string, unknown> | undefined)[];
474
+ storedFields: StoredFieldsLayout;
460
475
  fieldLengthMatrix: FieldLengthArray;
461
476
  avgFieldLength: Float32Array;
462
477
  index: FrozenTermIndex;
@@ -494,22 +509,24 @@ type MiniSearchSnapshot = {
494
509
  interface FrozenIndexBuilderHints {
495
510
  /** Pre-size per-document arrays when the final document count is known. */
496
511
  estimatedDocumentCount?: number;
512
+ /** Hint for initial growable posting column capacity per (term, field) slot. */
513
+ estimatedPostingsPerSlot?: number;
497
514
  }
498
515
  /** Incremental builder for {@link FrozenMiniSearch} without materializing a full `documents[]` array. */
499
516
  declare class FrozenIndexBuilder<T> {
500
517
  private readonly _options;
501
518
  private readonly _fieldIds;
502
519
  private readonly _fieldCount;
503
- private readonly _index;
504
- private readonly _terms;
505
- private readonly _postingsDocIds;
506
- private readonly _postingsFreqs;
520
+ private _index;
521
+ private readonly _postings;
522
+ private readonly _termCount;
507
523
  private readonly _externalIds;
508
524
  private readonly _storedFields;
509
525
  private readonly _fieldLengthData;
510
526
  private readonly _avgFieldLength;
511
- private readonly _postingsState;
512
527
  private readonly _seenIds;
528
+ private readonly _fieldTermFreqScratch;
529
+ private readonly _tokenScratch;
513
530
  private _nextId;
514
531
  private _frozen;
515
532
  constructor(options: Options<T>, hints?: FrozenIndexBuilderHints);
@@ -616,5 +633,5 @@ declare class FrozenMiniSearch<T = any> {
616
633
  private executeQuery;
617
634
  }
618
635
 
619
- export { AND, AND_NOT, FrozenIndexBuilder, OR, assembleFrozen, buildFrozenFromDocuments, createFrozenIndexBuilder, FrozenMiniSearch as default, freezeFrozenIndexBuilder, frozenMemoryBreakdown };
636
+ export { AND, AND_NOT, FrozenIndexBuilder, FrozenMiniSearch, OR, assembleFrozen, buildFrozenFromDocuments, createFrozenIndexBuilder, FrozenMiniSearch as default, freezeFrozenIndexBuilder, frozenMemoryBreakdown };
620
637
  export type { BM25Params, CombinationOperator, FrozenAssembleParams, FrozenIndexBuilderHints, FrozenMemoryBreakdown, LogLevel, LowercaseCombinationOperator, MatchInfo, MiniSearchSnapshot, Options, Query, QueryCombination, SearchOptions, SearchResult, SerializedIndexEntry, Suggestion, Wildcard };