fulltext_searchable 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  FulltextSearchable
2
2
  ===
3
+ [![Code Climate](https://codeclimate.com/github/greenbell/fulltext_searchable.png)](https://codeclimate.com/github/greenbell/fulltext_searchable)
3
4
 
4
5
  This project rocks and uses MIT-LICENSE.
@@ -35,7 +35,7 @@ class FulltextIndex < ActiveRecord::Base
35
35
  def match(phrase, options={})
36
36
  options = options.symbolize_keys
37
37
  if phrase.is_a? String
38
- phrase = phrase.split(/[\s ]/)
38
+ phrase = phrase.split(/[\s ]/).reject{|word| word.blank? }
39
39
  end
40
40
 
41
41
  # モデルで絞り込む
@@ -1,3 +1,3 @@
1
1
  module FulltextSearchable
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -76,13 +76,19 @@ describe FulltextIndex do
76
76
  end
77
77
 
78
78
  it "should not break with ActiveRecord's eager loading behavior" do
79
- FulltextIndex.match('ab.').items.should_not raise_error ActiveRecord::EagerLoadPolymorphicError
79
+ expect{ FulltextIndex.match('ab.').items }.not_to raise_error
80
80
  end
81
81
 
82
82
  it "should not contain nil in items" do
83
83
  Blog.delete_all :id => @jiro.blogs.map(&:id)
84
84
  FulltextIndex.match('天気').items.should_not include(nil)
85
85
  end
86
+
87
+ it "should not break when keywords with redundant speces are passed" do
88
+ FulltextIndex.match(' 営業 状態').items.count.should == 2
89
+ FulltextIndex.match('営業 状態').items.count.should == 2
90
+ FulltextIndex.match(" 営業\t状態 ").items.count.should == 2
91
+ end
86
92
  end
87
93
 
88
94
  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.1
4
+ version: 0.1.2
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-06-14 00:00:00.000000000 Z
12
+ date: 2013-07-10 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: 2065254535944603589
301
+ hash: -4346424986118501563
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: 2065254535944603589
310
+ hash: -4346424986118501563
311
311
  requirements: []
312
312
  rubyforge_project:
313
313
  rubygems_version: 1.8.25