Version: 2.5.10
Description
Field-value node references — fields like Connected To, Related Project, Related People, Arena, Task Arena — are stored correctly in the field_values table but are never added to the references table. This means tana_related returns no connections for any relationship established via a reference-type field, even when those connections are clearly visible in Tana.
Steps to reproduce
- In Tana, create a node (e.g. an
#issue) and set its Connected To field to a #thread node
- Call
tana_related with the issue node's ID
- Observe: the thread connection does not appear in results
Root cause
The references table is only populated with inline_ref type entries (nodes mentioned inline in text as [[Node]]). Reference-type field values — where field_values.value_node_id points to another node — are not indexed here.
Scale of the gap:
-- Inline refs indexed (all that's currently in references table)
SELECT COUNT(*) FROM references WHERE reference_type = 'inline_ref';
-- Result: 5,793
-- Field-value references NOT indexed (missing graph edges)
SELECT COUNT(*)
FROM field_values fv
JOIN nodes n_from ON fv.parent_id = n_from.id
JOIN nodes n_to ON fv.value_node_id = n_to.id
WHERE fv.value_node_id != '' AND fv.value_node_id != fv.value_text;
-- Result: 552,178
Top missing reference fields by count:
Related People: 5,486
Related Project: 4,069
Arena / Task Arena: 6,798 combined
Connected To: 307
Project: 217
Expected behaviour
tana_related should surface connections made via reference-type fields, not just inline text mentions. If I've explicitly connected an issue to a thread via the Connected To field, that relationship should be traversable.
Workaround
I'm currently running a post-sync script that injects field-value references into the references table as inline_ref edges after supertag sync index rebuilds it:
INSERT OR IGNORE INTO references (from_node, to_node, reference_type)
SELECT DISTINCT fv.parent_id, fv.value_node_id, 'inline_ref'
FROM field_values fv
JOIN nodes n_from ON fv.parent_id = n_from.id
JOIN nodes n_to ON fv.value_node_id = n_to.id
WHERE fv.value_node_id != '' AND fv.value_node_id != fv.value_text;
This injects ~550K edges and tana_related correctly surfaces field-value connections after. But it needs to run after every full reindex.
Suggested fix
During supertag sync index, when building the references table, also iterate field_values and add a field_ref (or separate type) entry for each row where value_node_id is a valid node reference. Ideally with the field name encoded so graph traversal can filter by relationship type (e.g. CONNECTED TO "thread" VIA "Connected To").
Version: 2.5.10
Description
Field-value node references — fields like
Connected To,Related Project,Related People,Arena,Task Arena— are stored correctly in thefield_valuestable but are never added to thereferencestable. This meanstana_relatedreturns no connections for any relationship established via a reference-type field, even when those connections are clearly visible in Tana.Steps to reproduce
#issue) and set itsConnected Tofield to a#threadnodetana_relatedwith the issue node's IDRoot cause
The
referencestable is only populated withinline_reftype entries (nodes mentioned inline in text as[[Node]]). Reference-type field values — wherefield_values.value_node_idpoints to another node — are not indexed here.Scale of the gap:
Top missing reference fields by count:
Related People: 5,486Related Project: 4,069Arena/Task Arena: 6,798 combinedConnected To: 307Project: 217Expected behaviour
tana_relatedshould surface connections made via reference-type fields, not just inline text mentions. If I've explicitly connected an issue to a thread via theConnected Tofield, that relationship should be traversable.Workaround
I'm currently running a post-sync script that injects field-value references into the
referencestable asinline_refedges aftersupertag sync indexrebuilds it:This injects ~550K edges and
tana_relatedcorrectly surfaces field-value connections after. But it needs to run after every full reindex.Suggested fix
During
supertag sync index, when building thereferencestable, also iteratefield_valuesand add afield_ref(or separate type) entry for each row wherevalue_node_idis a valid node reference. Ideally with the field name encoded so graph traversal can filter by relationship type (e.g.CONNECTED TO "thread" VIA "Connected To").