Skip to content

Commit

Permalink
Merge pull request athensresearch#6 from shanberg/merge-from-origin
Browse files Browse the repository at this point in the history
Merge from origin
  • Loading branch information
shanberg authored May 2, 2021
2 parents 4508db2 + 4b52162 commit 32420f5
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 445 deletions.
43 changes: 22 additions & 21 deletions src/cljs/athens/db.cljs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(ns athens.db
(:require
[athens.patterns :as patterns]
[athens.util :refer [escape-str]]
[clojure.edn :as edn]
[clojure.string :as string]
[datascript.core :as d]
[posh.reagent :refer [posh! pull q]]
[re-frame.core :refer [dispatch]]))
[athens.patterns :as patterns]
[athens.util :refer [escape-str]]
[clojure.edn :as edn]
[clojure.string :as string]
[datascript.core :as d]
[posh.reagent :refer [posh! pull q]]
[re-frame.core :refer [dispatch]]))


;; -- Example Roam DBs ---------------------------------------------------
Expand Down Expand Up @@ -41,6 +41,7 @@
:loading? true
:modal false
:alert nil
:win-maximized? false
:athena/open false
:athena/recent-items '()
:devtool/open false
Expand Down Expand Up @@ -447,17 +448,17 @@
(if (string/blank? query)
(vector)
(->>
(d/q '[:find [(pull ?block [:db/id :block/uid :block/string :node/title {:block/_children ...}]) ...]
:in $ ?query-pattern
:where
[?block :block/string ?txt]
[(re-find ?query-pattern ?txt)]]
@dsdb
(re-case-insensitive query))
(take n)
(map get-root-parent-node)
(remove nil?)
(mapv #(dissoc % :block/_children))))))
(d/q '[:find [(pull ?block [:db/id :block/uid :block/string :node/title {:block/_children ...}]) ...]
:in $ ?query-pattern
:where
[?block :block/string ?txt]
[(re-find ?query-pattern ?txt)]]
@dsdb
(re-case-insensitive query))
(take n)
(map get-root-parent-node)
(remove nil?)
(mapv #(dissoc % :block/_children))))))


(defn nth-sibling
Expand Down Expand Up @@ -583,9 +584,9 @@
ref-ids)
blocks (map (fn [id] (get-block-document id)) ref-ids)]
(mapv
(fn [block]
(merge block {:block/parents (get parents (:db/id block))}))
blocks)))
(fn [block]
(merge block {:block/parents (get parents (:db/id block))}))
blocks)))


(defn group-by-parent
Expand Down
Loading

0 comments on commit 32420f5

Please sign in to comment.