feat(core): hubs, tag pages and types, with ffi, history and import support

Hubs and templates are page kinds; tags are pages of kind tag linked by a TAGGED
edge; types are plain names on the page. Schema v5. Snapshots carry
synapse-kind/tags/types. Also adapts search, import and server tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5.5 committed 2026-10-26 02:45:22 +01:00
1 parent 91a8276966
commit b800248d67
35 files changed
+7983 -141

No files matched your search

+6 -1
View File
@@ -1,4 +1,5 @@
//! tantivy-backed full-text index: one document per block and one per page (title + aliases).
//! tantivy-backed full-text index: one document per block and one per page (title + aliases,
//! plus the description of hubs as content).
use crate::error::Result;
use crate::{Filter, JournalFilter, Scope};
@@ -184,6 +185,7 @@ impl FullText {
id: Uuid,
title: &str,
aliases: &[String],
description: &str,
day: i64,
journal: bool,
) -> Result<()> {
@@ -196,6 +198,9 @@ impl FullText {
for a in aliases {
d.add_text(self.f.title, a);
}
if !description.is_empty() {
d.add_text(self.f.content, description);
}
d.add_i64(self.f.day, day);
d.add_u64(self.f.journal, journal as u64);
self.writer.add_document(d)?;
+4 -2
View File
@@ -318,7 +318,8 @@ impl Search {
Some(d) => (day_of_date(d), true),
None => (day_of_ms(p.updated_at), false),
};
self.ft.upsert_page(id, &p.title, &aliases, day, journal)?;
self.ft
.upsert_page(id, &p.title, &aliases, &p.description, day, journal)?;
}
None => {
self.ft.delete(id);
@@ -350,7 +351,8 @@ impl Search {
Some(d) => (day_of_date(d), true),
None => (day_of_ms(p.updated_at), false),
};
self.ft.upsert_page(p.id, &p.title, &al, day, journal)?;
self.ft
.upsert_page(p.id, &p.title, &al, &p.description, day, journal)?;
}
}
Ok(())
+4 -4
View File
@@ -40,15 +40,15 @@ pub(crate) fn quantize(v: &[f32]) -> (Vec<i8>, f32) {
fn dot(row: &[i8], q: &[f32]) -> f32 {
let mut acc = [0f32; 8];
let mut rc = row.chunks_exact(8);
let mut qc = q.chunks_exact(8);
for (r, c) in (&mut rc).zip(&mut qc) {
let (rc, r_rem) = row.as_chunks::<8>();
let (qc, q_rem) = q.as_chunks::<8>();
for (r, c) in rc.iter().zip(qc) {
for i in 0..8 {
acc[i] += r[i] as f32 * c[i];
}
}
let mut s: f32 = acc.iter().sum();
for (r, c) in rc.remainder().iter().zip(qc.remainder()) {
for (r, c) in r_rem.iter().zip(q_rem) {
s += *r as f32 * c;
}
s