[Groonga-commit] droonga/presentation-trbmeetup-droonga at 638319e [master] Use larger spaces for code to use larger font

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Feb 9 11:07:20 JST 2015


Kouhei Sutou	2015-02-09 11:07:20 +0900 (Mon, 09 Feb 2015)

  New Revision: 638319e7ef8e71b1f400e4960b153c18543c69aa
  https://github.com/droonga/presentation-trbmeetup-droonga/commit/638319e7ef8e71b1f400e4960b153c18543c69aa

  Message:
    Use larger spaces for code to use larger font

  Modified files:
    fast-fulltext-search-in-ruby-groonga-rroonga-droonga.md

  Modified: fast-fulltext-search-in-ruby-groonga-rroonga-droonga.md (+30 -30)
===================================================================
--- fast-fulltext-search-in-ruby-groonga-rroonga-droonga.md    2015-02-09 10:54:39 +0900 (da6600b)
+++ fast-fulltext-search-in-ruby-groonga-rroonga-droonga.md    2015-02-09 11:07:20 +0900 (9bbc176)
@@ -105,8 +105,12 @@ Major ways
 
 # Sunspot?
 
-A client library of *Solr* for
-Ruby and Rails (ActiveRecord)
+A client library of
+*Solr*
+for Ruby and Rails
+(ActiveRecord)
+
+# Sunspot: Usage
 
 ~~~
 class Post < ActiveRecord::Base
@@ -230,7 +234,7 @@ libgroonga
 
 ![](images/application-with-groonga-rroonga.png){:relative_width="80"}
 
-# Usage of Rroonga
+# Usage: Install
 
 ~~~
 % sudo gem install rroonga
@@ -238,37 +242,39 @@ libgroonga
 
 Groonga (libgroonga) is also installed as a part of the package.
 
-# Usage of Rroonga
-
-Schema definition
+# Usage: Prepare
 
 ~~~
 require "groonga"
 
 Groonga::Database.create(path: "/tmp/bookmark.db")
-Groonga::Schema.create_table("Items",
-                             type:     :hash,
-                             key_type: "ShortText") do |table|
-  table.text("title")
-end
-Groonga::Schema.create_table("Terms",
-                             type:              :patricia_trie,
-                             normalizer:        :NormalizerAuto,
-                             default_tokenizer: "TokenBigram") do |table|
- table.index("Items.title")
-end
+# Or
+Groonga::Database.open("/tmp/bookmark.db")
 ~~~
 {: lang="ruby"}
 
-# Usage of Rroonga
-
-Data loading
+# Usage: Schema
 
 ~~~
-require "groonga"
+Groonga::Schema.create do |schema|
+  schema.create_table("Items",
+                      type:     :hash,
+                      key_type: "ShortText") do |table|
+    table.text("title")
+  end
+  schema.create_table("Terms",
+                      type:              :patricia_trie,
+                      normalizer:        "NormalizerAuto",
+                      default_tokenizer: "TokenBigram") do |table|
+   table.index("Items.title")
+  end
+end
+~~~
+{: lang="ruby"}
 
-Groonga::Database.open("/tmp/bookmark.db")
+# Usage: Data loading
 
+~~~
 items = Groonga["Items"]
 items.add("http://en.wikipedia.org/wiki/Ruby",
           title: "Wikipedia")
@@ -277,15 +283,9 @@ items.add("http://www.ruby-lang.org/",
 ~~~
 {: lang="ruby"}
 
-# Usage of Rroonga
-
-Fulltext search
+# Usage: Fulltext search
 
 ~~~
-require "groonga"
-
-Groonga::Database.open("/tmp/bookmark.db")
-
 items = Groonga["Items"]
 ruby_items = items.select do |record|
   record.title =~ "Ruby"
@@ -300,7 +300,7 @@ end
  * Limited features,
    but easy to use
 
-# FYI: GrnMini
+# FYI: GrnMini: Code
 
 ~~~
 require "grn_mini"
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index