Add UI and scripting support to embedded queries

For now I managed to implement something similar with a smal script and the DataView Plugin.

```dataviewjs

dv.taskList(dv
   .pages()
   .file
   .tasks
   .where(task => task.text.includes("#Deadline"))
   .sort(
   		task => task.text.split(" ").filter(x => x.contains("#Deadline"))
		, "asc"
	)
	.map(task => {
		task.subtasks = [];
		return task;
		}
	)
   )

This would print all nested Deadline Tags (#Deadline/2021-10-01, #Deadline/2021-10-06) chronologically.
Feel free to adapt. Please note that only tasks are included. Normal Text lines with #Deadline would not be found. Havenā€™t found yet a way to improve this.

1 Like

Use case or problem

I have multiple medical issues. Iā€™m trying to log symptoms in Obsidian as they occur. Iā€™ve tried one large log for all issues and creating individual notes when each event occurs. Either way, Iā€™m trying to create a note that queries the rest of the vault based on a tag and creates a note on only those things I select. However, I need the entire block or small note, not the ellipsis followed by the text Iā€™m getting in the embed (ā€¦xyz). If I go into the search and hit the ā€œmore contextā€ button, I get exactly what I want. But I canā€™t export that to a PDF to my various specialists.

Proposed solution

Just add a ā€œshow-more-contextā€ query operator to the query language and have it run the same code thatā€™s already tied to the button in search.

Current workaround (optional)

Related feature requests (optional)





7 Likes

Not sure if I understand you correctly, but I think that is already possible (or it might be a plugin that I am using without being aware):

hope this helps!

They donā€™t want to have to do that each time for every result. I believe they just want the button like in native search bar that shows the full context for all results instead of having to click the arrows one by one.

I also really want this as I would like to be able to sort the results by date created or modified with the sort button. Also the collapse / expand all results is a nice feature too.

2 Likes

Exactly. Because I want to be able to easily query just the information each specialist wants and export to a PDF.

I guess what I really want is for them to put the button functionality in the search feature into the inline query system using query operators. Their documentation on the search feature already implies it (whether they meant to or not), and I spent a lot of time trying to use query operators to no avail. (Search - Obsidian Help)[Search - Obsidian Help]

1 Like

+1. This would be super-helpful for MOCs.

Maybe it is a seperate request but limiting the number of results would also be very nice. I have ben using it for a while and some results become very long. Or even instead of limit 10 something like list 10 that would result in an unlimited result list but with only 10 results per ā€˜pageā€™. With previous and next buttons and the number of pages in the result.

I will have to back you up on this one. I heavily use search queries because I think they have great potential to resurface information. I also try to keep things simple in my vault so Iā€™m not that keen on using Dataview. Adding functionality into embedded queries would for sure make my life easier !

1 Like

I like this attitude. Stay independent, keep clean and flexible, make your own solution (by using multiple already-existing feature sets), if possible, and so you understand better how your system/workflow works because you cobbled it togetherā€¦

1 Like

Another +1 for this

+1000

I would also love to see this feature.
Specifically, I want to query all my admonition (codeblocks) and display them fully rendered.
Currently I can only show the code version and itā€™s collapsed
image

A fully rendered admonition quote would like that
image

I guess that same logic would apply to any code block.

Dataview isnā€™t an option at the moment because it canā€™t search the body of the note yet.

1 Like

Can a mod please add the tag for ā€œSearchā€ to this request. It took me a while to find this FR again because I was looking under Search tag but it is only marked as ā€œValuableā€. Thanks! cc @WhiteNoise

+1 for this!

I see in search documentation a discussion of a ā€œCollapse Resultsā€ toggle for search results. Is there a way to specify this in the the markdown for a page? Ie to specify this toggle in an embedded search?

CONTEXT

As with others above the use-case I have in mind is when creating pages to index content on a topic ā€“ the expanded view is far too cluttered. (*Such ā€œmaps of contentā€ are essential features of many knowledge-management methodologies)

Feature request: allow to specify sort options in obsidian://search URI and embedded search results.

From time to time you need to specify the exact sort order for specific search.

Examples:

[All notes sorted alphabetically](obsidian://search?query=path%3A%2F)
[All notes sorted by recently modified](obsidian://search?query=path%3A%2F&sort=3)

Embedded search results sorted alphabetically:
```query
path:/
```
Embedded search results sorted by recently modified:
```query sort=3
path:/
```

3 Likes

Please move all features which exists in search pane to embeded search

Use case or problem

We have only one way to see a list.
I would like to suite it to needs.

Proposed solution

implement as a parameters all existing feature of search pane
image

Current workaround (optional)

no

Related feature requests (optional)

https://forum.obsidian.md/t/some-settings-like-sorting-order-for-query-blocks/10972/2
https://forum.obsidian.md/t/explicit-sort-parameter-in-query-syntax/11074

11 Likes

This is must have feature as one needs context or vertical-expand in embed search too

It would be very helpful to have some options like sorting order be available for query blocks.

Use case or problem

Iā€™ve been using query blocks to create, e.g., lists of meeting notes (with date in title) but for this it might be handy to be able to specify some more search settings for each individual query block. Otherwise for me the newest meeting note ends up in the bottom which is not very helpful.

Proposed solution

Add a syntax to modify sorting order etc. using text commands

12 Likes

Instead of creating a new Feature Request I will append to this one because I think we want to create the same workflow. Like being able to get a list of document names that the query returns in a list view.

I really like the idea of embedded searches. My workflow consists of a lot of ā€˜Parentā€™ pages that link to small notes. Being able to have a big blok of all related pages (by tag) at the end would be really cool.

Being able to control the output would also be amazing! I would like to create a cloud or list of pages where a tag is mentioned like:

search: #tag
Results:
> Page X
> Page Y
> Page Q

Or in a ā€˜running outputā€™ like:

Results:
Page X, Page Y, Page Q
4 Likes