mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
5b4f0eafcc
* configure logging * set mcp output logging also * fix type check errors * fix type check * rename Permalink schema type * fix type errors * add typechecks to ci workflow * pytest coverage setup * add tests for status cli * sync tests coverage * watch_service test coverage * tests for tool_utils.py * clean up imports * file_utils coverage * markdown plugins coverage * 99% test coverage * more test coverage, remove ObservationCategory * more tool coverage * fix type-check * format, upgrade deps --------- Co-authored-by: phernandez <phernandez@basicmachines.co>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Search models and tables."""
|
|
|
|
from sqlalchemy import DDL
|
|
|
|
# Define FTS5 virtual table creation
|
|
CREATE_SEARCH_INDEX = DDL("""
|
|
CREATE VIRTUAL TABLE IF NOT EXISTS search_index USING fts5(
|
|
-- Core entity fields
|
|
id UNINDEXED, -- Row ID
|
|
title, -- Title for searching
|
|
content, -- Main searchable content
|
|
permalink, -- Stable identifier (now indexed for path search)
|
|
file_path UNINDEXED, -- Physical location
|
|
type UNINDEXED, -- entity/relation/observation
|
|
|
|
-- Relation fields
|
|
from_id UNINDEXED, -- Source entity
|
|
to_id UNINDEXED, -- Target entity
|
|
relation_type UNINDEXED, -- Type of relation
|
|
|
|
-- Observation fields
|
|
entity_id UNINDEXED, -- Parent entity
|
|
category UNINDEXED, -- Observation category
|
|
|
|
-- Common fields
|
|
metadata UNINDEXED, -- JSON metadata
|
|
created_at UNINDEXED, -- Creation timestamp
|
|
updated_at UNINDEXED, -- Last update
|
|
|
|
-- Configuration
|
|
tokenize='unicode61 tokenchars 0x2F', -- Hex code for /
|
|
prefix='1,2,3,4' -- Support longer prefixes for paths
|
|
);
|
|
""")
|