has_searcher 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ class Search < ActiveRecord::Base
23
23
 
24
24
  def search
25
25
  klass.search do | search |
26
- search.keywords normalize_text(keywords) if search_columns.delete("keywords")
26
+ search.keywords keywords if search_columns.delete("keywords")
27
27
  search_columns.each do | column |
28
28
  if column_for_attribute(column).type == :text
29
29
  search.keywords normalize(column), :fields => column
@@ -51,14 +51,14 @@ class Search < ActiveRecord::Base
51
51
  elsif column_for_attribute(column).type == :integer
52
52
  self[column].try(:zero?) ? nil : self[column]
53
53
  elsif column_for_attribute(column).type == :text && column == "term"
54
- normalize_text(self[column])
54
+ normalize_term(self[column])
55
55
  else
56
56
  self[column]
57
57
  end
58
58
  end
59
59
 
60
- def normalize_text(text)
61
- text.gsub /-/, ' ' if text
60
+ def normalize_term(text)
61
+ text.gsub /([^[:alnum:]+])/, ' ' if text
62
62
  end
63
63
 
64
64
  def klass
@@ -1,3 +1,3 @@
1
1
  module HasSearcher
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dmitry Lihachev
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-18 00:00:00 +07:00
17
+ date: 2011-04-20 00:00:00 +07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20