soulheart 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/soulheart +1 -1
- data/lib/soulheart.rb +1 -2
- data/lib/soulheart/loader.rb +1 -1
- data/lib/soulheart/matcher.rb +1 -1
- data/lib/soulheart/server.rb +5 -5
- data/lib/soulheart/version.rb +1 -1
- metadata +6 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cdb795313ac11f814661f05f909345f831b473a8ae77fdef354918820012f13e
|
4
|
+
data.tar.gz: 5cf89e90855b28a0d721fb9feeb359c80fb35243f8f42e90297af5b02c49f3dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8e8b2f350377d635fceb04a0da5247bfafe464240454ccda378831c6323eb3e01e9db059716744f0439eb3a7c2cf0ee99347c1abe2db70ed1de30ff2d9b3406
|
7
|
+
data.tar.gz: bbea122eeaf96cd47222c8d91256760b53a84e696b0e6a638fb146155579942f51643161f4f8e357206e250a03d41f9d6b512d37c513097a3ad241ee992c3cb6
|
data/bin/soulheart
CHANGED
data/lib/soulheart.rb
CHANGED
data/lib/soulheart/loader.rb
CHANGED
@@ -120,7 +120,7 @@ module Soulheart
|
|
120
120
|
redis.pipelined do
|
121
121
|
redis.zadd(no_query_id(category_base_id), priority, item['term']) # Add to master set for queryless searches
|
122
122
|
# store the raw data in a separate key to reduce memory usage, if it's cleaned it's done
|
123
|
-
redis.hset(results_hashes_id, item['term'],
|
123
|
+
redis.hset(results_hashes_id, item['term'], item['data'].to_json) unless cleaned
|
124
124
|
phrase = ([item['term']] + (item['aliases'] || [])).join(' ')
|
125
125
|
# Store all the prefixes
|
126
126
|
prefixes_for_phrase(phrase).each do |p|
|
data/lib/soulheart/matcher.rb
CHANGED
@@ -65,7 +65,7 @@ module Soulheart
|
|
65
65
|
return [] unless terms.size > 0
|
66
66
|
results = redis.hmget(results_hashes_id, *terms)
|
67
67
|
results = results.reject(&:nil?) # handle cached results for terms which have since been deleted
|
68
|
-
results.map { |r|
|
68
|
+
results.map { |r| JSON.parse(r) }
|
69
69
|
end
|
70
70
|
|
71
71
|
def matches
|
data/lib/soulheart/server.rb
CHANGED
@@ -15,27 +15,27 @@ module Soulheart
|
|
15
15
|
|
16
16
|
get '/' do
|
17
17
|
matches = Matcher.new(params).matches
|
18
|
-
|
18
|
+
{matches: matches}.to_json
|
19
19
|
end
|
20
20
|
|
21
21
|
get '/categories' do
|
22
|
-
|
22
|
+
{categories: Base.new.sorted_category_array}.to_json
|
23
23
|
end
|
24
24
|
|
25
25
|
get '/info' do
|
26
26
|
info = Soulheart::Base.new.redis.info
|
27
|
-
|
27
|
+
{
|
28
28
|
soulheart_version: Soulheart::VERSION,
|
29
29
|
current_time: Time.now.utc.strftime('%H:%M:%S UTC'),
|
30
30
|
redis_used_memory: info['used_memory_human'],
|
31
31
|
stop_words: Soulheart.stop_words,
|
32
32
|
normalizer: Soulheart.normalizer,
|
33
|
-
}
|
33
|
+
}.to_json
|
34
34
|
end
|
35
35
|
|
36
36
|
not_found do
|
37
37
|
content_type 'application/json', charset: 'utf-8'
|
38
|
-
|
38
|
+
{error: 'not found'}.to_json
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/lib/soulheart/version.rb
CHANGED
metadata
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soulheart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Herr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 3.0.5
|
@@ -24,9 +21,6 @@ dependencies:
|
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.0'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: 3.0.5
|
@@ -44,26 +38,6 @@ dependencies:
|
|
44
38
|
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: 0.1.0
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: multi_json
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.11'
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 1.11.2
|
57
|
-
type: :runtime
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '1.11'
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 1.11.2
|
67
41
|
- !ruby/object:Gem::Dependency
|
68
42
|
name: sinatra
|
69
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,7 +112,7 @@ homepage: https://github.com/sethherr/soulheart
|
|
138
112
|
licenses:
|
139
113
|
- MIT
|
140
114
|
metadata: {}
|
141
|
-
post_install_message:
|
115
|
+
post_install_message:
|
142
116
|
rdoc_options: []
|
143
117
|
require_paths:
|
144
118
|
- lib
|
@@ -153,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
127
|
- !ruby/object:Gem::Version
|
154
128
|
version: '0'
|
155
129
|
requirements: []
|
156
|
-
|
157
|
-
|
158
|
-
signing_key:
|
130
|
+
rubygems_version: 3.1.4
|
131
|
+
signing_key:
|
159
132
|
specification_version: 4
|
160
133
|
summary: Simple, fast autocomplete server for Ruby and Rails
|
161
134
|
test_files: []
|