This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-22
Channels
- # aleph (5)
- # announcements (9)
- # babashka (9)
- # beginners (127)
- # cherry (1)
- # cider (48)
- # clj-kondo (5)
- # cljdoc (1)
- # clojure (70)
- # clojure-berlin (1)
- # clojure-europe (57)
- # clojure-france (2)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-norway (4)
- # clojure-uk (1)
- # clojurescript (2)
- # css (1)
- # cursive (6)
- # emacs (6)
- # gratitude (1)
- # honeysql (5)
- # introduce-yourself (5)
- # jobs-discuss (7)
- # joyride (1)
- # kaocha (3)
- # lsp (1)
- # malli (9)
- # nbb (2)
- # off-topic (91)
- # pathom (7)
- # pedestal (14)
- # re-frame (4)
- # reitit (67)
- # shadow-cljs (46)
- # spacemacs (3)
- # squint (3)
- # tools-build (14)
- # tools-deps (1)
- # vim (3)
Can I reuse the response from one query into another one in the same eql ?
In the following eql I have multiple :herb.SearchResultDocument/id
returned from the first search, I want to use the value into another search for each id, mapped as :taxonConceptId
[{'(:herb.Query/search {:input {:q "*Eucalyptus*"
:facetField ["taxonomic_status"]}})
[{:herb.SearchResult/docs [:herb.SearchResultDocument/id <-- USE THIS
:herb.SearchResultDocument/scientificName
:herb.SearchResultDocument/acceptedNameUsage
:herb.SearchResultDocument/preferredVernacularName]}]}
{'(:herb.Query/taxonConceptImages {:taxonConceptId "22ad8546-8f00-4999-9b20-e40d11229ad5" <-- HERE })
[{:herb.ImagePaginator/data [:herb.Image/previewUrl]}]}]
I can't see any example of resolved paras... I'm probably missing something, or I'm just supposed to do multiple queries. Not sure you can have “logic variables”in eql
Hi. If I am understanding your requirement correctly, you could create a resolver to alias :herb.SearchResultDocument/id as :taxonConceptId - and then resolve any dependent properties from there, when possible. So you actually only make one request, but it is satisfied by a number of different resolvers. If your backing lookup service can resolve multiple at the same time, then you could use batch resolvers to optimise the multiple fetches required.
If there is a 1:1 map between your search result document id and the taxon concept id, then you'd ideally want to flatten these resolvers at the top-level. For other requirements, you might nest the properties. I have resolvers that coordinate across multiple backend services in a single request using the results from one resolution in the processing of other requested attributes.
Your alternative is to add a resolver that can take a :herb.SearchResultDocument/id and output a :herb.Query/taxonConceptImages attribute - or you could rename and abstract the how and think in terms of the API you wish to provide to clients, and simply resolve :herb.searchResultDocument/images and then have nested attributes that make sense in that context.
Thanks for the explanation, I was using he dynamic resolver or graphql and just dropped that and wrote my own resolver that post json to a graphql endpoint.
Hi. I wouldn’t necessarily remove dynamic resolvers, but simply use the first option I mentioned and alias one attribute for another. When pathom knows it can get from your search result id to a taxon concept id and using that can get all other requested attributes, it should work.