Skip to content

Instantly share code, notes, and snippets.

@benzheren
Created August 25, 2011 02:58
Show Gist options
  • Save benzheren/1169884 to your computer and use it in GitHub Desktop.
Save benzheren/1169884 to your computer and use it in GitHub Desktop.
A Rails Controller uses Tire to interface with ElasticSearch.
class SearchController < ApplicationController
def ajax
q = request.GET[:q]
@s = Tire.search(sha1 current_user.email) do
query do
string q
end
highlight :text, :options => { :tag => '<strong class="highlight">' }
end
puts @s.to_curl
render :json => @s.results, :layout => false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment