This commit is contained in:
2026-08-12 14:11:47 -04:00
parent 79894f654d
commit f852da4f4e
48 changed files with 4379 additions and 779 deletions
+4 -51
View File
@@ -1,58 +1,11 @@
mod error;
mod index;
pub mod language;
pub mod rdf;
mod schema;
pub mod subtitles;
use oxigraph::model::NamedNodeRef;
pub use tantivy::TantivyDocument as SearchDocument;
pub use tantivy::doc;
pub use tantivy::indexer::IndexWriter;
pub use tantivy::schema::document::{Document, Value};
pub use tantivy::schema::Field;
pub use tantivy::schema::document::OwnedValue;
pub use error::{Result, SearchError};
use gl_graph::vocab;
pub use index::{SearchIndex, SearchIndexBuilder};
pub use schema::Schema;
pub enum DocType {
RdfProperty = 0,
RdfsClass = 1,
SkosConcept = 2,
Person = 3,
CorporateBody = 4,
Work = 5,
Expression = 6,
Manifestation = 7,
}
impl DocType {
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,
}
}
pub fn try_from_named_node<'a>(node: impl Into<NamedNodeRef<'a>>) -> Option<Self> {
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),
_ => None,
}
}
}
pub use index::{SearchIndex, SearchIndexBuilder, to_json};
pub use schema::Schema;