In order for engage to track the site search, a pageview has to be made (GET request) that includes the q={QUERY} string parameter. Other methods of search, including javascript based requests that do not cause a page refresh and simply update the page and/or url, will not work.
That would depend on the logic of the javascript! Is the javascript actively fetching a valid page, or is it only making an XHR request to an API endpoint to fetch the data? If you could share me some more details on your search implemenation, it would make it easier to determine why it is or isn’t working.