rifle 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rifle.rb +8 -2
- data/lib/rifle/settings.rb +5 -1
- data/lib/rifle/version.rb +1 -1
- metadata +41 -41
data/lib/rifle.rb
CHANGED
@@ -111,8 +111,14 @@ module Rifle
|
|
111
111
|
}
|
112
112
|
# Removed ignored words
|
113
113
|
words.subtract Rifle.settings.ignored_words
|
114
|
-
# Get
|
115
|
-
|
114
|
+
# Get the parts
|
115
|
+
if Rifle.settings.fuzzy_matching
|
116
|
+
# Get metaphones
|
117
|
+
::Text::Metaphone.metaphone(words.to_a.join(' ')).split(' ')
|
118
|
+
else
|
119
|
+
# Get the raw words
|
120
|
+
words.to_a
|
121
|
+
end
|
116
122
|
end
|
117
123
|
|
118
124
|
def add_urn_to_metaphone_set(urn, metaphone)
|
data/lib/rifle/settings.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Rifle
|
2
2
|
|
3
3
|
class Settings
|
4
|
-
attr_accessor :ignored_words, :ignored_keys, :min_word_length, :redis, :use_rest_server, :resque_queue
|
4
|
+
attr_accessor :ignored_words, :ignored_keys, :min_word_length, :redis, :use_rest_server, :resque_queue, :fuzzy_matching
|
5
5
|
|
6
6
|
def ignored_words
|
7
7
|
@ignored_words ||= ["the", "and", "you", "that"]
|
@@ -11,6 +11,10 @@ module Rifle
|
|
11
11
|
@ignored_keys ||= [:created_at, :updated_at]
|
12
12
|
end
|
13
13
|
|
14
|
+
def fuzzy_matching
|
15
|
+
@fuzzy_matching.nil? ? true : @fuzzy_matching
|
16
|
+
end
|
17
|
+
|
14
18
|
def min_word_length
|
15
19
|
@min_word_length ||= 3
|
16
20
|
end
|
data/lib/rifle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rifle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,136 +9,136 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
type: :runtime
|
15
16
|
name: rails
|
17
|
+
prerelease: false
|
16
18
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
26
|
- - ! '>='
|
28
27
|
- !ruby/object:Gem::Version
|
29
28
|
version: '0'
|
29
|
+
none: false
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
+
type: :runtime
|
31
32
|
name: redis
|
33
|
+
prerelease: false
|
32
34
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
35
|
requirements:
|
35
36
|
- - ! '>='
|
36
37
|
- !ruby/object:Gem::Version
|
37
38
|
version: '0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
41
|
requirements:
|
43
42
|
- - ! '>='
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
45
|
+
none: false
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
+
type: :runtime
|
47
48
|
name: text
|
49
|
+
prerelease: false
|
48
50
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
51
|
requirements:
|
51
52
|
- - ! '>='
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: '0'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - ! '>='
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
61
|
+
none: false
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
+
type: :runtime
|
63
64
|
name: resque
|
65
|
+
prerelease: false
|
64
66
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
67
|
requirements:
|
67
68
|
- - ! '>='
|
68
69
|
- !ruby/object:Gem::Version
|
69
70
|
version: '0'
|
70
|
-
type: :runtime
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
71
|
none: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
73
|
requirements:
|
75
74
|
- - ! '>='
|
76
75
|
- !ruby/object:Gem::Version
|
77
76
|
version: '0'
|
77
|
+
none: false
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
+
type: :runtime
|
79
80
|
name: rest-client
|
81
|
+
prerelease: false
|
80
82
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
83
|
requirements:
|
83
84
|
- - ! '>='
|
84
85
|
- !ruby/object:Gem::Version
|
85
86
|
version: '0'
|
86
|
-
type: :runtime
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
87
|
none: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
89
|
requirements:
|
91
90
|
- - ! '>='
|
92
91
|
- !ruby/object:Gem::Version
|
93
92
|
version: '0'
|
93
|
+
none: false
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
+
type: :runtime
|
95
96
|
name: session_off
|
97
|
+
prerelease: false
|
96
98
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
99
|
requirements:
|
99
100
|
- - ! '>='
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
|
-
type: :runtime
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
103
|
none: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
105
|
requirements:
|
107
106
|
- - ! '>='
|
108
107
|
- !ruby/object:Gem::Version
|
109
108
|
version: '0'
|
109
|
+
none: false
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
+
type: :runtime
|
111
112
|
name: fitter-happier
|
113
|
+
prerelease: false
|
112
114
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
115
|
requirements:
|
115
116
|
- - ! '>='
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
119
|
none: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
121
|
requirements:
|
123
122
|
- - ! '>='
|
124
123
|
- !ruby/object:Gem::Version
|
125
124
|
version: '0'
|
125
|
+
none: false
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
|
+
type: :runtime
|
127
128
|
name: lograge
|
129
|
+
prerelease: false
|
128
130
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
131
|
requirements:
|
131
132
|
- - ! '>='
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
version: '0'
|
134
|
-
type: :runtime
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
135
|
none: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
137
|
requirements:
|
139
138
|
- - ! '>='
|
140
139
|
- !ruby/object:Gem::Version
|
141
140
|
version: '0'
|
141
|
+
none: false
|
142
142
|
description:
|
143
143
|
email:
|
144
144
|
- harry@harrylascelles.com
|
@@ -146,14 +146,14 @@ executables: []
|
|
146
146
|
extensions: []
|
147
147
|
extra_rdoc_files: []
|
148
148
|
files:
|
149
|
-
- app/controllers/application_controller.rb
|
150
149
|
- app/controllers/searches_controller.rb
|
151
|
-
-
|
150
|
+
- app/controllers/application_controller.rb
|
151
|
+
- lib/rifle.rb
|
152
152
|
- lib/rifle/engine.rb
|
153
|
+
- lib/rifle/rifle_resque.rb
|
153
154
|
- lib/rifle/settings.rb
|
154
155
|
- lib/rifle/version.rb
|
155
|
-
- lib/rifle/
|
156
|
-
- lib/rifle.rb
|
156
|
+
- lib/rifle/rifle_client.rb
|
157
157
|
- README.md
|
158
158
|
homepage: https://github.com/firstbanco/rifle
|
159
159
|
licenses: []
|
@@ -162,20 +162,20 @@ rdoc_options: []
|
|
162
162
|
require_paths:
|
163
163
|
- lib
|
164
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
165
|
requirements:
|
167
166
|
- - ! '>='
|
168
167
|
- !ruby/object:Gem::Version
|
169
168
|
version: '0'
|
170
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
169
|
none: false
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
171
|
requirements:
|
173
172
|
- - ! '>='
|
174
173
|
- !ruby/object:Gem::Version
|
175
174
|
version: '0'
|
175
|
+
none: false
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.8.
|
178
|
+
rubygems_version: 1.8.23
|
179
179
|
signing_key:
|
180
180
|
specification_version: 3
|
181
181
|
summary: Redis search server
|