Add UI and scripting support to embedded queries

+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

Maybe could be merged with: Explicit `sort` parameter in query syntax - #2

Good find, thanks. My request is a bit broader though. I wrote sorting order as an example but I think the other search options like auto-collapse or show-more-context would be similarly interesting for some workflows.

2 Likes

bumped …
I too would like to see some code for the match case, collapse results, show context and change sort order options in search. So you can use them in embedded searches.

Would be great to have something like limit:5 to limit the number of search results in an embedded search.

My use case is to shown an embedded search with the last 5 contact moment with a certain person on their own page. Only from the daily’s folder as that is where I note my contactmoments.

The limit:5 would be great but especially the change sort order, maybe somthing like this:

sort:<asc / desc>:<cdate / mdate / name> would be great.

All other options could be set by a boolean value : TRUE / FALSE

1 Like

Adding additional options that are available in sidebar searching pan to embedded queries. like mass collapsing etc

Thank you

3 Likes

another thing I encountered is that search results can be very messy sometimes. Like when I search in blocks (block:()) I still get multiple answers for a single blocks. But the more reasonable sort of showing the results would be to add give me all the block which at least one search result been positive for them(no matter how manytimes). I think at least adding an option for this would be very helpful

Thanks

I put together a plugin that tackles the UI portion of this FR. It will add a controls to all inline queries (in live preview and reading modes) that let you collapse, sort, enable context, copy, hide the title, and hide the results.

I have not tried tackling the scripting aspect of this yet but there are plugin settings which allow you to change the defaults for all of the actions listed above.

The plugin can be installed using the BRAT community plugin and adding the beta plugin repository “nothingislost/obsidian-embedded-query-control”.

Issues and suggestions can be raised on the Github repo located here: https://github.com/nothingislost/obsidian-embedded-query-control

Here’s a quick video showing off what it can do:
embedded-query-control

9 Likes

This is so AMAZING @NothingIsLost !! Thank you so much. This is EXACTLY what I wanted!

EVERYONE please please please show your appreciation for @NothingIsLost hard work if you get as much value out of this plugin as I am, by sending him some love with his Buy me a Coffee link below!

This is literally a game changer! I know I said that a lot, but this time I REALLY mean it :wink: haha

Thanks again!

Embedded Query Control v0.2.1 extends the embedded query syntax to allow you to configure controls on a per query basis. The extended syntax looks like this:

```query
path:foo tag:#obsidian
title: custom query name
collapsed: true | false
context: true | false
hideTitle: true | false
hideResults: true | false
sort: alphabetical | alphabeticalReverse | byModifiedTime | byModifiedTimeReverse | byCreatedTime | byCreatedTimeReverse
```

See the readme for more details https://github.com/nothingislost/obsidian-embedded-query-control/blob/master/README.md

8 Likes

Can’t wait to try it once it is available in the Community plugins …

that’s awesome!!!

Not a feature request. Just a question. Does it apply or affect backlinks, too?

Nice one @NothingIsLost – Please do post back here when it’s available via Community Plugins

I’m a fan! This looks great and I hope that it gets into the community plugins. AND, is added as a native feature.

1 Like