# Fallback Search for Zettels...

I use The Archive. Occasionally, I find notes that are no longer needed, and I move them from The Archive into a "cold storage" folder. This could potentially leave "dangling links" around. At other times, I want to link to a source file on my hard drive, but rather than using an inline file:/// link, which is prone to breaking, I just drop another zettel link inline (eg see the source file [[202212152155]] on my hard drive).

Naturally, when running across these links, clicking on them in The Archive gives no results, and leads to nowhere. This requires me to then copy the zettel id out, and paste it into a file-system-wide search. Ideally, this would be a smoother process.

I'm interested in any suggestions for making this process smoother.

I notice there's a contextual menu in The Archive, when clicking on these links. Perhaps I could create a system service that would show up here? Perhaps there's some other way to automate a fallback search.

Any ideas are appreciated.

• I have something that will work, but I'm afraid I don't fully understand your dilemma.

1. You have a "cold storage" directory. Do you have two or three of these? It will make a difference.
2. Are you exclusively talking about originally created The Archive files? No third-party files like images.
3. Where do you want to view the files? Default MarkDown app or The Archive? Will they be left in the "cold storage" directory in the end or rejoined into your ZK?

As you see, there are a lot of different scenarios which make this complicated. Creating options for these and other workflows that we haven't thought of yet can make this problematic.

Will Simpson
The quality of our thinking is directly proportional to the quality of our reading. To think better, we must read better. - Rohan
kestrelcreek.com

• @micahredding Why bother with the cold storage approach? An alternate approach would be to add a tag "#coldstorage" to any old zettels that you don't want to access any more and then use a search which includes tags or terms you want included and likewise others that you want excluded (like "#coldstorage"). I don't understand the need to "clean out" the ZK.

• edited December 2022

@micahredding The Automator/System Services approach could indeed work.

I never thought of providing something to the user in these situations except the "nothing found"/ "no notes selected" labels. (Of course you'd be seeing some notes in the sidebar because at least one note contains the link itself.) There's potential to do something useful there.

Author at Zettelkasten.de • https://christiantietze.de/

• @Will said:
1. You have a "cold storage" directory. Do you have two or three of these? It will make a difference.

In practice, I have a single cold storage directory, although I have so many files, I have to break it up by years. But my ideal is probably just to search the entire user directory.

1. Are you exclusively talking about originally created The Archive files? No third-party files like images.

In practice, I'm using text files, but I could imagine linking to another file in the same way.

1. Where do you want to view the files? Default MarkDown app or The Archive? Will they be left in the "cold storage" directory in the end or rejoined into your ZK?

I want to view them in the default app, and leave them in place. Actually, my preference is probably just to "Reveal in Finder".

• @GeoEng51 said:
@micahredding Why bother with the cold storage approach? An alternate approach would be to add a tag "#coldstorage" to any old zettels that you don't want to access any more and then use a search which includes tags or terms you want included and likewise others that you want excluded (like "#coldstorage"). I don't understand the need to "clean out" the ZK.

A couple of reasons come to mind. For one, I want basic searches to work without any modifiers. I don't want to have to narrow down in the default case. For another, I want to use my ZK in contexts outside of The Archive, where the search functionality may be highly limited. For example, I might like to pull up a quote or some lyrics on my phone. In an app like 1Writer, searching through 10,000+ files is already arduous. I don't want to further complicate things.

But I've found "weeding" or narrowing down files to be an important part of my process. It's not that I'm eliminating subjects or thoughts. It's that I'm refining them, and this often involves re-conceiving sets of notes. I know this is not the advised process, and perhaps if I were radically more disciplined on the front end, this would never become necessary. However, I find being "moderately disciplined" has worked out really well for me.

Further, deciding what belongs in my ZK is itself a learning process, and so my practice has shifted over time. I could have tried to figure this all out on the front end, but I think imagining I could do so in such an absolute way is epistemologically suspect.

FWIW, my "cold storage" is not simply for retired ZK notes. It's also a kind of running log of various other things in my life. The number of files here significantly outnumbers the files in ZK.

• edited December 2022

I have the basics of a "Service" working. It does not quite meet all your criteria.

@GeoEng51 is on to something that most users could use. I use this strategy in my workflow. It cleans up the Saved Search Lists but does not prevent "cold storage" notes from appearing in searches. This is an advantage and a disadvantage. It can gum up the list with "cold storage" junk and show me where something I thought belonged in "cold storage" is helpful. This method is simple, non-technical, and works in 90% of the cases. But not everyone's.

We'll have to wait a bit longer for the perpetually coming release of scripting into The Archive to see what might be able to be done with the tools @ctietze provides.

/soapbox
My advice is to get Keyboard Maestro. This becomes trivial with Keyboard Maestro. Keyboard Maestro makes The Archive dance. It is the first thing I install on a new mac. I can add any workflow ideas I can throw at it in any program, including the OS.
soapbox/

1. The "Service" I've started is restricted to one directory and no subdirectories. I'm working on that.
2. The file, if found, is opened with the default app.
3. You'll have to manually open this "Service" in Automator and change the search directory to your "cold storage" directory.
4. Currently, a recursive search will not produce the desired results.
5. As a trial, I set the search directory to my home directory and had it search recursively throughout. It to almost a full minute of user time for the search, going out and searching iCloud, GDrive, and OneDrive.
6. I do see uses where developing this further adds value to my workflow.
7. All you need to do is highlight the UID and right-click, selecting Launch File from the Services menu.
8. The "Service" is currently creatively called "Launch File."
9. I have a ton of services. You may not.
10. I use iaWriter as my default app for markdown files.

Launch File Service In action.

Will Simpson
The quality of our thinking is directly proportional to the quality of our reading. To think better, we must read better. - Rohan
kestrelcreek.com

• edited December 2022

[...]
Any ideas are appreciated.

absolute: file:///coldstorage/fubar.md

relative: file:///./fubar.md

where './' is the current enclosing folder...


edit: an online path converter

Post edited by Mike_Sanders on
• @Will said:
I have the basics of a "Service" working. It does not quite meet all your criteria.

Thanks for doing this, Will! I haven't been able to get it to install on my machine, but I may try to recreate it, based on what you've described here.

My advice is to get Keyboard Maestro. This becomes trivial with Keyboard Maestro. Keyboard Maestro makes The Archive dance. It is the first thing I install on a new mac. I can add any workflow ideas I can throw at it in any program, including the OS.

The first thing I install is Alfred, which I use for a number of Archive-related tasks. I keep trying to figure out Keyboard Maestro, but my mind rejects it.

You should right-click on it and open it to change the directory to search. The current iteration will only search one directory and not the subdirectories. I've come up with a way to search a directory with all its subdirectories but it is written in Python. Apple infinite wisdom stopped including python along with their OS which makes it hard for the user to install and maintain.

Will Simpson
The quality of our thinking is directly proportional to the quality of our reading. To think better, we must read better. - Rohan
kestrelcreek.com

• @micahredding, I've been thinking about expanding the search directories in our little "cold storage" service. The problem is speed. If we set the search scope to our home directory and everything below, the code, which must traverse the entire tree, takes too long, which in my case, because I might be an outlier, takes over ten seconds. I couldn't find a way to exclude directories from the search scope, but I did find a way only to include specific directories. This speeds up the search by not searching the user's library, applications, pictures, movies, iCloud, etc. The paths listed are the root paths, and all subdirectories below are searched. Limit these directories as much as practical.

I also removed the "Get Contents of the Clipboard" action, it caused problems.

#!/bin/zsh

# cd /Users/will/Dropbox/zettelkasten
# file=$(ls| egrep$1)
# echo /Users/will/Dropbox/zettelkasten/$file find /Users/will/DropBox -name "*$1*" -print
find /Users/will/Documents -name "*$1*" -print find /Users/will/Projects -name "*$1*" -print
find /Users/will/Kestrelcreek -name "*\$1*" -print


Will Simpson
The quality of our thinking is directly proportional to the quality of our reading. To think better, we must read better. - Rohan
kestrelcreek.com