Skip to content

Instantly share code, notes, and snippets.

@zacclark
Created February 24, 2011 01:07
Show Gist options
  • Save zacclark/841549 to your computer and use it in GitHub Desktop.
Save zacclark/841549 to your computer and use it in GitHub Desktop.
stacking_search = params[:search_modifier]
if stacking_search
original = session[:last_query]
fresh = query
join = "AND"
join = "OR" if params[:search_modifier] == "expand"
query = ["( #{original.shift} ) #{join} ( #{fresh.shift} )"] + (original + fresh)
# this is a useful spot for a debugger if we need to inspect the joined query
# debugger
end
session[:last_query] = query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment