Filtering search results based on MultiMarkdown metadata or YAML?

Let’s say I’m a researcher. While reading a text, I create a separate MultiMarkdown document where I write down my notes. I like to include relevant metadata at the top of my notes document. For example, I might include a field like this where I record the date that I worked on a document:

---
dates: ["2020-02-13", "2020-10-05", "2021-06-25"]
---

Now I might want to find some notes I remember writing in Winter 2020 just before the pandemic hit. I’d like my search to return markdown documents in my database where the dates field includes a value that falls between January 1st and March 15th, 2020.

Is there an easy way to run this type of search within DEVONthink? Or are there other tools for the job that might be easier to set up (for somebody with only basic programming skills who definitely is not equipped to learn to write a custom YAML parser from scratch in a timely manner.)

This is just a hypothetical scenario for now. So I can adjust the way I save my metadata if that would make this type of system easier to implement. I’ve tried setting up similar systems for myself in the past, but I found that I need to keep it simple to maintain up-to-date metadata – otherwise I develop bad habits where I don’t regularly update it, and it becomes not so useful. So I’ve found keeping the metadata within the document text itself, and keeping it simple enough that I can automate it using tools like Typinator and Keyboard Maestro helps me keep in the habit using these metadata fields to their fullest potential.

I found this thread had some useful info but not enough to answer this question - Searching for documents based on Markdown front-matter

1 Like

I doubt „easy“ is possible. AFAIK DT does not index the metadata in MD flies. There might be a hidden preference to enable that.

Even so, the metadata is just text. It has no semantics. In particular it is not recognized as a date.

So you’d have to script that: extract the „dates“ metadata, spilt it into separate strings, convert the strings to dates, put them into an array. After you’ve done that you can check if any of the dates lies in your interval.

It’s certainly feasible. If it’s worth the effort, I don’t know.

Edit: with JSON instead of YAML, you’d save some steps. But it would still be tedious.

Help > Documentation > Appendix > Hidden Preferences : IndexRawMarkdownSource

did you get any solution for this?

I ask because I’m planning to add a time field on the yaml front matter and I would like to search for files within “this month” or “last month”

This is not possible with YAML frontmatter as those are just strings. They are not dates (except in your mind :wink: ).

If you want to search for dates, you need to use another option, e.g., custom metadata, e.g.,…

You are free to continue to use frontmatter in the document but it’s not going to be used for searches in the way you’re describing.

Yeah … I know, but on the yaml I’m using ISO so it can be parsed.

However, I see that the custom metadata feature is pro…

However, I see that the custom metadata feature is pro…

That is correct. Custom metadata is available in the Pro and Sever editions.