Kouhei Sutou
null+****@clear*****
Sat May 24 19:02:03 JST 2014
Kouhei Sutou 2014-05-24 19:02:03 +0900 (Sat, 24 May 2014) New Revision: b4865b2dbaca270772717b9836278434e8ba512a https://github.com/groonga/heroku-buildpack-rroonga/commit/b4865b2dbaca270772717b9836278434e8ba512a Message: Add README It is not implemented yet! Added files: README.md Added: README.md (+62 -0) 100644 =================================================================== --- /dev/null +++ README.md 2014-05-24 19:02:03 +0900 (876e602) @@ -0,0 +1,62 @@ +# Heroku buildpack: Rroonga + +This is a Heroku buildpack of [Rroonga](http://ranguba.org/#about-rroonga). + +## Usage: + + heroku create --buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/rroonga.tgz + +Add `rroonga` entry to your `Gemfile`: + + gem "rroonga" + +Create `groonga/init.rb` that initialize your Groonga database. You can refer your Groonga database path by `ENV["GROONGA_DATABASE_PATH"]`. + +Here is a sample `groonga/init.rb`: + +```ruby +require "groonga" + +Groonga::Database.open(ENV["GROONGA_DATABASE_PATH"]) + +# Define schema +Groonga::Schema.define do |schema| + schema.create_table("Sites", + :type => :hash, + :key_type => :short_text) do |table| + table.short_text("title") + table.text("description") + end +end + +# Add data +sites = Groonga["Sites"] +sites.add("http://www.ruby-lang.org/", + :title => "Ruby Programming Language", + :description => "The official Web site of Ruby.") +sites.add("http://groonga.org/", + :title => "Groonga - An open-source fulltext search engine and column store", + :description => "The official Web site of Groonga.") + +# Create indexes. We can use offline index construction by creating indexes +# after we add data. Offline index construction is 10 times faster rather +# than online index construction. +# +# See also: +# * Online index construction: http://groonga.org/docs/reference/indexing.html#online-index-construction +# * Offline index construction: http://groonga.org/docs/reference/indexing.html#offline-index-construction +Groonga::Schema.define do |schema| + schema.create_table("Terms", + :type => :patricia_trie, + :key_type => :short_text, + :normalizer => "NormalizerAuto", + :default_tokenizer => "TokenBigram") do |table| + table.index("Sites.title") + table.index("Sites.description") + end +end +``` + +Then push them to Heroku. + + git push heroku master -------------- next part -------------- HTML����������������������������...下載