2026-06-08 19:33:49 -04:00
|
|
|
mod error;
|
|
|
|
|
mod index;
|
2026-08-08 23:50:04 -04:00
|
|
|
pub mod language;
|
|
|
|
|
pub mod rdf;
|
2026-06-08 19:33:49 -04:00
|
|
|
mod schema;
|
2026-08-05 11:21:25 -04:00
|
|
|
pub mod subtitles;
|
2026-06-08 19:33:49 -04:00
|
|
|
|
2026-08-05 11:21:25 -04:00
|
|
|
use oxigraph::model::NamedNodeRef;
|
2026-06-08 19:33:49 -04:00
|
|
|
pub use tantivy::TantivyDocument as SearchDocument;
|
2026-06-09 10:36:13 -04:00
|
|
|
pub use tantivy::doc;
|
2026-08-05 11:21:25 -04:00
|
|
|
pub use tantivy::indexer::IndexWriter;
|
2026-08-08 23:50:04 -04:00
|
|
|
pub use tantivy::schema::document::{Document, Value};
|
2026-06-08 19:33:49 -04:00
|
|
|
|
|
|
|
|
pub use error::{Result, SearchError};
|
2026-08-05 18:33:30 -04:00
|
|
|
use gl_graph::vocab;
|
2026-06-08 19:33:49 -04:00
|
|
|
pub use index::{SearchIndex, SearchIndexBuilder};
|
2026-08-05 11:21:25 -04:00
|
|
|
pub use schema::Schema;
|
|
|
|
|
|
|
|
|
|
pub enum DocType {
|
|
|
|
|
RdfProperty = 0,
|
|
|
|
|
RdfsClass = 1,
|
|
|
|
|
SkosConcept = 2,
|
|
|
|
|
Person = 3,
|
2026-08-05 18:33:30 -04:00
|
|
|
CorporateBody = 4,
|
|
|
|
|
Work = 5,
|
|
|
|
|
Expression = 6,
|
|
|
|
|
Manifestation = 7,
|
2026-08-05 11:21:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl DocType {
|
2026-08-05 18:33:30 -04:00
|
|
|
pub fn to_named_node(&self) -> NamedNodeRef<'_> {
|
|
|
|
|
match self {
|
|
|
|
|
DocType::RdfProperty => vocab::rdf::PROPERTY,
|
|
|
|
|
DocType::RdfsClass => vocab::rdfs::CLASS,
|
|
|
|
|
DocType::SkosConcept => vocab::skos::CONCEPT,
|
|
|
|
|
DocType::Person => vocab::rdac::PERSON,
|
|
|
|
|
DocType::CorporateBody => vocab::rdac::CORPORATE_BODY,
|
|
|
|
|
DocType::Work => vocab::rdac::WORK,
|
|
|
|
|
DocType::Expression => vocab::rdac::EXPRESSION,
|
|
|
|
|
DocType::Manifestation => vocab::rdac::MANIFESTATION,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-07 18:16:03 -04:00
|
|
|
pub fn try_from_named_node<'a>(node: impl Into<NamedNodeRef<'a>>) -> Option<Self> {
|
2026-08-05 18:33:30 -04:00
|
|
|
let node = node.into();
|
|
|
|
|
match node {
|
|
|
|
|
vocab::rdf::PROPERTY => Some(DocType::RdfProperty),
|
|
|
|
|
vocab::rdfs::CLASS => Some(DocType::RdfsClass),
|
|
|
|
|
vocab::skos::CONCEPT => Some(DocType::SkosConcept),
|
|
|
|
|
vocab::rdac::PERSON => Some(DocType::Person),
|
|
|
|
|
vocab::rdac::CORPORATE_BODY => Some(DocType::CorporateBody),
|
|
|
|
|
vocab::rdac::WORK => Some(DocType::Work),
|
|
|
|
|
vocab::rdac::EXPRESSION => Some(DocType::Expression),
|
|
|
|
|
vocab::rdac::MANIFESTATION => Some(DocType::Manifestation),
|
2026-08-05 11:21:25 -04:00
|
|
|
_ => None,
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-08-08 23:50:04 -04:00
|
|
|
}
|