obsidian-query-language
obsidian-query-language copied to clipboard
[Question] Is there any way to exclude subfolders from search?
For example
name: "Frameworks"
query:
path: "^Dev/Languages/JavaScript/Frameworks/"
template: "table"
fields: ["title", "tags"]
sort: "-title"
will return every file at folder and its subfolders which I don't want to see
Does something like below work:
```oql
name: "Frameworks"
query: {
$and: [
{
path: "^Dev/Languages/JavaScript/Frameworks/"
},
{
path: "!Dev/Languages/JavaScript/Frameworks/folder-to-be-excluded"
}
]
}
template: "table"
fields: ["title", "tags"]
sort: "-title"
```
If you want to exclude all subfolders, I'm not sure if there's a easy way to do that. You can combine the extended search with the logical query operators..
I'll have a look if it's possible to supply just to path to the note (instead of it's full path). That would allow for just getting the notes in a folder (and not a subfolder)
@jplattel Thanks for the suggestion, it works indeed.
But I need to specify every subfolder this way. As I understand there is currently no way to use regexp or smth similar in the plugin?
Yes, right now that's the only way I can think of. I'll include a basePath to query with in the next update of the plugin, that way it's possible in the future! I'll mention it here once it's ready!