Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for "or" and "not" in tag queries #358

Closed
Remich opened this issue Aug 24, 2020 · 6 comments
Closed

Support for "or" and "not" in tag queries #358

Remich opened this issue Aug 24, 2020 · 6 comments
Labels
awaiting-pr enhancement New feature or request proposal Proposal with exact spec yet to be fleshed out

Comments

@Remich
Copy link

Remich commented Aug 24, 2020

Hi,

I figured by trial and error (missing in documentation) that automatic links support the "and-operator": e.g.: [[z:zettels?tag=science&tag=math&timeline]]

It would also be nice to have support for "or" and "not" operators, and maybe parenthesis, in order to create arbitrarily complex search queries for auto-linking.

This would allow for a better auto-linking experience.

@srid
Copy link
Owner

srid commented Aug 24, 2020

We could add a q parameter to support complex queries, for example:

[[z:zettels?q="(tag:science OR tag:physics) -(tag:math)"]]

Which in flexible links of #312 would look like:

{{zettels | q = (tag:science OR tag:physics) -(tag:math) }}

@srid srid added enhancement New feature or request proposal Proposal with exact spec yet to be fleshed out labels Aug 24, 2020
@srid
Copy link
Owner

srid commented Dec 28, 2020

FTR, and / or differentiation is available in the code via the TagQuery type as of #500. That type will have to be enriched further in order to support this feature (at this point, however, the whole query thing must refactored into a plugin of its own).

@srid
Copy link
Owner

srid commented Jan 2, 2021

This should get implemented after #407

@srid srid mentioned this issue Mar 15, 2021
15 tasks
@s9gf4ult
Copy link

s9gf4ult commented Apr 4, 2021

I would

{{zettels | q = (tag.science | tag.physics) & !(tag.math) }}
  • & for AND
  • | for OR
  • ! for NOT
  • () for brackets

Also, I would allow to query by arbitrary zettel's metadata.

Consider this meta

issue:
  status: "bug"

You could query it by

{{ zettels | q = issue.status = "bug" }}

So, there must be also

  • " for string literals
  • true false for boolean literals
  • = for comparison of two metadata values

@srid
Copy link
Owner

srid commented Apr 4, 2021

Don't see the value of favouring C-like operators instead of using standard search query operators used by other apps and sites, but doing the below is a good idea.

I would allow to query by arbitrary zettel's metadata

@srid srid changed the title Support for "or" and "not" when generating "automatic links using queries". Support for "or" and "not" in tag queries Apr 20, 2021
@srid
Copy link
Owner

srid commented Aug 8, 2021

Closing per https://neuron.zettel.page/next ... to further discuss this idea, post in srid/emanote#48

@srid srid closed this as completed Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-pr enhancement New feature or request proposal Proposal with exact spec yet to be fleshed out
Projects
None yet
Development

No branches or pull requests

3 participants