Hilighting referring search engine text in web pages

On some random blog I arrived on via a search engine,
I noticed that the page had hilighted all the words
that were part of my query. This is awesome.

I wonder if this functionality could be added as a post-processing
step for all web pages before they are sent to the user.
(an Apache module?) The logic could be quite simple:

  if( http_referer_exists &&
      http_referer_is_search_engine ) {
    query = get_query_from_referer()
    foreach word in query {
     response =~ s/word/<div name=hilite>word</div>/g;
    }
  }

Hashes vs. PowerSets

Reminder to self:
Think more about fun comparisons of hashes
(allows decomposing of problems by N) and power sets (causes problems
to increase in complexity by 2^N)

The former is the standard technique I’ve used to make hard problems easy
or fast: divide-and-conquer. The latter is a a natural result that for any body of N nodes, full connectivity goes as 2^N: applicable in social networks, etc.

Sounds lke hashing fails to decompose power-set problems.
Can we use power-sets to decompose?