Add UI and scripting support to embedded queries

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

I love this! :heart_eyes::heart_eyes: will it become a community plugin?

1 Like

Thank you so much @NothingIsLost. This plugin is really underrated !
Are you accepting PRs ? Do you plan to make it an official Community Plugin one day ?

Loved this plugin! This could be a standard feature in Obsdian. I have some custom queries that I’d love to enable “Show more context” as default.

I would love to have Query Control’s syntax in the core plugin. Embedded searches are a great way to collect and display info without DataView, but the lack of sorting and display options hampers them (and it’s frustrating because we know Obsidian’s search can do those things). Please sherlock!

I don’t need or want the visible controls — when I embed a search I want a specific view. With the current design of the search controls I think it’s unlikely they’d be added anyway, but if they were I think it would make sense for the syntax to include an option for its visibility.

8 Likes

+1 to this

I was looking at this in the context of searching for properties

```query
[myprop:thing]

where the uncollapsed results just show the property line containing “thing”, which I already know it’s there so it’s pretty redundant to show it for every result

agree that embedded query plugin syntax looks great and how I’d imagine obsidian implement it (also without the visible controls, or a way to turn them off)

Frequently run into want of Match case as well, and I cannot do anything.

+1 for all features of a default search in the embedded search

And, NothingIsLost, many thanks for your solution