open:xtdb-rules

rules

(xt/query-list xtdb
'{:find  [(pull b [*])]
  :in    [[word ...]]
  :where [[b :label :book/book]
          (or (title-include? b word)
              (author-name-include? b word))]
  :rules [[(title-include? book word)
           [b :title title]
           (or [(str/includes? title word)]
               [(str/includes? (str/lower-case title) word)])]
          [(author-name-include? book word)
           [ba :label :book/book-author]
           [ba :author-id a]
           [ba :book-id b]
           [a :name name]
           (or [(str/includes? name word)]
               [(str/includes? (str/lower-case name) word)])]]}
words)


  • open/xtdb-rules.txt
  • 마지막으로 수정됨: 2023/04/30 11:56
  • 저자 MORO