The results page has a 'search within results' textbox. Search text entered there is combined with the initial search to create a brand new query.
The initial search form is serialized to a cookie, or, if the user came to the results via a GET request (canned query), the query string is parsed.
The script in action
The method which serializes a search form looks like this. Four lines: nice and neat.
The method that handles the 'search within results' on the results page goes like this. It's a little longer to handle cookie/no-cookie, but still pretty easy to follow.
As with all our Webpublisher scripts, this one is released under an open source MIT license. No documentation. The mootools framework is included in the file.
Download the beta: AndornotUtilities_Subquery_0_2.js
I appreciate any feedback, bug reports, etc. We can also assist with implementation if required; contact us at: email@example.com.