rSolr!

Found a very good and easy article on rSolr at http://websolr.com/guides/clients-rsolr

Here are some points from the guide:

  • RSolr is a Ruby client for Solr. It is designed to be a simple, low-level wrapper that provides direct access to the Solr API.
  • rSolr can be used to connect through the url as follows:
    rsolr = RSolr.connect :url => 'the_link_to_solr'
  • add method is used to post docs to Solr. For example:
    rsolr.add([
      { :id => 'a', :name => "Something"},
      { :id => 'b', :name => "Somethign else"}
    ])
  • rSolr commit is used to commit the docs.
  • The select method sends requests to the Solr /selecthandler. It accepts a hash of parameters, which it serializes into the query string of its request. For ex:
    search = rsolr.select :params => { :q => "search_string" }
  • NOTE: The query is performed according to the query parser settings defined in solrconfig.xml and potentially your default query field specified in schema.xml.