soulmate 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +11 -9
- data/lib/soulmate/server.rb +6 -3
- data/lib/soulmate/version.rb +9 -0
- data/lib/soulmate.rb +1 -0
- data/soulmate.gemspec +3 -3
- metadata +5 -5
- data/VERSION +0 -1
data/Rakefile
CHANGED
@@ -10,17 +10,19 @@ end
|
|
10
10
|
require 'rake'
|
11
11
|
|
12
12
|
require 'jeweler'
|
13
|
+
require './lib/soulmate/version.rb'
|
13
14
|
Jeweler::Tasks.new do |gem|
|
14
15
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name
|
16
|
-
gem.
|
17
|
-
gem.
|
18
|
-
gem.
|
19
|
-
gem.
|
20
|
-
gem.
|
21
|
-
gem.
|
22
|
-
|
23
|
-
|
16
|
+
gem.name = "soulmate"
|
17
|
+
gem.version = Soulmate::Version::STRING
|
18
|
+
gem.homepage = "http://github.com/seatgeek/soulmate"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Redis-backed service for fast autocompleting - extracted from SeatGeek}
|
21
|
+
gem.description = %Q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.}
|
22
|
+
gem.email = "eric@seatgeek.com"
|
23
|
+
gem.homepage = "http://github.com/seatgeek/soulmate"
|
24
|
+
gem.authors = ["Eric Waller"]
|
25
|
+
# The versions specified here are pretty arbitrary right now...
|
24
26
|
gem.add_runtime_dependency 'redis', '>= 2.0'
|
25
27
|
gem.add_runtime_dependency 'vegas', '>= 0.1.0'
|
26
28
|
gem.add_runtime_dependency 'sinatra', '>= 1.0'
|
data/lib/soulmate/server.rb
CHANGED
@@ -11,17 +11,19 @@ module Soulmate
|
|
11
11
|
end
|
12
12
|
|
13
13
|
get '/' do
|
14
|
-
|
14
|
+
JSON.pretty_generate({ :soulmate => Soulmate::Version::STRING, :status => "ok" })
|
15
15
|
end
|
16
16
|
|
17
17
|
get '/search' do
|
18
|
+
raise Sinatra::NotFound unless (params[:term] and params[:types] and params[:types].is_a?(Array))
|
19
|
+
|
18
20
|
limit = (params[:limit] || 5).to_i
|
19
21
|
types = params[:types].map { |t| normalize(t) }
|
20
22
|
term = params[:term]
|
21
23
|
|
22
24
|
results = {}
|
23
25
|
types.each do |type|
|
24
|
-
matcher =
|
26
|
+
matcher = Matcher.new(type)
|
25
27
|
results[type] = matcher.matches_for_term(term, :limit => limit)
|
26
28
|
end
|
27
29
|
|
@@ -32,7 +34,8 @@ module Soulmate
|
|
32
34
|
end
|
33
35
|
|
34
36
|
not_found do
|
35
|
-
'
|
37
|
+
content_type 'application/json', :charset => 'utf-8'
|
38
|
+
JSON.pretty_generate({ :error => "not found" })
|
36
39
|
end
|
37
40
|
|
38
41
|
end
|
data/lib/soulmate.rb
CHANGED
data/soulmate.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{soulmate}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Eric Waller"]
|
12
12
|
s.date = %q{2011-02-14}
|
13
|
-
s.description = %q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate
|
13
|
+
s.description = %q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.}
|
14
14
|
s.email = %q{eric@seatgeek.com}
|
15
15
|
s.executables = ["soulmate", "soulmate-web"]
|
16
16
|
s.extra_rdoc_files = [
|
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
|
|
24
24
|
"LICENSE.txt",
|
25
25
|
"README.rdoc",
|
26
26
|
"Rakefile",
|
27
|
-
"VERSION",
|
28
27
|
"bin/soulmate",
|
29
28
|
"bin/soulmate-web",
|
30
29
|
"lib/soulmate.rb",
|
@@ -33,6 +32,7 @@ Gem::Specification.new do |s|
|
|
33
32
|
"lib/soulmate/loader.rb",
|
34
33
|
"lib/soulmate/matcher.rb",
|
35
34
|
"lib/soulmate/server.rb",
|
35
|
+
"lib/soulmate/version.rb",
|
36
36
|
"soulmate.gemspec",
|
37
37
|
"test/helper.rb",
|
38
38
|
"test/test_soulmate.rb"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eric Waller
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
type: :runtime
|
132
132
|
prerelease: false
|
133
133
|
version_requirements: *id008
|
134
|
-
description: Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate
|
134
|
+
description: Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.
|
135
135
|
email: eric@seatgeek.com
|
136
136
|
executables:
|
137
137
|
- soulmate
|
@@ -148,7 +148,6 @@ files:
|
|
148
148
|
- LICENSE.txt
|
149
149
|
- README.rdoc
|
150
150
|
- Rakefile
|
151
|
-
- VERSION
|
152
151
|
- bin/soulmate
|
153
152
|
- bin/soulmate-web
|
154
153
|
- lib/soulmate.rb
|
@@ -157,6 +156,7 @@ files:
|
|
157
156
|
- lib/soulmate/loader.rb
|
158
157
|
- lib/soulmate/matcher.rb
|
159
158
|
- lib/soulmate/server.rb
|
159
|
+
- lib/soulmate/version.rb
|
160
160
|
- soulmate.gemspec
|
161
161
|
- test/helper.rb
|
162
162
|
- test/test_soulmate.rb
|
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
174
|
requirements:
|
175
175
|
- - ">="
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
hash: -
|
177
|
+
hash: -955125361
|
178
178
|
segments:
|
179
179
|
- 0
|
180
180
|
version: "0"
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.1
|