h-sphere_sql-seal/src/modules/editor
Kacper c038366783
feat: add TAGS() macro and auto-detection for multi-tag AND queries (#202)
* feat: add TAGS() macro and auto-detection for multi-tag AND queries

Introduces two complementary solutions for the common mistake of filtering
by multiple tags with AND (which always returns zero results):

1. TAGS() macro: explicit opt-in syntax
   WHERE TAGS('#project', '#active')
   → path IN (SELECT path FROM tags WHERE tag = '#project'
              INTERSECT SELECT path FROM tags WHERE tag = '#active')

2. Auto-detection: transparently rewrites the broken pattern
   WHERE tag = '#a' AND tag = '#b'
   → path IN (...INTERSECT...)
   Mixed conditions (AND name = 'test') are preserved correctly.

Both use INTERSECT subqueries which are more flexible than an EXISTS
approach (no hardcoded table reference required).

Adds disableTagAutoDetection setting so advanced users can opt out of
the transparent rewrite and handle the SQL themselves.

Docs updated in query-vault-content.md and faq/understanding-tags.md.

* chore: adding changeset
2026-04-06 12:50:00 +01:00
..
codeblockHandler feat: add TAGS() macro and auto-detection for multi-tag AND queries (#202) 2026-04-06 12:50:00 +01:00
renderer chore: better sizing on explorer view (#180) 2025-08-12 19:06:07 +01:00
sql feat: add TAGS() macro and auto-detection for multi-tag AND queries (#202) 2026-04-06 12:50:00 +01:00
init.ts Migrating SQL Engine to wa-sqlite (#193) 2026-03-22 18:01:03 +00:00
module.ts Migrating SQL Engine to wa-sqlite (#193) 2026-03-22 18:01:03 +00:00
parser.test.ts fix(parser): fixing select keyword parsing outside the SQL queries (#206) 2026-03-29 11:15:57 +01:00
parser.ts fix(parser): fixing select keyword parsing outside the SQL queries (#206) 2026-03-29 11:15:57 +01:00