Thanks again for the comments, which showed me the way to solve my own problem.
The function get_queried_object() seems to work when called in archive.php itself, but not when called from a function defined in another file - even if that other function is called in archive.php. That realization led me to do some updates:
a) in archive.php: retrieving the get_queried_object(), storing its id into a hidden field (e.g. "archive_id)";
b) the Ajax "autocomplete" call in its script: sending the object id as another argument (value retrieved using jQuery - e.g. "$('#archive_id').val()");
c) the function ajax_search_archive in functions.php: retrieving the object id from the POST request.