soulmate 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,111 @@
1
+ Soulmate
2
+ ========
3
+
4
+ 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 partially completed words and the corresponding top matching items, and provides a simple sinatra app to query them. Soulmate finishes your sentences.
5
+
6
+ Soulmate was designed to be simple and fast, and offers the following:
7
+
8
+ * Provide suggestions for multiple types of items in a single query (at SeatGeek we're autocompleting for performers, events, and venues)
9
+ * Results are ordered by a user-specified score
10
+ * Arbitrary metadata for each item (at SeatGeek we're storing both a url and a subtitle)
11
+
12
+ An item is a simple JSON object that looks like:
13
+
14
+ {
15
+ "id": 3,
16
+ "term": "Citi Field",
17
+ "score": 81,
18
+ "data": {
19
+ "url": "/citi-field-tickets/",
20
+ "subtitle": "Flushing, NY"
21
+ }
22
+ }
23
+
24
+ Where `id` is a unique identifier (within the specific type), `term` is the phrase you wish to provide completions for, `score` is a user-specified ranking metric (redis will order things lexicographically for items with the same score), and `data` is an optional container for metadata you'd like to return when this item is matched (at SeatGeek we're including a url for the item as well as a subtitle for when we present it in an autocomplete dropdown).
25
+
26
+ See Soulmate in action at <a href="http://seatgeek.com/">SeatGeek</a>.
27
+
28
+ Getting Started
29
+ ---------------
30
+
31
+ As always, kick things off with a `gem install`:
32
+
33
+ gem install soulmate
34
+
35
+ ### Loading Items
36
+
37
+ You can load data into Soulmate by piping items in the JSON lines format into `soulmate load TYPE`.
38
+
39
+ Here's a sample `venues.json` (one JSON item per line):
40
+
41
+ {"id":1,"term":"Dodger Stadium","score":85,"data":{"url":"\/dodger-stadium-tickets\/","subtitle":"Los Angeles, CA"}}
42
+ {"id":28,"term":"Angel Stadium","score":85,"data":{"url":"\/angel-stadium-tickets\/","subtitle":"Anaheim, CA"}}
43
+ {"id":30,"term":"Chase Field ","score":85,"data":{"url":"\/chase-field-tickets\/","subtitle":"Phoenix, AZ"}}
44
+ {"id":29,"term":"Sun Life Stadium","score":84,"data":{"url":"\/sun-life-stadium-tickets\/","subtitle":"Miami, FL"}}
45
+ {"id":2,"term":"Turner Field","score":83,"data":{"url":"\/turner-field-tickets\/","subtitle":"Atlanta, GA"}}
46
+
47
+ And here's the load command (Soulmate assumes redis is running locally on the default port, or you can specify a redis connection string with the `--redis` argument):
48
+
49
+ $ soulmate load venue --redis=redis://localhost:6379/0 < venues.json
50
+
51
+ ### Querying for Data
52
+
53
+ Once it's loaded, we can query this data by starting `soulmate-web`:
54
+
55
+ $ soulmate-web --foreground --no-launch --redis=redis://localhost:6379/0
56
+
57
+ And viewing the service in your browser: <a href="http://localhost:5678/search?types[]=venue&term=stad">http://localhost:5678/search?types[]=venue&term=stad</a>. You should see something like:
58
+
59
+ {
60
+ "term": "stad",
61
+ "results": {
62
+ "venue": [
63
+ {
64
+ "id": 28,
65
+ "term": "Angel Stadium",
66
+ "score": 85,
67
+ "data": {
68
+ "url": "/angel-stadium-tickets/",
69
+ "subtitle": "Anaheim, CA"
70
+ }
71
+ },
72
+ {
73
+ "id": 1,
74
+ "term": "Dodger Stadium",
75
+ "score": 85,
76
+ "data": {
77
+ "url": "/dodger-stadium-tickets/",
78
+ "subtitle": "Los Angeles, CA"
79
+ }
80
+ },
81
+ {
82
+ "id": 29,
83
+ "term": "Sun Life Stadium",
84
+ "score": 84,
85
+ "data": {
86
+ "url": "/sun-life-stadium-tickets/",
87
+ "subtitle": "Miami, FL"
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+
94
+ The `/search` method supports multiple `types` as well as an optional `limit`. For example: `http://localhost:5678/search?types[]=event&types[]=venue&types[]=performer&limit=3&term=yank`.
95
+
96
+ Contributing to soulmate
97
+ ------------------------
98
+
99
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
100
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
101
+ * Fork the project
102
+ * Start a feature/bugfix branch
103
+ * Commit and push until you are happy with your contribution
104
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
105
+
106
+ Copyright
107
+ ---------
108
+
109
+ Copyright (c) 2011 Eric Waller. See LICENSE.txt for
110
+ further details.
111
+
@@ -2,7 +2,7 @@ module Soulmate
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
data/soulmate.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{soulmate}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
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"]
@@ -15,14 +15,14 @@ Gem::Specification.new do |s|
15
15
  s.executables = ["soulmate", "soulmate-web"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
- "README.rdoc"
18
+ "README.markdown"
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
24
  "LICENSE.txt",
25
- "README.rdoc",
25
+ "README.markdown",
26
26
  "Rakefile",
27
27
  "bin/soulmate",
28
28
  "bin/soulmate-web",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Eric Waller
@@ -140,13 +140,13 @@ extensions: []
140
140
 
141
141
  extra_rdoc_files:
142
142
  - LICENSE.txt
143
- - README.rdoc
143
+ - README.markdown
144
144
  files:
145
145
  - .document
146
146
  - Gemfile
147
147
  - Gemfile.lock
148
148
  - LICENSE.txt
149
- - README.rdoc
149
+ - README.markdown
150
150
  - Rakefile
151
151
  - bin/soulmate
152
152
  - bin/soulmate-web
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
174
  requirements:
175
175
  - - ">="
176
176
  - !ruby/object:Gem::Version
177
- hash: -955125361
177
+ hash: -255035119
178
178
  segments:
179
179
  - 0
180
180
  version: "0"
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = soulmate
2
-
3
- Description goes here.
4
-
5
- == Contributing to soulmate
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 Eric Waller. See LICENSE.txt for
18
- further details.
19
-