The lei-q interface I'm working on for piem [1] consumes JSON output to display search results. From there, an individual message can be shown. If the query is against a remote external, that involves two curl calls to the remote, one for the search and one for the display.
I'd like to import hits from the first step into the local store so that I can avoid the second curl call. However, I haven't been able to figure out a way to do this when requesting JSON output. For example [2], say I don't have meta's [email protected] locally: $ lei daemon-kill $ export HOME=$(mktemp -d "${TMPDIR:-/tmp}"/pi-testing-XXXXXXX) $ lei q m:[email protected] # /tmp/pi-testing-3JaSz2K/.config/lei/config created [null] If I search for that message against https://public-inbox.org/meta/ and request JSON output $ lei q -I https://public-inbox.org/meta/ -f ldjson \ m:[email protected] # /usr/bin/curl -Sf -s -d '' https://public-inbox.org/meta/?x=m&q=m%3A20211124154539.350522-1-e%4080x24.org {"blob":"a8754283bd9e985d6e1156215071be59aa2b5a53",...} then no message ends up in the local store: $ lei q m:[email protected] [null] In contrast, if I request mboxrd output $ lei q -I https://public-inbox.org/meta/ -f mboxrd \ m:[email protected] >/dev/null # /usr/bin/curl -Sf -s -d '' https://public-inbox.org/meta/?x=m&q=m%3A20211124154539.350522-1-e%4080x24.org the message is imported to the local store: $ lei q -f ldjson m:[email protected] {"blob":"a8754283bd9e985d6e1156215071be59aa2b5a53",...} $ git -C $HOME/.local/share/lei/store/local/0.git/ log --oneline ca12a1b (HEAD -> master) [PATCH] eliminate some unused subs I was hoping that --import-remote might do the trick, but that doesn't seem to be the case: $ lei daemon-kill $ export HOME=$(mktemp -d "${TMPDIR:-/tmp}"/pi-testing-XXXXXXX) $ lei q --import-remote -I https://public-inbox.org/meta/ \ -f ldjson m:[email protected] # /tmp/pi-testing-Ny7KDcB/.config/lei/config created # /usr/bin/curl -Sf -s -d '' https://public-inbox.org/meta/?x=m&q=m%3A20211124154539.350522-1-e%4080x24.org {"blob":"a8754283bd9e985d6e1156215071be59aa2b5a53",...} $ lei q m:[email protected] [null] Should --import-remote trigger an import in the case above? [1] https://git.kyleam.com/piem/tree/piem-lei.el [2] These are with public-inbox's current master (07cd8973baf).
