Use one Sunspot Solr instance for two Rails apps

41 views
Skip to first unread message

byaku...@gmail.com

unread,
Feb 25, 2015, 6:32:19 PM2/25/15
to ruby-s...@googlegroups.com
I've asked this question on Stackoverflow already but I'll ask it again here in case there's a larger following.

I have a VPS set up with several Rails apps, two of which are using Sunspot Solr. However, Solr is returning irrelevant results for a given search, and I believe the problem boils down to not having separated Sunspot/Solr to handle two Rails apps.

I have this in one app:

class Article < ActiveRecord::Base
  searchable
do
    text
:title, :boost => 2.0
    text
:body do
      strip_tags
(body)
   
end
  time
:created_at
 
end
end

and this in the other:
class Article < ActiveRecord::Base
  searchable
do
    text
:title, :body
 
end
end

My sunspot.yml files are basically identical:

production: solr: hostname: localhost port: 8983 log_level: WARNING path: /solr/default solr_home: solr development: solr: hostname: localhost port: 8982 log_level: INFO path: /solr/development test: solr: hostname: localhost port: 8981 log_level: WARNING path: /solr/test

Is there a way to have 1 Solr instance index and deliver results for 2 Rails apps? I haven't found much documentation on this so am a bit confused as to how to do this.

Any help is much appreciated. Thanks!


Reply all
Reply to author
Forward
0 new messages