install sphinxsearch
sudo apt-get install sphinxsearch
install thinking sphinx
sudo add-apt-repository ppa:dhuggins/cmusphinx
sudo apt-get update
sudo apt-get install sphinxsearch
add required gems
gem 'mysql2'
gem 'thinking-sphinx'
install
bundle install
create a file under app/indices/ called
add the following
ThinkingSphinx::Index.define :article, :with => :active_record do
# fields
indexes title, :sortable => true
indexes content
# attributes
has created_at, updated_at
end
After that you can test your searches in rails console
example search
Article.search params[:search]
@articles = Article.search Riddle::Query.escape(params[:search])
Links:
http://pat.github.io/thinking-sphinx/
http://blog.app2technologies.com/basic-thinking-sphinx-setup-in-rails-3.1-or-newer-on-ubuntu-12.04/
No comments:
Post a Comment