Created
August 25, 2011 02:58
-
-
Save benzheren/1169884 to your computer and use it in GitHub Desktop.
A Rails Controller uses Tire to interface with ElasticSearch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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