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

document dsl rules for advance queries #69

Open
xxchan opened this issue Jan 21, 2023 · 3 comments
Open

document dsl rules for advance queries #69

xxchan opened this issue Jan 21, 2023 · 3 comments

Comments

@xxchan
Copy link
Contributor

xxchan commented Jan 21, 2023

I was trying to understand what's the actual meaning of between, but I can't find the documentation. It seems to be the task's journal date, but these queries made me think it's the referenced journal date: (Tasks referencing due dates ...)

- 10. Tasks referencing due dates in the past
#+BEGIN_SRC clojure
#+BEGIN_QUERY
{:title "⚠️ OVERDUE"
:query [:find (pull ?b [*])
:in $ ?start ?today
:where
(task ?b #{"NOW" "LATER" "TODO" "DOING"})
(between ?b ?start ?today)]
:inputs [:56d :today]
:collapsed? false}
#+END_QUERY
#+END_SRC
- 11. Tasks referencing due dates up to 10 days ahead
#+BEGIN_SRC clojure
#+BEGIN_QUERY
{:title "📅 NEXT"
:query [:find (pull ?b [*])
:in $ ?start ?next
:where
(task ?b #{"NOW" "LATER" "TODO" "DOING"})
(between ?b ?start ?next)]
:inputs [:today :10d-after]
:collapsed? false}
#+END_QUERY
#+END_SRC

Then I found the definition here https://github.com/logseq/logseq/blob/master/deps/db/src/logseq/db/rules.cljc

   :between
   '[(between ?b ?start ?end)
     [?b :block/page ?p]
     [?p :block/journal? true]
     [?p :block/journal-day ?d]
     [(>= ?d ?start)]
     [(<= ?d ?end)]]

So it's indeed the task's journal date and the queries above are wrongly explained. I think it might be better to add documentation for these rules, and fixup the examples.

@Bad3r
Copy link
Collaborator

Bad3r commented Jan 21, 2023

Thank you @xxchan!
Since you did a lot of the hard work so far, do you want to submit a PR with the changes?

@cnrpman
Copy link
Collaborator

cnrpman commented Jun 4, 2023

More items to document for advanced queries:

  1. Add documentation for "Clause order of advanced query" #60

  2. Some great examples can be found here to help the documenting:
    https://discuss.logseq.com/t/queries-for-task-management/14937/51

  3. Also need to document how to setup default-queries in config.edn
    And how to capture ddls
    Should have more documents / easier to use deadline-based sorting and filtering (advanced query) logseq#9569 (comment)

@YeungOnion
Copy link

I thought this was a minor thing that was just me and didn't even check the issues - I suppose I should have - @xxchan looks like they have better homework than I had. I opened a very basic PR #114 since I thought it if was wrong it would attract attention and since I don't know any clojure, I'm sure I have misunderstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants