This file contains hidden or 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
#!/usr/bin/env /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby | |
CODES = { | |
'400' => 'Bad Request', | |
'401' => 'Unauthorized', | |
'403' => 'Forbidden', | |
'404' => 'Not Found', | |
'405' => 'Method Not Allowed', | |
'406' => 'Not Acceptable', | |
'408' => 'Request Timeout', |
This file contains hidden or 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
@s = Tire.search index_path, | |
:from => 0, | |
:size => 100, | |
:query => {"text" => {"_all" => query}}, | |
:highlight => {"fields" => {"text" => {}}, | |
"pre_tags" => ["<strong class=\"highlight\">"], | |
"post_tags" => ["</strong>"]} |
This file contains hidden or 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 |