In my web application, the whole search page is written in XQuery. The query does not just find and display the results, but also writes the search term into a protocol file (in eXist db, this is possible with the file:serialize
-function).
However, it might happen that writing the protocol takes some time. And of course, the user should not be affected by this delay. So, I'd like to first output the search results and then update the protocol.
I've tried to put the protocol function after the return of the content like:
return $search_results,localfunction:write_protocol()
(The function localfunction:write_protocol()
always returns the empty sequence ()
.)
But that doesn't work. The content of $search_results
is only output, once localfunction:write_protocol()
is finished.
Is there anything I can do here? (I know, such things are problematic also in more processual languages like PHP.)