I am using IndexTank and the Tanker gem to implement full text search on my Rails application, but I get an error (URI::InvalidURIError bad URI(is not URI?)) when trying to use the search_tank method on my index.
This is the controller method where I get the error
def search
if params[:query]
@posts = Post.search_tank(params[:query], :page => 1, :per_page => 10)
else
@posts = []
end
end
This is the part of my Post model where I define the index
if ENV['RAILS_ENV'] === "production"
index = 'idx'
else
index = 'test'
end
tankit index do
indexes :title
indexes :description
end
# define the callbacks to update or delete the index
after_save :update_tank_indexes
after_destroy :delete_tank_indexes
The search_tank method works when I test it in the rails console. Other posts seem to suggest that this might be related to the routes set in config/routes.rb. All I have set is this.
root :to => 'public#index'
match ':controller(/:action(/:id))(.:format)'
I have searched around for an answer but I am a bit stumped. Any help would be greatly appreciated.
That's a URI.parse exception, it means some url is incorrectly specified or generated. Are you sure you set up the config correctly? From the readme at https://github.com/kidpollo/tanker you need to do:
If you've already done that, please double check the urls for typos.