diff --git a/Differences-from-Datomic.md b/Differences-from-Datomic.md new file mode 100644 index 0000000..9f67cbd --- /dev/null +++ b/Differences-from-Datomic.md @@ -0,0 +1,51 @@ +## fulltext + +The `fulltext` function in Datomish supports sets of attributes or the special keyword `:any`. + +To do a fulltext search that matches page titles or excerpts: + +``` +[(fulltext $ #{:page/title :page/excerpt} "something") [[?page]]] +``` + +To match any attribute at all: +``` +[(fulltext $ :any "something") [[?entity]]] +``` + +## Query inputs, ordering, and limits + +` ?instant ?time)] + [?page :page/url ?url] + [(get-else $ ?save :save/title "") ?title] + [(get-else $ ?save :save/excerpt "") ?excerpt]] + {:limit limit + :inputs {:time 1234567890} + :order-by [[:instant :desc]]}) +``` + +**JS**: + +``` +await db.q( + `[:find ?url (max ?date) + :in $ + :where + [?page :page/url ?url] + [?page :page/visitedAt ?date]]`, + {"limit": 2, "order-by": [["_max_date", "desc"]]}); +``` \ No newline at end of file