Open piroor opened 12 years ago
Search worked with the following code:
#!/usr/bin/env ruby
require 'aws_cloud_search'
module AWSCloudSearch
def self.search_url(domain, region="us-east-1")
"http://search-#{domain}.#{region}.127.0.0.1.xip.io:7575"
end
def self.document_url(domain, region="us-east-1")
"http://doc-#{domain}.#{region}.127.0.0.1.xip.io:7575"
end
def self.configuration_url
"https://cloudsearch.us-east-1.127.0.0.1.xip.io:7575"
end
end
cloud_search = AWSCloudSearch::CloudSearch.new('example-00000000000000000000000000')
search_request = AWSCloudSearch::SearchRequest.new
search_request.q = "tokyo"
search_response = cloud_search.search(search_request)
puts "%d found" % search_response.found
search_response.hits.each do |hit|
p hit
end
For rails users, Tinia may be better? https://github.com/dlangevin/tinia
(Tinia wraps aws_cloud_search)
As Tinia uses "bq" parameter for querying, GCS couldn't work with it at this time.
See https://github.com/dlangevin/tinia/blob/master/lib/tinia/search.rb#L74-88
With aws_cloud_search, documents can be added something like this:
batch = AWSCloudSearch::DocumentBatch.new
doc = AWSCloudSearch::Document.new(true)
doc.id = 'id11'
doc.add_field :name, 'Snowy Snowy'
doc.add_field :address, 'Sapporo, Hokkaido, Japan'
batch.add_document doc
cloud_search.documents_batch(batch)
"a Ruby wrapper for AWS CloudSearch." https://github.com/duwanis/asari
Asari also does not support the configuration API at this time. Docs api and Search API only.
Sample client implemented in Python https://gist.github.com/2367039
There are some client libraries for the AmazonCloudSearch, on the Web. We have to test our Groonga CloudSearch's compatible APIs with various type clients.