I'm trying to add the sunspot_rails gem to my Rails Mountable Engine, so I can use Solr to do full text searches. Like it states in the README file I've added this to my Gemfile:
gem "sunspot_rails"
gem "sunspot_solr"
Then I run rails g sunspot_rails:install
which creates sunspot.yml
in the config
folder of my Rails Engine. To start sunspot I need to run:
bundle exec rake sunspot:solr:start
But that doesn't work, and gives me the following error message:
rake aborted!
Don't know how to build task 'sunspot:solr:start'
It seems that it doesn't load the Sunspot/Solr rake tasks, and so it can't find them. I've had other issues with the Rails engine not loading files that would load automatically in a normal Rails 3 application. I suspect something along that line is going on here as well. I checked the lib/tasks
folder, and there is only one file in there: my_app.rake
. In that file there are only a few commented lines of code:
# desc "Explaining what the task does"
# task :my_app do
# # Task goes here
# end
I think I would maybe need to add the raketasks manually, and load them from my_app.rake
. However, I can't find any information on how to do this, and I maybe I'm completely wrong in the first place. Hopefully someone on stackoverflow has experience with this.
In any case, thank you very much for any help in advance!