It's worth mentioning that you're comparing apples and oranges. Stack Overflow uses Elasticsearch as a backend for searching. Elasticsearch uses types, and each type has a configuration which details how the properties of that type should be treated in terms of indexing and searchability, in general. When indexing, the actual object data is used, not the rendered web pages we, as users, see.
Google, on the other hand, has their own algorithm tailored for their purposes. Importantly, Google is a search engine for the entire web, so the factors they consider in terms of what makes a page "match" or not is vastly different from the considerations Stack Overflow has made in the development of their system. Also, Google employs crawlers that index fully-formed web pages and attempts to extract meaningful information from the page based on how its algorithms interpret various HTML elements.
There might be room for Stack Overflow to make some tweaks to their Elasticsearch type configurations to improve the returned results, but it will never be the same as what Google returns, simply because it's two entirely different systems with two entirely different algorithms running against a potentially different pool of data.
google.com/?q=<query>+site:stackoverflow.com