特定のクエリに対してsolrの応答を取得しようとしています。localhost:8983 で solr クエリ インターフェイスを確認しましたが、正常に動作しており、クエリに対して必要な応答が返されています。各応答から productId フィールドを選択して出力したいと思います。以下は私が使用しているコードです:
#!/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
しかし、何も出力されません。私の応答は空のようです。どうすればこれを修正できますか