Module database

Source
Expand description

Database management and operations for academic paper metadata.

This module provides a flexible SQLite-based storage system for managing academic paper metadata and references while allowing users to maintain control over how and where their documents are stored. The database tracks:

  • Paper metadata (title, authors, abstract, publication date)
  • Source information (arXiv, DOI, IACR)
  • Document storage locations
  • Full-text search capabilities

The design emphasizes:

  • User control over data storage locations
  • Flexible integration with external PDF viewers and tools
  • Efficient querying and organization of paper metadata
  • Separation of metadata from document storage

§Architecture

The database module uses a command pattern through the DatabaseInstruction trait, allowing for type-safe and composable database operations. Common operations are implemented as distinct instruction types:

  • Query - For searching and retrieving papers
  • Add - For adding new papers and documents
  • Remove - For removing papers from the database

§Examples

use learner::{
  database::{Add, Database, Query},
  prelude::*,
  resource::Paper,
  Learner,
};

// Create a default learner to open database at default location
let mut learner = Learner::builder().build().await?;

// Add a paper
let paper = learner.retriever.get_paper("2301.07041").await?;
Add::paper(&paper).execute(&mut learner.database).await?;

// Search for papers about neural networks
let papers = Query::text("neural networks").execute(&mut learner.database).await?;

// Customize document storage location
learner.database.set_storage_path("~/Documents/research/papers").await?;

Structs§

Add
Database instruction for adding papers and documents.
Database
Main database connection handler for the paper management system.
Query
A query builder for retrieving papers from the database.
Remove
Instruction for removing papers from the database.

Enums§

OrderField
Available fields for ordering query results.
QueryCriteria
Represents different ways to query papers in the database.

Traits§

DatabaseInstruction
Trait for implementing type-safe database operations.