blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.52k stars 389 forks source link

glob pattern matching #2304

Open GottZ opened 2 months ago

GottZ commented 2 months ago

this request comes from discord

I find it a interesting way to extend filter capabilities in both dql and plain js, thus I'm leaving this here as a reminder to myself or someone else willing to explore the possibilities in implementing this feature.

slimhk45 commented 2 months ago

+1 This feature is much needed 🙋🏻

Combining Tags + Glob patterns is powerful to control the exact files we want to include from which subfolders and with what naming convention.

Ex: includes only top-level markdown files ./*.md tagged with #tag and all markdown files in the first-level subfolders ./*/ tagged #tag.

FROM #tag AND (./*.md OR ./*/*.md)

holroy commented 2 months ago

For those of us not using Discord (anymore) , this issue would benefit from actually having the text of that proposal, instead of link into Discord...

GottZ commented 2 months ago

For those of us not using Discord (anymore) , this issue would benefit from actually having the text of that proposal, instead of link into Discord...

no context was lost. Discord OP posted a comment in regards to this to this issue.

holroy commented 2 months ago

Implementing this has the potential to break a lot of queries since it would require for the DQL queries to include all file extensions in the base queries, and not just *.md which it does currently. A lot of care should be taken if we opt to implement this.

It could possibly be implemented with some flag being set if the syntax recognised glob patterns to be used. I'm thinking allow the lines of rather using something like ext(md) (or ext(".md")), which when present would trigger a flag to not only use *.md in the query but open up for all files in the vault. But then again, this might also cause issue with rendering of other stuff since all variable expansion, file.lists&tasks, depend on the rows being within a known page (or file list) context.


Also, current version of Dataview has no notion of the current folder (if I've understood stuff correctly), so the syntax of using ./*.md or ./*/*.md might be misleading (at best).