Useful outliner search/query examples

Started by Jesse Grosjean on 9/19/2023
Jesse Grosjean 9/19/2023 10:16 pm
I need to design a query language for my outliner.

Before I get too deep into that I want to survey the best of what's already out there.

Please suggest:

1. Your favorite outliners to search in?
2. What specifically you find useful?
3. Are there features that you don't find that useful and just confuse you?
4. What's missing? What do you want to do with your outline queries that you can?

Thanks,
Jesse
Amontillado 9/20/2023 2:46 am
One of the reasons I don't play well with Obsidian is Dataview. It's very popular and useful, but it suffers from fragility. I remember spending several sessions trying to get an example query to work. The problem was a required space at the end of a line, not something visible in posted examples.

It sounds like you've got plans for something unusual. I look forward to seeing Bike's evolution.

I should revisit Obsidian and see if I'm more compatible. It's changed. I've changed. Like a fare in Harry Chapin's Taxi, there might be hope for one more one night stand.
Jesse Grosjean 9/20/2023 12:33 pm
It sounds like you’ve got plans for something unusual. I look forward to seeing Bike’s evolution.

My starting point is TaskPaper's query language (which uses xpath model and syntax as starting point):

- https://guide.taskpaper.com/reference/searches/

One thing TaskPaper does to make searches shorter and more friendly is that it allows you to skip syntax and it will provide a default search behavior. For example if you want to search your entire outline for the text "Inbox" then you just type "Inbox".

But when you type "Inbox" you are leaving out many aspects that are needed for a hierarchical search. What TaskPaper does is fill in default values for the unspecified parts. For example "Inbox" is expanded to: //@text contains[i] "Inbox". All of the following searches expand to that same underlying search:

Inbox
@text Inbox
contains Inbox
@text contains Inbox
//@text contains[i] "Inbox"

More example searches and expanded forms:

Find any item that does not have @done attribute:
search: not @done
expanded: //not @done

Find any item that has both @due and @today attributes
search: @due and @today
expanded: //@due and @today

Find any item that is a project and that contains text "Inbox"
search: project Inbox
expanded: //@type = "project" and @text contains[I] "Inbox"

Find first item in each project that doesn't have @done attribute (next actions)
search: project *//not @done[0]
expanded: //@type = project//not @done[0]

Generally I like this design, but it can get complex. I think part of the complexity is just boolean logic combined hierarchical logic, I don't think there's a way around that if you want the search to be powerful enough to address any scenario. Another source of confusion is the expansions. The make simple searches much easier, but they can make it hard to go deeper and see what other options you might have.

At the moment I my plan is to keep this basic design, but then provide more tooling for understanding and composing searches.

Generally that tooling will be a separate UI where:

1. You type your search
2. Below your search you see fully expanded version of your search
3. See a table view of your entire outline with matches rows highlighted
4. If you select a range if your search the view (expanded search, and matched results) will update based on selected range.

This all seems pretty good to me. But before I dive in too far I'm interested to hear what others actually use and like.
Lucas 9/20/2023 3:09 pm
As far as outliner searching, the main feature I look for is the ability to save searches and, ideally, save them as something along the lines of "smart folders", so that I can simply click on a smart folder and see the results, rather than selecting a saved search from a drop-down list. For me, this makes outliners much more pleasant to work with.

I also really liked the way Mori had "tag folders", including the feature that you could add items directly to a tag folder and the items would receive that tag.

Another nice-to-have feature is the ability to display results either in hierarchical view or in a sortable "flat view".

Finally, it's great to be able to search and sort by date created and date modified, although that requires a "database" approach that might not fit with Bike.
Paul Korm 9/20/2023 8:35 pm
Features I find very useful

* Regular expression searching
* Type-to-replace highlighted search results (useful in conjunction with regex-based search)
* Search and replace across multiple documents
MadaboutDana 9/21/2023 9:30 am
Ditto!

Paul Korm wrote:
Features I find very useful

* Regular expression searching
* Type-to-replace highlighted search results (useful in conjunction with
regex-based search)
* Search and replace across multiple documents
Amontillado 9/21/2023 11:39 am
For an interesting implementation of regular expressions, check out the Mellel word processor. Regex's are built with a point and click interface. A newcomer to regular expressions doesn't even need to know he's using them.
Cyganet 9/24/2023 10:18 am
For me, an ideal query builder helps me to get the query right, but does not require me to write the syntax code myself.

Obsidian's dataview is particularly bad in this regard, being both complex and poorly documented. It took me two days to get the right syntax for "show me list of people whom I spoke to last week" (given a set of daily notes with links to people notes). The complication was to get the list of names in alphabetical order without duplication, not just regurgitating the lists as entered.

Best practice examples for me are the Microsoft Access query builder or, as analogy, how the Style Settings plugin in Obsidian is a GUI for making changes to CSS.
Amontillado 9/26/2023 9:24 pm
I applaud users and developers alike when there is a meeting at a need.

Obsidian has great promise. That gap between function and documentation, poorly bridged by my noggin, is what keeps me from being a full-fledged fan.

I found a YouTube channel called MyProductivemac with a lot of nice tips about Devonthink. I've been using Obsidian as sort of a fleeting notes/to-do list for work, a logbook of sorts, and I kept missing the mark with things like tasks in code blocks.

Devonthink, using labels for to-do, tags for grouping related tasks, and all that other Devonthinky stuff just works for me. It's either the briar patch I was born for or the front porch I'm fated to defend from a rickety rocking chair with scowl and walking cane.
Cyganet 9/28/2023 8:54 pm
I've just found an example Obsidian vault on GitHub that is full of examples of Dataview queries (both the code and the result):

https://github.com/s-blu/obsidian_dataview_example_vault

It's an amazing effort and a great learning tool.


nirans@gmail.com 10/1/2023 3:35 pm
My needs are fairly simple:

Search with context
search finds the words and the surrounding line
presents a lists with all the positive results
the results are clickable - I should be able to click on the result and be taken to the appropriate section
Saved searches
espically for tags
Complex queries
useful if there is metadata
Obsidian’s dataview is powerful, but I am a little too dense to make much use of it.