feat(filter): tag chips + FTS5 search en toolbar (issue 0009)
- entity_ops: entity_search_fts (bm25, prefix tokens) + entity_list_by_tags (AND). - AppState: filter_query_buf, filter_tags, filter_mode (highlight/hide), hits cache. - views_filter_apply: combina tipos visibles + match-set (FTS query AND tags), highlight = color_override con alpha=0x40, hide = clear NF_VISIBLE. - toolbar: input search + dropdown (max 20, click centra y selecciona), chips de tags con boton X, input para anadir tag, combo Highlight/Hide, Clear filter. - Inspector: right-click sobre tag chip lo anade al filtro. - main.cpp: reapply en cada frame si filter_dirty; cam_x/y al focus_target.
This commit is contained in:
@@ -99,6 +99,29 @@ bool entity_update(const char* db_path, const EntityRecord& rec);
|
||||
bool entity_list_distinct_tags(const char* db_path,
|
||||
std::vector<std::string>* out);
|
||||
|
||||
// Resultado de busqueda FTS5 sobre entities_fts.
|
||||
struct EntityHit {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string type_ref;
|
||||
double rank = 0.0; // bm25 (mas bajo = mejor)
|
||||
};
|
||||
|
||||
// Busca en entities_fts (columnas: id, name, description, tags, domain).
|
||||
// Tokeniza `query` por whitespace, descarta caracteres especiales FTS5 y
|
||||
// aplica busqueda por prefijo a cada token (token*). Limit clampeado en [1,200].
|
||||
// Devuelve hits ordenados por rank ASC. Si query queda vacio tras sanear,
|
||||
// devuelve true con out->empty(). Si la BD no tiene la tabla entities_fts
|
||||
// (operations.db antiguos), devuelve false.
|
||||
bool entity_search_fts(const char* db_path, const char* query, int limit,
|
||||
std::vector<EntityHit>* out);
|
||||
|
||||
// Devuelve los ids de entidades cuyo array `tags` contiene TODOS los tags
|
||||
// pasados (AND). Si `tags` vacio, out queda vacio y retorna true.
|
||||
bool entity_list_by_tags(const char* db_path,
|
||||
const std::vector<std::string>& tags,
|
||||
std::vector<std::string>* out_ids);
|
||||
|
||||
// Mapa user_data (FNV1a hash) -> sql id. Se reconstruye despues de cada
|
||||
// carga del grafo (graph_sources usa FNV1a sobre id como user_data).
|
||||
struct EntityIndex {
|
||||
|
||||
Reference in New Issue
Block a user