Second-brain 2.0: hybrid retrieval, obsidian bridge, vector watermark, tests
This commit is contained in:
15
src/store.py
15
src/store.py
@@ -127,6 +127,14 @@ class EngramStore:
|
||||
).fetchall()
|
||||
return [self._row_to_engram(r) for r in rows]
|
||||
|
||||
def get_modified_since(self, iso_ts: str, limit: int = 5000) -> List[Engram]:
|
||||
"""Gibt Engramme zurück, deren `modified_at` nach `iso_ts` liegt."""
|
||||
rows = self._conn.execute(
|
||||
"SELECT * FROM engrams WHERE modified_at > ? ORDER BY modified_at ASC LIMIT ?",
|
||||
(iso_ts, limit),
|
||||
).fetchall()
|
||||
return [self._row_to_engram(r) for r in rows]
|
||||
|
||||
def delete(self, engram_id: str) -> bool:
|
||||
"""Löscht ein Engramm und alle Verknüpfungen."""
|
||||
rowid = self._conn.execute(
|
||||
@@ -239,6 +247,13 @@ class EngramStore:
|
||||
"links": json.loads(row["links_json"]),
|
||||
"hierarchy": json.loads(row["hierarchy_json"]),
|
||||
}
|
||||
# Keep Engram metadata timestamps aligned with DB columns so downstream
|
||||
# consumers (e.g. vector indexing watermarks) can rely on them.
|
||||
try:
|
||||
d["metadata"]["created"] = row["created_at"]
|
||||
d["metadata"]["modified"] = row["modified_at"]
|
||||
except Exception:
|
||||
pass
|
||||
emb = row["embedding_json"]
|
||||
if emb:
|
||||
d["embedding"] = json.loads(emb)
|
||||
|
||||
Reference in New Issue
Block a user