Transclusion/Embedding for Searches

… it would be special to me :wink:

2 Likes

What about not requiring another syntax for searching?

  • [[foo]] will be a link to a page if the page with that exact title exists.
  • it will lead to searching for foo otherwise (like “Search in all files”)

Similarly for trascluded links/searches.

Or, if you would like to be more explicit, let’s say to start searching with ?, so [[foo]] for page foo and [[?foo]] for searhing foo.

2 Likes

In some tools and wikis, the sidebar is just a page.

So why not extend the File sidebar with the note .sidebar.md, and you can put anything you want there?

1 Like

I am not sure your answer helps exactly, although I understand what you mean - as a space saving device, sure, using a file in the sidebar is a great idea.

I believe this thread is talking about creating a way to embed searches (and all their wonderful combinations of search syntax) as a link. A static page in the sidebar will still not be able to do this unless Obsidian recognises how to interpret those “search links”.

This is a really cool idea. I would love to check my unfinished tasks every day as a transcluded search result in my Daily note.

1 Like

Not exactly the functionality that you described. But i think this tool can solve your problem

1 Like

I recommend combining search URLs with existing transclusion and formatting metaphors.

I understand (I hope correctly) that search URLs are coming which would look something like this:

[My Search](obsidian://search?vault=myvault&q=my+search+term)

Clicking that link would initiate a search in Obsidian.

Perhaps we could transclude that search just like any other link, by putting a ! in front of it.

![My Search](obsidian://search?vault=myvault&q=my+search+term)

When the page is rendered, that link would render as a list of matching notes.

And even better, perhaps we could apply some formatting using a similar syntax we now have for images:

![My Search|columns=3](obsidian://search?vault=myvault&q=my+search+term)

4 Likes

This would be extremely useful to me! I use a lot of ‘fake’ typed links like “- subset [[topic]]” or “- hasTopic [[topic]]”, and I would use this on the topic itself to automatically list eg all papers with that topic :slight_smile:
Glad to see more people think this is nice!

1 Like

+1, but would see it simply as a macro. Something like {{search: … }} using the same functionally as the search box, and yes, using | to then separate display settings for the query. I prefer this approach because it also provides a mechanism for plugins to extend on top of ie. {{plugin-name: …}}. Obsidian then provides the string inside the macro to the plugin, and renders the content it gets back.

1 Like

Use case or problem

Brief: Embed search results in a note as a list of links, which will then update in the future, as well as reflect in links on the graph.

Detailed: I’m finding the ability to copy and paste search results a great way to “automatically” populate index notes (or, Maps of Content). Additionally, using the OR function in search is also a great way to capture aliases terms for notes - for example the results of (CDC OR “Centers for Disease Control”) could go into the single CDC MOC.

One shortcoming to this approach, however, is that the MOC will only be current on the day I manually do this process; it will gradually fall out of date as I add more sources, notes, etc until I manually update again.

I’d like if I could define a search term, either in line in the note or by embedding a saved search, which then will update the list of results as I add and update notes elsewhere in my vault.

Proposed solution

Embed a named, saved search; alternatively, define the embedded search within the note, similar to {{date:YY-MM-DD}} function in templates, e.g.:
{{search:(CDC OR “Centers for Disease Control”) (path:“Sources”), sort:created DESC}}
And after this the note would populate a matching list of links.

I guess if I have many of these live/smart indices it could bog down Obsidian with a very large vault, but perhaps this could be resolved by only updating embedded search results with a prompt/command.

Current workaround

I create a saved search, such as (CDC OR “Centers for Disease Control”) (path:“Sources”), sort its results, and then use the “Copy Search Results” function to manually move the list of Wikilinks into the desired note e.g. CDC. Within that note I have a line above the results with the search term and date so I know how to reproduce and when in the future.

I organize my notes into a “Notes” and “Sources” folder; if this were automatic, I imagine including a list of references in most notes via two embedded searches in a ## Related Notes and ## Related Sources section at the end.

Related feature requests (optional)

6 Likes

I like the ideas that everyone is including here. Makes me wonder to what extent Obsidian can make end-user programming more available in the future.

1 Like

Good thinking!
Exists in Atlassian.
Would indeed be a good one ++1 :wink:

1 Like

++1 Really looking forward to this feature

1 Like

Anyone know where we are on this feature?

closer than before.

3 Likes

I take this to mean “it’s being worked on”, and that’s all I need to know :heart: Loving your work, Obs devs! :laughing:

2 Likes

Agreed. Much love to the team that is making this possible!

1 Like

This will be implemented in 0.10.2

https://forum.obsidian.md/t/obsidian-release-v0-10-2-insider-build/10290

12 Likes

My hacky weekly rollup →

I used:

  • the templater community plugin
  • two templates: note for notes, one for weekly rollups; and
  • a python script that is called by several templater {{}} aliases from those templates

When the file templates get inserted into a new markdown file, these aliases are replaced by the output of the script in python. To make things simple for me, I used year and julian date for my indexing scheme and just " OR "d the dates together in the query block that gets generated.

in templates.zip (429 Bytes) you’ll find:

  1. a generic “note” template that looks like this:
    image

  2. and a weekly assessment report (WAR) template - “war” that looks like this:
    image

in scripts.zip (755 Bytes) you’ll find my python script ‘date_utils.py’. The only Python pip dependency is the fire package. Just pip install fire or do a pip install -r scripts/requirements.txt when you unpack it.

Hope this helps someone! I’m still figuring out how to transclude them. If anyone has pointers I’m all ears!

-Russ

The Archive (The Archive (macOS) • Zettelkasten Method) takes this to the next level (or maybe the zero-th level?). Links and searches are exactly the same thing. Anything you surround in double brackets becomes a clickable search, and the top (most recent) result becomes the active page. The others, if any, are visible in the left sidebar.

This behavior contains the standard idea of a link. If you put the exact name of a note in brackets, it will link only to that note. But you can also search any topic, or something like daily notes from may 2021, or all kinds of other stuff.

I would absolutely love to be able to tell Obsidian to do this with my links.

2 Likes