Ruby Client API
Like JavaScript and SolrJ, Ruby can also connect with Solr using the Solr API and performs various operations such as search, indexing, and removal over the HTTP protocol. Solr also provides sufficient API support for the Ruby programming language. So, the application that builds on a Ruby platform can also take advantage of Solr. Solr reverts a query response in Ruby format, which can be interpreted easily in Ruby programming.
For Ruby applications, to communicate with Solr, rsolr
is an extensive library. It provides all the functionalities needed to meet your expectations. To install the rsolr
dependency, please refer to http://www.rubydoc.info/gems/rsolr. To install rsolr
, use this command:
gem install rsolr
Now let's search using rsolr
for the query q=ipod
:
require 'rsolr' solr = RSolr.connect :url => 'http://localhost:8983/solr/techproducts' response = solr.get 'select', :params => {:q => 'ipod',:fl=>'id,name',:wt=>:ruby} puts response
Response:
{"responseHeader...