Problem with sunspot search against sharded (multicore) Solr

178 views
Skip to first unread message

sec...@gmail.com

unread,
Apr 27, 2013, 2:01:02 PM4/27/13
to ruby-s...@googlegroups.com
Hello everybody,

       I have recently setup a multicore Solr installation to get some benefits of sharding the index (7 million documents, with lots of stored attributes, ~300GB worth of Solr data).  I had seen this post about getting Sunspot to search against this with an Id Sharding Session Proxy:


When I tried to implement as specified here, I got an error about the variable "solr" not being found, and realized that I probably need to set up Thread Local Session Proxies with configuration objects as follows:

shard_sessions = (0..3).map do |i|
    config = Sunspot::Configuration.build
    config.solr.url = "host/solr/core#{i}"
    Sunspot::SessionProxy::ThreadLocalSessionProxy.new(config)
end

base_session = Sunspot::Session.new
base_session.config.solr.url = "http://host/solr/core0"

Sunspot.session = Sunspot::SessionProxy::IdShardingSessionProxy.new(base_session, shard_sessions)

But when I call a search with this setup:

verb_search = Sunspot.search(Patent) do
      fulltext search_text do
        boost_fields :title => 2.0
        highlight :abstract
        highlight :description
        query_phrase_slop slop_factor
        minimum_match 1
      end
      paginate :page => current_page, :per_page => page_length
    end

It no longer throws errors, but the query is blanked out. From the logs:

fq=type%3APatent&start=0&rows=30&shards=host%2Fsolr%2Fcore0%2Chost%2Fsolr%2Fcore1%2Chost%2Fsolr%2Fcore2%2Chost%2Fsolr%2Fcore3&q=%2A%3A%2A
Any insight would be a huge help.  Thanks!
--Jimmy

sec...@gmail.com

unread,
Apr 27, 2013, 10:33:55 PM4/27/13
to ruby-s...@googlegroups.com, sec...@gmail.com
I finally figured out the problem, there was a problem with the block being passed around in the session proxy delegation.  I've forked the sunspot repo with a fix:


Hopefully, I'll get this cleaned up and make a pull request.  Thanks!

--Jimmy
Reply all
Reply to author
Forward
0 new messages