groonga / gcs

Groonga CloudSearch is an open source implementation of Amazon CloudSearch.
http://gcs.groonga.org/
MIT License
25 stars 1 forks source link

Search and try client libraries for the Amazon CloudSearch #61

Open piroor opened 12 years ago

piroor commented 12 years ago

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.

darashi commented 12 years ago

Try https://github.com/spokesoftware/aws_cloud_search

darashi commented 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
darashi commented 12 years ago

For rails users, Tinia may be better? https://github.com/dlangevin/tinia

(Tinia wraps aws_cloud_search)

darashi commented 12 years ago

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

darashi commented 12 years ago

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)
darashi commented 12 years ago

"a Ruby wrapper for AWS CloudSearch." https://github.com/duwanis/asari

darashi commented 12 years ago

Asari also does not support the configuration API at this time. Docs api and Search API only.

piroor commented 12 years ago

Sample client implemented in Python https://gist.github.com/2367039