Reputation: 7280
I'm trying to obtain response of solr for a given query. I've checked the solr query interface on localhost:8983 and its working fine, giving the required response to the queries. I want to select the productId field from each response and print it. Following is the code I'm using:
#!/usr/bin/ruby
# encoding: utf-8
require 'rubygems'
require 'solr'
solr = Solr::Connection.new('http://localhost:8983/solr')
response = solr.query('necklace')
puts "the response is:"
#puts response
puts "\n"
response.each do |hit|
puts hit['productId']
end
But it does not print anything, my response seems to be empty. How can I fix this
Upvotes: 1
Views: 488