fulltext_searchable 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS `#{::FulltextSearchable::TABLE_NAME}` (
13
13
  #{"`_score` FLOAT," unless mroonga_match_against?}
14
14
  PRIMARY KEY(`key`),
15
15
  #{"UNIQUE " if mroonga_unique_hash_index_safe?}INDEX(`_id`) USING HASH,
16
- FULLTEXT INDEX (`text`)
16
+ FULLTEXT INDEX (`text`) COMMENT 'parser "TokenBigramSplitSymbolAlpha"'
17
17
  ) ENGINE = #{mroonga_storage_engine_name} COLLATE utf8_unicode_ci;
18
18
  SQL
19
19
  )
@@ -53,7 +53,7 @@ SQL
53
53
  safe = true
54
54
  begin
55
55
  execute("TRUNCATE TABLE `#{temporary_table_name}`;")
56
- rescue
56
+ rescue
57
57
  safe = false
58
58
  end
59
59
  drop_table temporary_table_name
@@ -1,3 +1,3 @@
1
1
  module FulltextSearchable
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -31,8 +31,9 @@ describe FulltextIndex do
31
31
  FactoryGirl.create(:soneki)
32
32
  FactoryGirl.create(:eigyo)
33
33
  FactoryGirl.create(:rieki)
34
- @taro = FactoryGirl.create(:taro)
35
- @jiro = FactoryGirl.create(:jiro)
34
+ @taro = FactoryGirl.create(:taro)
35
+ @jiro = FactoryGirl.create(:jiro)
36
+ @hanako = FactoryGirl.create(:hanako, :name => 'hanako')
36
37
  end
37
38
  it "should fulltext searchable with '営業'" do
38
39
  FulltextIndex.match('営業').items.count.should == 4
@@ -74,7 +75,7 @@ describe FulltextIndex do
74
75
  FulltextIndex.match('天気', :with => [@taro, @jiro], :model => Blog).items.count.should == 3
75
76
  FulltextIndex.match('天気', :with => [@taro, @jiro], :model => [Blog, User]).items.count.should == 5
76
77
  end
77
-
78
+
78
79
  it "should not break with ActiveRecord's eager loading behavior" do
79
80
  expect{ FulltextIndex.match('ab.').items }.not_to raise_error
80
81
  end
@@ -97,6 +98,12 @@ describe FulltextIndex do
97
98
  FulltextIndex.match('++太郎', :model => User).items.count.should == 1
98
99
  FulltextIndex.match(['+太郎'], :model => User).items.count.should == 1
99
100
  end
101
+
102
+ it "should fulltext searchable with one character of alphabet" do
103
+ FulltextIndex.match('h').items.count.should == 1
104
+ FulltextIndex.match('h', :model => User).items.count.should == 1
105
+ FulltextIndex.match('h', :model => User, :with => @hanako).items.count.should == 1
106
+ end
100
107
  end
101
108
 
102
109
  context "optimization" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fulltext_searchable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-08 00:00:00.000000000 Z
12
+ date: 2013-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -298,7 +298,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
298
  version: '0'
299
299
  segments:
300
300
  - 0
301
- hash: -3155726735639838905
301
+ hash: 941900058642749927
302
302
  required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  none: false
304
304
  requirements:
@@ -307,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
307
  version: '0'
308
308
  segments:
309
309
  - 0
310
- hash: -3155726735639838905
310
+ hash: 941900058642749927
311
311
  requirements: []
312
312
  rubyforge_project:
313
313
  rubygems_version: 1.8.25