⚡️ Ideas
Maciej Smoła Maciej Smoła Apr 5, 2023

GREAT-GRANDPARENT and higher levels of PARENT search operator

Explain the problem as you see it

There is no way to reference a node that is more than GRANDPARENT level above search node.

Why is this a problem for you?

I have structured content with multiple relationships between them like (tags are only examples):
/- Level 1 #book
/-- Level 2 #chapter
/--- Level 3 #topic
/---- Level 4 #paragraph
/----- Level 5 #sentence

I have tasks for node from one of the levels (e.g. fixes for sentence or improvements on topic). Then I have searches in each level's supertag template. Each level deeper supertag has field of level up supertag with "Part of" relationship.

I would like to have a search connected to each supertag templates to find all tasks connected to the current level – that is to the level itself and to all of the levels deeper.

So at Level 5 sentence I would get only tasks with Level 5 link in its fields but at Level 3 search I would get all tasks related to whole topic, alongside with paragraph (Level 4) and sentence (Level 5) tasks.

Suggest a solution

Make a search operator with a more flexible way to point at specific ancestor node level:

  • PARENT_1 (= PARENT)
  • PARENT_2 (= GRANDPARENT)
  • PARENT_3 (=GREATGRANDPARENT)
  • and so on, without limit to the number.

⁨3⁩ ⁨Comments⁩

Came here to find this suggestion! I'm in need of a great-grandparent, but would like the flexibility of having more expanded control over pointing to ancestry of nodes. The notation you suggested feels good to me!

GREATGRANDPARENT is a lot of typing, and it's just one option. Perhaps either a family of commands or one command that takes parameters as you type it:

PARENT becomes UP_1
GRANDPARENT becomes UP_2
GREATGRANDPARENT becomes UP_3
GREATGREATGRANDPARENT becomes UP_4.

PARENTS_DESCENDANTS becomes UP_1_DOWN_N

Parent's grandchildren would be UP_1_DOWN_2.

Realistically, there has to be a limit. UP_10_DOWN_10 is ridiculous unless you want to fry eggs on the processor.

The problem with search operators such as the ones suggested, and with PARENT and GRANDPARENT, is that they are too fragile, searches that use them break as soon as you change something's indentation.

I'd like to see an ANCESTOR WITH TAG which took one argument (a tag) and matched the nearest ancestor node tagged with that tag. So in the original example

/- Level 1 #book
/-- Level 2 #chapter
/--- Level 3 #topic
/---- Level 4 #paragraph
/----- Level 5 #sentence

a search node nested under level 5 with the following query

ANCESTOR WITH TAG #chapter

would match the level 2 node.