MARS documentation
Rust librariesmars-server

mars-server · search

Public declarations and documentation for mars-server::search.

Package: mars-server · Workspace version: 0.1.0 · Module: search

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

search::DEFAULT_SEARCH_CURSOR_MAX_AGE_SECONDS

pub const DEFAULT_SEARCH_CURSOR_MAX_AGE_SECONDS: u64;

Source line: 43.

search::MAX_SEARCH_CURSOR_MAX_AGE_SECONDS

pub const MAX_SEARCH_CURSOR_MAX_AGE_SECONDS: u64;

Source line: 44.

search::SearchCursorKey

Validated secret material used to authenticate search cursors.

Keys are accepted only as raw bytes or canonical unpadded base64url and are zeroized on drop. Debug formatting deliberately exposes no material.

#[derive(Clone)]
pub struct SearchCursorKey(Zeroizing<Vec<u8>>);

Source line: 69.

search::SearchCursorKey::from_bytes

Validate raw HMAC key material.

pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, ServerError>;

Source line: 73.

search::SearchCursorKey::from_base64url

Decode canonical unpadded base64url HMAC key material.

pub fn from_base64url(encoded: &str) -> Result<Self, ServerError>;

Source line: 85.

search::PreviousSearchCursorKey

A previous cursor HMAC key with an absolute, non-renewing acceptance deadline.

The absolute timestamp prevents process restarts from extending a rotation window. [SearchCursorCodec] validates the deadline against its maximum cursor age before accepting the key.

#[derive(Clone)]
pub struct PreviousSearchCursorKey {

}

Source line: 145.

search::PreviousSearchCursorKey::new

Pair previous key material with its operator-configured expiry.

pub const fn new(key: SearchCursorKey, expires_at: DateTime<Utc>) -> Self;

Source line: 152.

search::SearchCursorCodec

HMAC-SHA256 codec for opaque, expiring, query-bound search cursors.

New cursors are always signed with active_key. During a bounded rotation window, previous_key may verify existing cursors but is never used to issue new ones.

#[derive(Clone)]
pub struct SearchCursorCodec {

}

Source line: 177.

search::SearchCursorCodec::new

Construct a codec from validated key material and a bounded lifetime.

pub fn new(
        active_key: SearchCursorKey,
        previous_key: Option<PreviousSearchCursorKey>,
        max_age: chrono::Duration,
    ) -> Result<Self, ServerError>;

Source line: 185.

search::SearchCursorCodec::insecure_test_fixture

Explicit deterministic fixture for development and tests only.

Production configuration rejects this key even when its encoded bytes are supplied through an operator configuration source.

pub fn insecure_test_fixture() -> Self;

Source line: 239.

search::QueryBackend

Bounded execution backend label used by search metrics.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum QueryBackend {
    Memory,
    Postgres,
}

Source line: 401.

search::QueryPlan

Bounded query-plan label used by search metrics.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum QueryPlan {
    Reference,
    Indexed,
}

Source line: 417.

search::QueryExecution

Validated storage-level search request.

#[derive(Debug, Clone)]
pub struct QueryExecution {

}

Source line: 433.

search::QueryExecution::new

Validate an AST, apply configured limits, and verify its opaque cursor.

pub fn new(
        query: &MarsQuery,
        default_limit: u64,
        max_limit: u64,
        anchoring_required: bool,
        cursor_codec: Arc<SearchCursorCodec>,
    ) -> Result<Self, ServerError>;

Source line: 443.

search::QueryPage

One backend search page before conversion to the public wire result.

#[derive(Debug, Clone)]
pub struct QueryPage {
pub entries: Vec<MarsEntry>,
pub total_count: u64,
pub cursor: Option<String>,
pub has_more: bool,
pub backend: QueryBackend,
pub plan: QueryPlan
}

Source line: 507.

search::ValidatedMarsQuery

A query that has passed all server-side AST and cursor-safety validation.

#[derive(Debug, Clone)]
pub struct ValidatedMarsQuery {

}

Source line: 518.

search::ValidatedCondition

One semantically validated condition.

#[derive(Debug, Clone)]
pub struct ValidatedCondition {

}

Source line: 623.

search::ValidatedOrder

One semantically validated order expression.

#[derive(Debug, Clone)]
pub struct ValidatedOrder {

}

Source line: 643.

search::compute_ranking_score_at

Compute the frozen five-component default ranking at one stable instant.

pub fn compute_ranking_score_at(entry: &MarsEntry, query: &MarsQuery, as_of: DateTime<Utc>) -> f64;

Source line: 1464.

search::SemanticSearchRequest

Request accepted by a future semantic-search adapter.

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SemanticSearchRequest {
pub query: String,
pub entry_type: Option<EntryType>,
pub limit: u32
}

Source line: 1568.

search::SemanticSearchHit

One semantic adapter result, resolved through MARS by DID.

#[derive(Debug, Clone, PartialEq)]
pub struct SemanticSearchHit {
pub entry_did: String,
pub score: f64
}

Source line: 1576.

search::SemanticSearchError

Explicit semantic-search availability failures.

#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
pub enum SemanticSearchError {
    #[error("semantic search is disabled because no SemanticSearchPort is registered")]
    Disabled,
    #[error("semantic search adapter failed: {0}")]
    Adapter(String),
}

Source line: 1583.

search::SemanticSearchPort

MARS-owned semantic search seam. No cognitive engine dependency is implied.

#[async_trait]
pub trait SemanticSearchPort: Send + Sync {
    async fn search(
        &self,
        request: &SemanticSearchRequest,
    ) -> Result<Vec<SemanticSearchHit>, SemanticSearchError>;
}

Source line: 1592.

search::DisabledSemanticSearchPort

Fail-closed implementation used when semantic search is not configured.

pub struct DisabledSemanticSearchPort;

Source line: 1600.

Source provenance

Source: mars-server/src/search.rs · SHA-256 45a1199799596211298fdacfcb17a2cf7e3472f021fbd7b80f69535a2cf20b7d. Package overview.

On this page