has_searcher 0.0.4.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/app/models/search.rb +4 -4
- data/lib/has_searcher/version.rb +1 -1
- metadata +3 -4
data/lib/app/models/search.rb
CHANGED
@@ -44,20 +44,20 @@ class Search < ActiveRecord::Base
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def normalize(column)
|
47
|
-
if
|
47
|
+
if respond_to?("normalize_#{column}")
|
48
48
|
send "normalize_#{column}"
|
49
49
|
elsif self.class.serialized_attributes[column] == Array
|
50
50
|
[*self.send("#{column}_before_type_cast")].select(&:present?)
|
51
51
|
elsif column_for_attribute(column).type == :integer
|
52
52
|
self[column].try(:zero?) ? nil : self[column]
|
53
|
-
elsif column_for_attribute(column).type == :text && column
|
54
|
-
|
53
|
+
elsif column_for_attribute(column).type == :text && column =~ /term$/
|
54
|
+
normalize_term_column(self[column])
|
55
55
|
else
|
56
56
|
self[column]
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
60
|
+
def normalize_term_column(text)
|
61
61
|
text.gsub(/[^[:alnum:]]+/, ' ') if text
|
62
62
|
end
|
63
63
|
|
data/lib/has_searcher/version.rb
CHANGED
metadata
CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.0.4.1
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Dmitry Lihachev
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-04-
|
17
|
+
date: 2011-04-21 00:00:00 +07:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|