Speed up ‘oni-org-roam--books-to-read’
By doing more of the filtering in SQL rather than Emacs Lisp it got a bit faster.
This commit is contained in:
parent
346f4598a5
commit
cff931be7e
1 changed files with 8 additions and 8 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2023.0330.183039
|
;; Version: 2023.0728.155508
|
||||||
;; Package-Requires: (oni-org org-roam)
|
;; Package-Requires: (oni-org org-roam)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -67,13 +67,13 @@
|
||||||
(not (string= state "FINISHED")))))
|
(not (string= state "FINISHED")))))
|
||||||
|
|
||||||
(defun oni-org-roam--books-to-read ()
|
(defun oni-org-roam--books-to-read ()
|
||||||
(seq-filter (lambda (item)
|
(org-roam-db-query (concat "select properties, file, title, group_concat(tag) as node_tags "
|
||||||
(string= (map-elt (car item) "STATUS") "toread"))
|
"from nodes "
|
||||||
(org-roam-db-query [:select [nodes:properties nodes:file nodes:title]
|
"left join tags on node_id=id "
|
||||||
:from nodes
|
"group by id "
|
||||||
:left-join tags
|
"having node_tags like '%%\"book\"%%' "
|
||||||
:on (= tags:node-id nodes:id)
|
"and node_tags like '%%\"unread\"%%' "
|
||||||
:where (like tag (quote "%\"book\"%"))])))
|
"order by title")))
|
||||||
|
|
||||||
(defun oni-org-roam-list-books-to-read ()
|
(defun oni-org-roam-list-books-to-read ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
Loading…
Reference in a new issue