I have a project template setup with a basic query search to pull in any notes containing the keywords from that project, but it always returns the note I am on because typically the note title is the same as the query keywords. Is there any easy way to exclude the current note?
Thanks for the quick reply. I’m talking about the inline query…
``` query
"Search Term"
``
When I add -file: “your filename” it also removes any filename with that word in too, so if the note was called “test” and other notes existed such as “test-2” and “test-3” then those would be removed which is not what I need. I just need the current note to be excluded if that makes sense?
You could most likely also use -file: /^test-1$/, but if it works with adding .md, then do that. The regex here could easily get some special characters disturbing the regex.
I don’t think so in a query like that. In dataview you can use [[]] but I don’t think that’s possible in these queries.
If you’re worried about that, you could consider adding a “random” tag to the current file, and do the search with excluding that tag. Do however make sure that tag is unique across your vault, so as not to exclude other than the current file.
One way of doing this could be to have tags like unique/something, and if you view them in the tags side pane, there should only be one of each nested tag.
In search, no, but in templates you can use {{$title}}. So you could make a template that just outputs the current note name, or one that includes the search stuff too, and use it to remake the search when you find it returns wrong results.