Makes A&J Produce findable.
This commit is contained in:
@@ -34,3 +34,42 @@
|
||||
{:body (take 10 valid-clients)}))
|
||||
|
||||
(def search (wrap-json-response search))
|
||||
|
||||
#_(comment
|
||||
(count (let [valid-ids (->> (dc/q '[:find ?v
|
||||
:in $
|
||||
:where [?v :vendor/name]]
|
||||
(dc/db conn))
|
||||
(map first)
|
||||
(into #{}))]
|
||||
(for [v (solr/query solr/impl "vendors"
|
||||
{"query" "*"
|
||||
"limit" 10000})
|
||||
:when (not (valid-ids (Long/parseLong (:id v))))]
|
||||
v)))
|
||||
|
||||
(let [name-like-ids (when (not-empty "A&J")
|
||||
(map (comp (juxt identity #(Long/parseLong %)) :id)
|
||||
(solr/query solr/impl "vendors"
|
||||
{"query" (cond-> (format "name:(%s*)" (str/upper-case "A&J"))
|
||||
(not (is-admin? identity)) (str " hidden:false"))
|
||||
"fields" "id,name"
|
||||
"limit" 300})))
|
||||
valid-clients (for [[z n] name-like-ids]
|
||||
{"value" n "internal-label" z "label" (dc/pull (dc/db conn) '[*] n)})]
|
||||
(take 5 valid-clients))
|
||||
|
||||
|
||||
(solr/query solr/impl "vendors"
|
||||
{"query" (cond-> (format "name:(%s*)" (str/upper-case (solr/escape "A&J Pr")))
|
||||
(not true) (str " hidden:false"))
|
||||
"fields" "id, name"
|
||||
"limit" 300})
|
||||
|
||||
(solr/escape "A&J")
|
||||
|
||||
(first (solr/query solr/impl "vendors"
|
||||
{"query" (cond-> (format "name:(A\\&J PRO*)")
|
||||
(not true) (str " hidden:false"))
|
||||
"fields" "id, name"
|
||||
"limit" 300})))
|
||||
Reference in New Issue
Block a user