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

  • Configuration for the seshat database.
  • A Seshat database connection that can be used for reading.
  • A checkpoint that remembers the current point in a room timeline when fetching the history of the room.
  • The Seshat database.
  • Statistical information about the database.
  • Matrix event that can be added to the database.
  • Configuration for the event loading methods.
  • A users profile information at the time an event was posted.
  • The receiving half of Rust’s channel (or sync_channel) type. This half can only be owned by one thread.
  • Database that can be used to reindex the events.
  • Info about the recovery process.
  • A batch of search results that were returned during a search.
  • 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.
  • A search result
  • The main entry point to the index and database.

Enums

Type Definitions

  • Result type for seshat operations.