Skip to main content
Swift SDK / Types Reference for the structs and enums passed to and returned from MossClient and MossSession.

DocumentInfo

A document stored in or returned from an index. Conforms to Codable.
Store an Encodable value as the payload with the structured: initializer, and read it back typed with decodedPayload(_:):

QueryOptions

See Querying for hybrid-search examples and Exact / Graph Retrieval for the typed Filter DSL and parent grouping.

SearchResult

Returned by query(...).

QueryResult

A single match within a SearchResult.
payload is the document’s verbatim structured payload (nil when it has none); read it typed with decodedPayload(_:) — see Verbatim structured payload.

Filter

A composable, typed metadata predicate used by getDocs(where:) and QueryOptions.filter. Serialized internally to the engine’s filter format — no JSON to hand-write. See the Filter DSL for examples.
Numeric comparisons (greaterThan, lessThanOrEqual, …) are numeric-aware even though metadata is stored as strings ("9" < "50"). .raw with invalid JSON throws rather than silently matching everything.

FilterValue

A typed metadata value used inside a Filter. Literal-expressible, so you can write "shoes", 27, 0.7, or false directly wherever a FilterValue is expected.

ParentGrouping

Collapses sibling documents that share a parent id into one result per unit, assembling sibling text in orderField order (numeric-aware). Passed to GetDocsOptions.groupByParent and QueryOptions.groupByParent.

GetDocsOptions

Full-control input to getDocs(options:). Combine an id list, a metadata filter, sorting, and parent grouping in one deterministic fetch.
See Exact / Graph Retrieval for worked examples.

ModelRef

Reference to an embedding model with version information. Surfaced on IndexInfo.

IndexInfo

Metadata about a cloud index. Returned by getIndex and listIndexes.

SessionOptions

Passed to MossClient.session(_:options:).
With autoLoadOnInit: false the session starts empty until you load it. Calling pushIndex() on a session you never loaded overwrites the cloud index with the near-empty local one — use it for read-only or load-then-mutate flows.

VectorQuantization

On-disk vector precision for SessionOptions, applied when a session is persisted with MossSession.save(toCachePath:).

PushIndexResult

Returned by MossSession.pushIndex(). Poll jobId with getJobStatus until status is ready.

MutationResult

Returned by the cloud document operations createIndex, addDocs, and deleteDocs after the operation completes.

RefreshResult

Returned by refreshIndex.

JobStatus

Returned by getJobStatus.

MemoryPressureLevel

Passed to onMemoryPressure.

MossError

Thrown for any failure reported by the underlying runtime. Conforms to LocalizedError, so error.localizedDescription returns the message.