[Groonga-commit] ranguba/rroonga at aa755c7 [master] Groonga::Schema#create_lexicon: add a convenient method

Back to archive index

Kouhei Sutou null+****@clear*****
Wed May 23 14:22:21 JST 2018


Kouhei Sutou	2018-05-23 14:22:21 +0900 (Wed, 23 May 2018)

  New Revision: aa755c7ed38ab95dda457049ef5f143a2f40a317
  https://github.com/ranguba/rroonga/commit/aa755c7ed38ab95dda457049ef5f143a2f40a317

  Message:
    Groonga::Schema#create_lexicon: add a convenient method

  Modified files:
    lib/groonga/schema.rb

  Modified: lib/groonga/schema.rb (+13 -0)
===================================================================
--- lib/groonga/schema.rb    2018-01-30 16:12:05 +0900 (dd113c0b)
+++ lib/groonga/schema.rb    2018-05-23 14:22:21 +0900 (fff02ad0)
@@ -672,6 +672,19 @@ module Groonga
       @definitions << definition
     end
 
+    def create_lexicon(name,
+                       use_case: :full_text_search,
+                       **options, &block)
+      case use_case
+      when :full_text_search
+        options[:type] ||= :patricia_trie
+        options[:key_type] ||= :short_text
+        options[:default_tokenizer] ||= "TokenBigram"
+        options[:normalizer] ||= "NormalizerAuto"
+      end
+      create_table(name, options, &block)
+    end
+
     # 名前が _name_ のテーブルを削除する。
     #
     # テーブルの削除は# {define} を呼び出すまでは実行されないこ
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180523/44438d5e/attachment.htm 



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