rifle 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/searches_controller.rb +5 -0
- data/lib/rifle.rb +12 -0
- data/lib/rifle/rifle_client.rb +7 -0
- data/lib/rifle/version.rb +1 -1
- metadata +2 -2
data/lib/rifle.rb
CHANGED
@@ -7,6 +7,15 @@ require_relative 'rifle/rifle_resque'
|
|
7
7
|
require_relative 'rifle/rifle_client'
|
8
8
|
|
9
9
|
module Rifle
|
10
|
+
def self.flush
|
11
|
+
p "Flushing all Rifle indices..."
|
12
|
+
keys = Rifle.settings.redis.keys("rifle:*")
|
13
|
+
keys.each { |k|
|
14
|
+
Rifle.settings.redis.del(k)
|
15
|
+
}
|
16
|
+
p "Flushing all Rifle indices complete"
|
17
|
+
end
|
18
|
+
|
10
19
|
def self.store(urn, hash)
|
11
20
|
Processor.new.index_resource(urn, hash)
|
12
21
|
end
|
@@ -18,6 +27,7 @@ module Rifle
|
|
18
27
|
class Processor
|
19
28
|
|
20
29
|
def index_resource(urn, hash)
|
30
|
+
p "Rifle indexing object with urn #{urn}"
|
21
31
|
# First get the old values
|
22
32
|
old_payload = get_payload_for_urn(urn)
|
23
33
|
if old_payload
|
@@ -47,6 +57,7 @@ module Rifle
|
|
47
57
|
end
|
48
58
|
|
49
59
|
def search_for(sentence, urns_only)
|
60
|
+
p "Rifle searching for #{sentence}, urns only #{urns_only}"
|
50
61
|
words = get_words_array_from_text(sentence)
|
51
62
|
metaphones = get_metaphones_from_word_set(Set.new(words))
|
52
63
|
urns = Set.new
|
@@ -54,6 +65,7 @@ module Rifle
|
|
54
65
|
new_urns = get_urns_for_metaphone(metaphone)
|
55
66
|
urns = urns.merge(new_urns)
|
56
67
|
end
|
68
|
+
p "Rifle found #{urns.size} urns"
|
57
69
|
if urns_only
|
58
70
|
urns
|
59
71
|
else
|
data/lib/rifle/rifle_client.rb
CHANGED
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.1
|
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: 2012-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|