README

Lucius646/MoonSearch/index does not have a README file

#
BudgetedSegmentWriter

pub struct BudgetedSegmentWriter {
schema :
Schema

tokenizers :
TokenizerManager

memory_budget_bytes : Int
current : SegmentWriter[
WhitespaceAnalyzer
]
current_estimated_bytes : Int
current_documents : Int
segments : Array[Segment]
indexed_documents : Int
peak_estimated_bytes : Int
}

Schema-aware Segment writer that automatically seals segments at a memory budget. It is deterministic on every MoonBit backend and is the unit that native executors can shard across independent indexing lanes.

#
BudgetedSegmentWriter::add_document

Adds a document and flushes before it when the next document would exceed the budget. A single oversized document is accepted into its own segment.

#
BudgetedSegmentWriter::finish

#
BudgetedSegmentWriter::stats

#
BudgetedWriterStats

pub struct BudgetedWriterStats {
memory_budget_bytes : Int
flushed_segments : Int
indexed_documents : Int
peak_estimated_bytes : Int
}

Result of memory-budgeted indexing. flushed_segments counts immutable segments emitted before the final flush; peak_estimated_bytes is a conservative input-side estimate rather than allocator RSS.

#
BudgetedWriterStats::flushed_segments

fn BudgetedWriterStats::flushed_segments(self : BudgetedWriterStats) -> Int

#
BudgetedWriterStats::indexed_documents

fn BudgetedWriterStats::indexed_documents(self : BudgetedWriterStats) -> Int

#
BudgetedWriterStats::memory_budget_bytes

fn BudgetedWriterStats::memory_budget_bytes(self : BudgetedWriterStats) -> Int

#
BudgetedWriterStats::peak_estimated_bytes

fn BudgetedWriterStats::peak_estimated_bytes(self : BudgetedWriterStats) -> Int

#
FastFieldColumn

pub struct FastFieldColumn {
field_id :
FieldId

values : ReadOnlyArray[ReadOnlyArray[
FieldValue
]]
}

Column-oriented, docID-addressable values for one fast field.

#
FastFieldColumn::field_id

#
FieldLength

type FieldLength

#
FieldStats

type FieldStats

#
IndexingExecutionPlan

pub struct IndexingExecutionPlan {
requested_parallelism : Int
effective_parallelism : Int
degraded : Bool
}

Portable capability report for segment-sharded indexing. MoonSearch keeps the sharding contract backend-neutral; the current built-in executor is cooperative and therefore reports effective parallelism 1.

#
IndexingExecutionPlan::effective_parallelism

fn IndexingExecutionPlan::effective_parallelism(self : IndexingExecutionPlan) -> Int

#
IndexingExecutionPlan::is_degraded

fn IndexingExecutionPlan::is_degraded(self : IndexingExecutionPlan) -> Bool

#
IndexingExecutionPlan::portable

fn IndexingExecutionPlan::portable(requested_parallelism : Int) -> IndexingExecutionPlan

#
IndexingExecutionPlan::requested_parallelism

fn IndexingExecutionPlan::requested_parallelism(self : IndexingExecutionPlan) -> Int

#
Posting

pub(all) struct Posting {
doc_id :
DocId

term_freq : Int
positions : ReadOnlyArray[Int]
position_lengths : ReadOnlyArray[Int]
start_offsets : ReadOnlyArray[Int]
end_offsets : ReadOnlyArray[Int]
value_indexes : ReadOnlyArray[Int]
} derive(Eq,
Debug
)

One document occurrence in a posting list.

#
Posting::occurrences

fn Posting::occurrences(self : Posting) -> ReadOnlyArray[PostingOccurrence]

#
PostingCursor

pub struct PostingCursor {
postings : ReadOnlyArray[Posting]
blocks : ReadOnlyArray[PostingSkipBlock]
cursor : Int
skipped_blocks : Int
}

Forward-only view over an immutable posting list.

#
PostingCursor::advance

fn PostingCursor::advance(self : PostingCursor) -> Bool

#
PostingCursor::advance_to

fn PostingCursor::advance_to(self : PostingCursor, target :
DocId
) -> Bool

Seeks to the first posting whose document ID is at least target.

#
PostingCursor::positions

fn PostingCursor::positions(self : PostingCursor) -> ReadOnlyArray[Int]

#
PostingCursor::posting

fn PostingCursor::posting(self : PostingCursor) -> Posting?

#
PostingCursor::skip_blocks

fn PostingCursor::skip_blocks(self : PostingCursor) -> ReadOnlyArray[PostingSkipBlock]

#
PostingCursor::skipped_block_count

fn PostingCursor::skipped_block_count(self : PostingCursor) -> Int

Number of complete blocks bypassed by advance_to calls.

#
PostingCursor::term_freq

fn PostingCursor::term_freq(self : PostingCursor) -> Int

#
PostingOccurrence

pub(all) struct PostingOccurrence {
position : Int
position_length : Int
start_offset : Int
end_offset : Int
value_index : Int
} derive(Eq,
Debug
)

#
PostingSkipBlock

pub(all) struct PostingSkipBlock {
start : Int
end : Int
max_doc :
DocId

} derive(Eq,
Debug
)

#
Segment

pub struct Segment {
schema :
Schema
?
indexed_terms : ReadOnlyArray[
Term
]
posting_lists : ReadOnlyArray[ReadOnlyArray[Posting]]
stored_field_blocks : ReadOnlyArray[StoredFieldBlock]
document_values : ReadOnlyArray[ReadOnlyArray[FieldValueEntry]]
fast_fields : ReadOnlyArray[FastFieldColumn]
document_field_lengths : ReadOnlyArray[ReadOnlyArray[FieldLength]]
field_stats : ReadOnlyArray[FieldStats]
document_count : Int
}

Immutable in-memory index for one batch of documents.

#
Segment::average_field_length

fn Segment::average_field_length(self : Segment, field_id :
FieldId
) -> Double

Average analyzed token count among documents that contain the field.

#
Segment::doc

Returns the immutable stored document for a segment-local document ID.

#
Segment::doc_count

fn Segment::doc_count(self : Segment) -> Int

#
Segment::fast_field

#
Segment::fast_values

Returns docID-addressable fast-field values. Non-fast fields return empty.

#
Segment::field_doc_count

fn Segment::field_doc_count(self : Segment, field_id :
FieldId
) -> Int

Number of documents that contain the field, including empty field values.

#
Segment::field_length

Returns the analyzed token count for one document field.

#
Segment::field_values

Returns typed indexed values for one document field.

#
Segment::has_field

#
Segment::posting_cursor

#
Segment::postings_for

fn Segment::postings_for(self : Segment, term :
Term
) -> ReadOnlyArray[Posting]

Looks up a field-qualified term in this segment.

#
Segment::schema

Returns the schema used by this segment, if it was built with one.

#
Segment::stored_fields_reader

fn Segment::stored_fields_reader(self : Segment) -> StoredFieldsReader

#
Segment::term_dictionary

fn Segment::term_dictionary(self : Segment) -> TermDictionary

#
Segment::term_ordinal

fn Segment::term_ordinal(self : Segment, term :
Term
) -> Int?

#
Segment::terms

fn Segment::terms(self : Segment) -> ReadOnlyArray[
Term
]

Returns all indexed terms in deterministic dictionary order.

#
SegmentWriter

pub struct SegmentWriter[A] {
tokenizer : A
tokenizer_manager :
TokenizerManager
?
schema :
Schema
?
terms : Array[
Term
]
term_indexes :
HashMap
[String, Int]
posting_doc_ids : Array[Array[
DocId
]]
posting_term_freqs : Array[Array[Int]]
posting_positions : Array[Array[Array[Int]]]
posting_position_lengths : Array[Array[Array[Int]]]
posting_start_offsets : Array[Array[Array[Int]]]
posting_end_offsets : Array[Array[Array[Int]]]
posting_value_indexes : Array[Array[Array[Int]]]
stored_documents : Array[
StoredDocument
]
document_values : Array[Array[FieldValueEntry]]
document_field_lengths : Array[Array[FieldLength]]
field_stats : Array[FieldStats]
next_doc_id : Int
}

Mutable builder for one in-memory segment.

#
SegmentWriter::add_document

Adds a document and returns its sequential segment-local identifier.

#
SegmentWriter::finish

fn[A] SegmentWriter::finish(self : SegmentWriter[A]) -> Segment

Finishes the current batch as an immutable in-memory segment.

#
SegmentWriter::new

fn[A] SegmentWriter::new(tokenizer : A) -> SegmentWriter[A]

#
SegmentWriter::with_schema

fn[A] SegmentWriter::with_schema(schema :
Schema
, tokenizer : A) -> SegmentWriter[A]

Creates a writer that applies the schema's indexed and stored text options.

#
SegmentWriter::with_schema_and_tokenizers

Creates a schema-aware writer that resolves each indexed field's Tokenizer pipeline through the supplied TokenizerManager before accepting documents.

#
SnapshotSegment

pub struct SnapshotSegment {
segment : Segment
deleted_docs : ReadOnlyArray[
DocId
]
}

One immutable Segment together with the tombstones captured by a manifest generation.

#
SnapshotSegment::is_deleted

#
SnapshotSegment::live_doc_count

fn SnapshotSegment::live_doc_count(self : SnapshotSegment) -> Int

#
SnapshotSegment::new

fn SnapshotSegment::new(segment : Segment, deleted_docs : ReadOnlyArray[
DocId
]) -> SnapshotSegment

#
StoredFieldBlock

pub(all) struct StoredFieldBlock {
first_doc : Int
doc_count : Int
uncompressed_length : Int
compressed : Bytes
} derive(Eq,
Debug
)

#
StoredFieldsReader

pub struct StoredFieldsReader {
blocks : ReadOnlyArray[StoredFieldBlock]
document_count : Int
}

#
StoredFieldsReader::block_count

fn StoredFieldsReader::block_count(self : StoredFieldsReader) -> Int

#
StoredFieldsReader::compressed_bytes

fn StoredFieldsReader::compressed_bytes(self : StoredFieldsReader) -> Int

#
TermDictionary

pub struct TermDictionary {
terms : ReadOnlyArray[
Term
]
}

Immutable, lexicographically ordered term dictionary for one segment.

#
TermDictionary::seek

Returns the ordinal of an exact term using a lower-bound binary search.

#
TermDictionary::terms

#
TermDictionary::terms_with_prefix

fn TermDictionary::terms_with_prefix(self : TermDictionary, field_id :
FieldId
, prefix : String) -> ReadOnlyArray[
Term
]

Returns field-qualified terms with the requested UTF-8 prefix. The ordered dictionary performs one lower-bound seek and scans only the matching range.

#
decode_segment

Decodes and validates one immutable M3 Segment container.

#
encode_segment

fn encode_segment(segment : Segment) -> Bytes

#
estimate_document_memory

fn estimate_document_memory(document :
Document
) -> Int

Estimates the mutable indexing footprint contributed by a document. The multiplier accounts for term text, postings, positions, offsets and stored fields and intentionally errs high so automatic flush happens early.

#
live_snapshot

fn live_snapshot(segment : Segment) -> SnapshotSegment

#
merge_snapshot_segments

fn merge_snapshot_segments(snapshots : ReadOnlyArray[SnapshotSegment]) -> Segment

Combines live documents by copying immutable index structures and assigning consecutive DocIds in Segment order. No field is re-analyzed.