Crate seshat

Crate seshat 

Source
Expand description

Seshat - a full text search library for Matrix clients.

There are two modes of operation for Seshat, adding live events as they come in:

use seshat::{Database, Event, Profile};
use tempfile::tempdir;

let tmpdir = tempdir().unwrap();
let mut database = Database::new(tmpdir.path()).unwrap();

/// Method to call for every live event that gets received during a sync.
fn add_live_event(event: Event, profile: Profile, database: &Database) {
    database.add_event(event, profile);
}
/// Method to call on every successful sync after live events were added.
fn on_sync(database: &mut Database) {
    database.commit().unwrap();
}

The other mode is to add events from the room history using the /room/{room_id}/messages Matrix API endpoint. This method supports storing checkpoints which remember the arguments to continue fetching events from the /room/{room_id}/messages API:

database.add_historic_events(events, old_checkpoint, new_checkpoint)?;

Once events have been added a search can be done:

let result = database.search("test", &SearchConfig::new()).unwrap();

Structs§

Config
Configuration for the seshat database.
Connection
A Seshat database connection that can be used for reading.
CrawlerCheckpoint
A checkpoint that remembers the current point in a room timeline when fetching the history of the room.
Database
The Seshat database.
DatabaseStats
Statistical information about the database.
Event
Matrix event that can be added to the database.
LoadConfig
Configuration for the event loading methods.
Profile
A users profile information at the time an event was posted.
Receiver
The receiving half of Rust’s channel (or sync_channel) type. This half can only be owned by one thread.
RecoveryDatabase
Database that can be used to reindex the events.
RecoveryInfo
Info about the recovery process.
SearchBatch
A batch of search results that were returned during a search.
SearchConfig
Search configuration A search configuration allows users to limit the search to a specific room or limit the search to specific event types. The search result can be configured in various ways as well.
SearchResult
A search result
Searcher
The main entry point to the index and database.

Enums§

CheckpointDirection
Error
Seshat error types.
EventType
Matrix event types.
Language
LoadDirection

Type Aliases§

Result
Result type for seshat operations.