cloud - finishes search implementation

This commit is contained in:
Bryce
2023-05-18 21:05:48 -07:00
parent 0e6a5c6749
commit cf34b4af7e
13 changed files with 1901 additions and 158 deletions

View File

@@ -24,7 +24,8 @@
[iol-ion.tx :refer [random-tempid]]
[mount.core :as mount]
[unilog.context :as lc]
[yang.scheduler :as scheduler])
[yang.scheduler :as scheduler]
[auto-ap.solr :as solr])
(:import
(java.util UUID)
(org.apache.commons.codec.binary Base64)))
@@ -156,7 +157,15 @@
result (audit-transact [[:upsert-entity updated-entity]] (:id context))]
(when (:square_auth_token edit_client)
(square/upsert-locations (-> result :tempids (get id) (or id) d-clients/get-by-id)))
(-> (-> result :tempids (get id) (or id) d-clients/get-by-id)
(let [updated-client (-> result :tempids (get id) (or id) d-clients/get-by-id)]
(solr/index-documents-raw solr/impl "clients"
[{"id" (:db/id updated-client)
"name" (conj (or (:client/matches updated-client) [])
(:client/name updated-client))
"code" (:client/code updated-client)
"exact" (map str/upper-case (conj (or (:client/matches updated-client) [])
(:client/name updated-client)))}])
(-> updated-client
(update :client/bank-accounts
(fn [bas]
@@ -165,11 +174,11 @@
(fn [lms]
(mapcat (fn [lm]
(map (fn [m]
{:location-match/match m
:location-match/location (:location-match/location lm)})
(:location-match/matches lm)))
{:location-match/match m
:location-match/location (:location-match/location lm)})
(:location-match/matches lm)))
lms)))
->graphql)))
->graphql))))
(defn refresh-all-current-balance []
@@ -629,8 +638,3 @@
:input-objects input-objects
:enums enums})
(attach-tracing-resolvers resolvers)))
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(mount/defstate indexer
:start (scheduler/every (* 5 60 1000) (heartbeat d-clients/rebuild-search-index "rebuild-search-index"))
:stop (scheduler/stop indexer))