If a URL like
path/to/page#this-location?q=word is used the
q parameter is ignored. If a URL like
path/to/page#this-location&?q=word is used then the query is added to the site search results. The expectation is that any URL with a valid search parameter will work.
It seems Matomo concatenates the querystring and the fragment with an
&and then tries to parse the whole string as querystring
On some systems it is not possible to modify the URL to append an
& so the site search report does not record these queries.