0

Is it possible to send a request to Solr using a Ruby variable?

require 'rubygems'
require 'rsolr'

solr = RSolr.connect :url => 'http://solrserver.com'
response = rsolr.get 'select', :params => {:q => "prefName:#{params[:query]}"}

This code will generate a Bad Request error because the Ruby variable is ignored

RSolr::Error::Http - 400 Bad Request
Error: 'org.apache.solr.search.SyntaxError: Cannot parse \'prefName:\': Encountered "<EOF>" at line 1, column 9.
s0rin
  • 127
  • 1
  • 9

0 Answers0