Zettelkasten Forum

boolean search/exclude tags?

Is there a way to exclude tags from a search? Like !#tagname?


  • Not yet, but I'll tackle this very soon!

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

  • That sounds excellent! It might be even more useful if you could not only exclude tags but any search term.

  • Sure :) I’ll roll this out on the cutting edge channel first to experiment with various operators and to make sure that the search doesn’t slow down that much.

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

  • I think that it is not necessary to distinguish between tags and words in the search. Both are specified strings. The logic is more like: Include/exclude string -- whatever the string might be.

  • Dear friends, switch to the "Cutting Edge" channel and enjoy yourself some boolean search expressions! Please test it and try to break it to make sure everything works as expected.

    • operators are all caps: AND, OR, NOT/!.
    • foo bar baz is equivalent to foo AND bar AND baz
    • foo OR bar is new
    • NOT b is !b and will show notes that have no "b"
    • ! b (note the space) is ! AND b
    • "!b" is a phrase search for "!b", matching the literal exclamation mark
    • escaping works, too: \!b
    • a propos phrase search: "the archive" OR #zettelkasten will not match the and archive alone, as you'd expect from phrase searches
    • escaping in phrase searches will also work :) hello "you \"lovely\" specimen"
    • if you ever need to scream "AND" inside the Omnibar and mean it literally, escaping will do the trick: \AND
    • you can parenthesize expressions, !(foo OR (baz AND !bar) is, of course, equivalent to !foo OR !baz AND !foo OR !bar (which is not saying that OR and AND have correct operator precedence; I found that doesn't matter a lot for our purpose)

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

  • Wow, that is (very){5} cool!

    I always wished for a way to exclude notes that match certain search terms, but the search system you have implemented is so much better than that.

  • Great to hear you like it :)

    I noticed myself that foo AND bar will match correctly but won't highlight "bar" in the matches (or any other term except the first). Dang.

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

  • When do we get full RegEx find/replace in the editor? :-)

    This is Me

  • In the search, not anytime soon :) Regex is terribly slow in comparison, and until I can figure out how to make that bearable without having the app freeze for a minute per search request, no dice. Anyway what kind of cryptic hieroglyph sequences would one store as notes so Regexes could even be that useful?

    In the editor, though, it's not that bad. But don't hold your breath, other things come first.

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

  • I was definitely thinking in the editor. Or a reasonable subset of notes (i.e. a saved search). But you know, it's totally fine because if I really need to RegEx, I can open in Sublime Text or something! Beauty of plaintext, right?

    This is Me

Sign In or Register to comment.