Sha256: d3af26db58e18d0dde1c016473ed7f9c1707195f4fde87c8de984ccc907e60c8
Contents?: true
Size: 483 Bytes
Versions: 2
Compression:
Stored size: 483 Bytes
Contents
require 'net/http' require 'uri' require 'cgi' module Solrium module Remote extend self def query(q, params={}, port=8000) params['q'] = q params['wt'] = 'ruby' url = URI.parse("http://localhost:#{port}") res = Net::HTTP.start(url.host, url.port) do |http| http.get("/solr/select?" + params.map { |k,v| "#{k}=#{CGI.escape(v)}" }.join("&")) end res.value eval(res.body) end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
jberkel-solrium-0.1.0 | lib/remote.rb |
solrium-0.1.0 | lib/remote.rb |