Kouhei Sutou
kou****@clear*****
2009年 6月 30日 (火) 20:42:16 JST
須藤です。 > dara @ buzztter:~/local/src/ruby-groonga$ svn diff > Index: test/test-index-column.rb > =================================================================== > --- test/test-index-column.rb (リビジョン 410) > +++ test/test-index-column.rb (作業コピー) > @@ -54,4 +54,20 @@ > assert_equal([groonga], > content_index.search("エンジン").collect {|record| record.key}) > end > + def test_shorter_query_than_ngram > + articles = Groonga::Array.create(:name => "<articles>") > + articles.define_column("content", "<text>") > + > + terms = Groonga::Hash.create(:name => "<terms>", > + :default_tokenizer => "<token:bigram>") > + content_index = terms.define_index_column("content", articles, > + :source => "<articles>.content") > + articles.add(:content => 'l') > + articles.add(:content => 'll') > + articles.add(:content => 'hello') > + > + assert_equal(1, content_index.search("he").size) > + assert_equal(2, content_index.search("ll").size) > + assert_equal(3, content_index.search("l").size) > + end > end このテスト、PatriciaTrieに変えたりして取り込みました! ありがとうございます。 > (ちなみに ruby test/run-test.rb では以下のようなエラーも出ています) > > 1) Failure: > test_each(DatabaseTest) [./test/test-database.rb:84]: こっちも直しました。 -- 須藤 功平 <kou****@clear*****> 株式会社クリアコード (http://www.clear-code.com/)