You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
enhancement: normalize tags with junction table (schema v2) #184
Tags are stored as comma-separated TEXT column (tags TEXT). Searching by tag uses LIKE "%tag%" which is O(n) full scan and fragile (partial match: tag "rust" matches "rustic").
Current Schema (v1)
CREATETABLEmemories (
...
tags TEXT, -- comma-separated string
...
);
CREATEINDEXidx_memories_tagsON memories(tags); -- index on text, not useful for individual tags
Proposed Schema (v2)
-- New junction tableCREATETABLEmemory_tags (
memory_id TEXTNOT NULLREFERENCES memories(id) ON DELETE CASCADE,
tag TEXTNOT NULL,
PRIMARY KEY (memory_id, tag)
);
CREATEINDEXidx_memory_tags_tagON memory_tags(tag);
Migration Plan (schema v1 → v2)
Create memory_tags table
Parse existing tags column → insert rows into memory_tags
Add memory_tags methods to Store
Update queries: list(tag=...), unique_tags(), tags_with_counts(), etc.
Keep tags column for backward compat during migration
Remove tags column in future version
Benefits
O(log n) tag lookups instead of O(n)
No partial match bugs
tags_with_counts() becomes a simple GROUP BY instead of parsing
Activity
feat: v0.1.0 remaining — tag junction, room document, pluggable embed…
ajianaz commentedon Jun 13, 2026
Implemented in PR #314, merged to develop.
sync: main → v0.1.0 (#323)
feat: v0.1.0 remaining — tag junction, room document, pluggable embed…