diff options
author | metamuffin <metamuffin@disroot.org> | 2024-04-16 00:08:24 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-04-16 00:08:24 +0200 |
commit | 783198703569dd1d1c17f2b3a40a62f20a6f8a44 (patch) | |
tree | 41aba65cb338083bd4eb0b143d7c629b0df2d3db | |
parent | f369728cc783493f8f6cab921b3c609d127bf6f2 (diff) | |
download | jellything-783198703569dd1d1c17f2b3a40a62f20a6f8a44.tar jellything-783198703569dd1d1c17f2b3a40a62f20a6f8a44.tar.bz2 jellything-783198703569dd1d1c17f2b3a40a62f20a6f8a44.tar.zst |
index parentt
-rw-r--r-- | base/src/database.rs | 5 | ||||
-rw-r--r-- | import/src/db.rs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/base/src/database.rs b/base/src/database.rs index 7755016..d890956 100644 --- a/base/src/database.rs +++ b/base/src/database.rs @@ -21,7 +21,7 @@ use std::{ }; use tantivy::{ directory::MmapDirectory, - schema::{Field, Schema, FAST, INDEXED, STORED, TEXT}, + schema::{Field, Schema, FAST, INDEXED, STORED, STRING, TEXT}, DateOptions, Index, IndexReader, IndexWriter, ReloadPolicy, }; @@ -89,6 +89,7 @@ pub struct NodeIndex { pub title: Field, pub releasedate: Field, pub description: Field, + pub parent: Field, pub f_index: Field, } impl NodeIndex { @@ -97,6 +98,7 @@ impl NodeIndex { let id = schema.add_text_field("id", TEXT | STORED | FAST); let title = schema.add_text_field("title", TEXT); let description = schema.add_text_field("description", TEXT); + let parent = schema.add_text_field("parent", STRING | FAST); let f_index = schema.add_u64_field("index", FAST); let releasedate = schema.add_date_field( "releasedate", @@ -120,6 +122,7 @@ impl NodeIndex { writer: writer.into(), reader, schema, + parent, f_index, releasedate, id, diff --git a/import/src/db.rs b/import/src/db.rs index 39b5b3e..e6174e4 100644 --- a/import/src/db.rs +++ b/import/src/db.rs @@ -185,6 +185,7 @@ fn insert_complete_node(db: &DataAcid, id: &str, node: Node) -> anyhow::Result<( db.node_index.description => node.public.description.unwrap_or_default(), db.node_index.releasedate => DateTime::from_timestamp_millis(node.public.release_date.unwrap_or_default()), db.node_index.f_index => node.public.index.unwrap_or_default() as u64, + db.node_index.parent => node.public.path.last().cloned().unwrap_or_default(), )) .context("inserting document")?; Ok(()) |