/** * Term dictionary v0.1 — sorted array of (term, postingsOffset, postingsLength, df) entries. * * The dictionary is built in-memory during segment construction, serialized to a * compact binary format, and deserialized for lookup. Binary search is used for * O(log n) term lookup. * * Binary format (little-endian throughout): * uint32 entryCount * [entry * entryCount] * * Each entry: * uint16 termByteLen * bytes term (UTF-8) * uint32 postingsOffset * uint32 postingsLength * uint32 df (document frequency) */ export interface DictEntry { term: string; postingsOffset: number; postingsLength: number; df: number; } /** * In-memory term dictionary. Entries must be added in sorted order * (enforced by the segment writer which sorts before serializing). */ export declare class TermDict { private entries; /** Add an entry. Caller is responsible for inserting in sorted term order. */ add(entry: DictEntry): void; get size(): number; /** Binary search for a term. Returns the entry or undefined if not found. */ lookup(term: string): DictEntry | undefined; /** Iterate all entries in sorted order. */ [Symbol.iterator](): Generator; /** Serialize to a Buffer using the binary format described in the file header. */ serialize(): Buffer; /** Deserialize from a Buffer produced by serialize(). */ static deserialize(buf: Buffer): TermDict; /** * Build a TermDict from entries that are already in sorted order. * Cheaper than building via add() calls — no intermediate allocation. */ static fromSortedEntries(entries: DictEntry[]): TermDict; } //# sourceMappingURL=term-dict.d.ts.map