Apologies for the delayed response. I think you can do this with the following:

(file:(2021) -file:(202103)) (line:(/- \[ \].*.*/))

In other words, create an AND group with the first set of parentheses, then add the terms you want to search for and the ones you want to include within those.

So the above finds all files with 2021 in their names, but subtracts all files with filenames including 202103 (removing March from the query).

1 Like

If I’m understanding you, I think you’re looking to do something like “Find all incomplete tasks from the beginning of time up until yesterday.”

Probably the easiest way of doing that would be to pick a date arbitrarily in the past—your birthday, maybe? :tada:—for the “From” field and then write yesterday as the “To” field.

The plugin should translate that into your own date format.

1 Like

Thank you very much - I’ll give these a try!

You star! That works a dream! I did have to enter in my FROM date in the format of my daily notes ie YYYY-MM-DD for it to create fie:(2021-03-01 OR etc). If I entered in natural language 1st March 21 it looked for file:(01-03-2021 etc which meant it clearly didn’t find it. Logical of course!

Thank you so much - that is fabulous!

1 Like

In order to not show the long search string, I’m adding in the …

.internal-query-header-title {
display: none;
}

…you advised another user in an earlier conversation. But, I’m not sure where to put this. If I put it under the ```query line above everything else, it doesn’t seem to work… I’m not a programmer!

That is a bit of CSS. You can add it to your vault at Preferences → Appearance. Click the folder icon next to the Snippets section. There, create a file called “embed search.css”, and paste the code in. Refresh the Snippets section and enable the new snippet.

1 Like

Thank you so much - that works a treat!

1 Like

Hi @ryanjamurphy,

has there been any movement on this? I am also trying to search for tasks within a date range, as in ‘the next seven days’, so that all tasks that have a date link will show up in the search.

would this be possible?

Thanks!

Sorry, no progress to report. A workaround might be to generate the date search with Vantage then paste it into a block: operator.

Thanks for the quick reply!

I don’t understand what you mean…how do I do a date search for ‘next week’ without manually putting in each date?

Vantage provides a date search feature already. It’s the second part of the Vantage interface. You enter two natural language dates and it returns the search query you’d use to search the corresponding daily notes.

Oh yeah, I get that - but what if I don’t want to search daily note pages?

it might be a project page with a task such as this:

  • [ ] do the thing [[2021-10-03]]

My understanding is that the date range search does not catch that task as it’snot on a daily notes page. Maybe I’ve got that wrong?

Yeah, that’s why you’d need the workaround I was suggesting. If you searched for line:([[2020-09-28]] OR [[2020-09-29]] OR [[2020-09-30]]), it would pick up on a task linked to one of those dates. So you can generate that OR date-string with Vantage then just switch file: with line:.

1 Like

yes, that’s what I was thinking - but then I’d have to a) do this every week, and b) manually enter each date. both of which seem a bit cumbersome.

I’ll hunt around if there is a way to automate this…

Honestly, if it’s going in a daily note or similar template, a dataview query will probably work well for you.

I use the following in an Inbox note I check regularly. It picks up all overdue tasks. It should be trivial to edit it to look ahead instead, but let me know if you need help!

Overdue tasks

dv.taskList(dv.pages('"Calendar"')
    .where(p => p.file.day && p.file.day <= (luxon.DateTime.now().minus({days: 1})))
	.sort(b => b.file.day)
    .file.tasks
    .where(t => !t.completed), true)

I was hoping for a saved search, so that I can drag and drop tasks from the search pane into my weekly note (this means I don’t have to have the weekly note in Preview where I can’t work with it).

It’s looking ahead that I am trying to do - ‘find all tasks for the next week’ :slight_smile:

Please excuse my ignorance here, but what is the difference between doing the AND search on the line, block, section or note level? I’ve been playing and I get the same results in each case.

Maybe there isn’t one. Can you paste your example? What are you trying to achieve?

Hi Ryan, really I was just trying to learn more about creating searches in Obsidian, to which I’m coming back after quite a break. I know (I think) that Obsidian can only search at the note level, but with the plug in saying ‘line’ I wondered if that had changed.

In short, I’d like to be able to search on any line / block that has Attribute1 AND Attribute2, but not when it only has one or the other. My understanding is that Obsidian only searches at the note level, so for any note that has both Attribute 1 AND Attribute 2 mentioned somewhere, it will return all lines that include Attribute 1 OR Attribute 2, because the AND condition is at the note level. This means at the line level the results include lines with just, say, Attribute 1, because Attribute 2 is mentioned elsewhere on the note.

No, line:(term AND (another term)) should return what you’re looking for. I think.