Skip to content

Commit

Permalink
more fixes for issue #1114
Browse files Browse the repository at this point in the history
I think this fixes the bug on getting related, cited and references.
  • Loading branch information
jkitchin committed May 9, 2024
1 parent 010cbd1 commit 5a705df
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions openalex.el
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,16 @@ If FILTER is non-nil it should be a string like \"filter=openalex:\"
https://docs.openalex.org/api-entities/works"

(let* ((url (concat "https://api.openalex.org/works/" entity-id))
(let* ((url (concat "https://api.openalex.org/works"
;; This is hackier than I prefer, but sometimes entity-id
;; is nil, or starts with ? for a filter, and I couldn't
;; see a cleaner way to solve this. this function is used
;; in a lot of places.
(cond
((string-prefix-p "?" entity-id)
entity-id)
(t
(format "/%s" entity-id)))))
(req (request url :sync t :parser 'oa--response-parser
:params `(("mailto" . ,user-mail-address)
("api_key" . ,oa-api-key)
Expand Down Expand Up @@ -454,8 +463,7 @@ elisp:org-columns elisp:org-columns-quit
;; split is what we process now
(setq entries (append entries
(oa--works-entries
(oa--work (s-join "|" (nth 0 split))
"filter=openalex:")))))
(oa--work (format "?filter=openalex:%s" (s-join "|" (nth 0 split))))))))

(oa--works-buffer
"*OpenAlex - Related works*"
Expand Down Expand Up @@ -498,8 +506,8 @@ Found ${nentries} results.
;; split is what we process now
(setq entries (append entries
(oa--works-entries
(oa--work (s-join "|" (nth 0 split))
"filter=openalex:")))))
(oa--work (format "?filter=openalex:%s"
(s-join "|" (nth 0 split))))))))
(oa--works-buffer
"*OpenAlex - References*"
(format "* OpenAlex - References from %s ([[%s][json]])
Expand Down

0 comments on commit 5a705df

Please sign in to comment.