Permalink
Browse files

indent more

  • Loading branch information...
1 parent 135b649 commit 04e99c0cbf2a591999e60fd50abcd4754f5385c2 @erwaller erwaller committed Feb 14, 2011
Showing with 47 additions and 47 deletions.
  1. +47 −47 README.markdown
View
@@ -5,15 +5,15 @@ Soulmate is a tool to help solve the common problem of developing a fast autocom
Soulmate can offer suggestions for multiple types of items in a single query. An item is a simple JSON object that looks like:
- {
- "id": 3,
- "term": "Citi Field",
- "score": 81,
- "data": {
- "url": "/citi-field-tickets/",
- "subtitle": "Flushing, NY"
+ {
+ "id": 3,
+ "term": "Citi Field",
+ "score": 81,
+ "data": {
+ "url": "/citi-field-tickets/",
+ "subtitle": "Flushing, NY"
+ }
}
- }
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 lexigraphically 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).
@@ -24,56 +24,56 @@ You can load data into Soulmate by piping items into `soulmate load`.
Here's a sample `venues.json` (in the JSON lines format -- i.e. one JSON item per line):
- {"id":1,"term":"Dodger Stadium","score":85,"data":{"url":"\/dodger-stadium-tickets\/","subtitle":"Los Angeles, CA"}}
- {"id":28,"term":"Angel Stadium","score":85,"data":{"url":"\/angel-stadium-tickets\/","subtitle":"Anaheim, CA"}}
- {"id":30,"term":"Chase Field ","score":85,"data":{"url":"\/chase-field-tickets\/","subtitle":"Phoenix, AZ"}}
- {"id":29,"term":"Sun Life Stadium","score":84,"data":{"url":"\/sun-life-stadium-tickets\/","subtitle":"Miami, FL"}}
- {"id":2,"term":"Turner Field","score":83,"data":{"url":"\/turner-field-tickets\/","subtitle":"Atlanta, GA"}}
+ {"id":1,"term":"Dodger Stadium","score":85,"data":{"url":"\/dodger-stadium-tickets\/","subtitle":"Los Angeles, CA"}}
+ {"id":28,"term":"Angel Stadium","score":85,"data":{"url":"\/angel-stadium-tickets\/","subtitle":"Anaheim, CA"}}
+ {"id":30,"term":"Chase Field ","score":85,"data":{"url":"\/chase-field-tickets\/","subtitle":"Phoenix, AZ"}}
+ {"id":29,"term":"Sun Life Stadium","score":84,"data":{"url":"\/sun-life-stadium-tickets\/","subtitle":"Miami, FL"}}
+ {"id":2,"term":"Turner Field","score":83,"data":{"url":"\/turner-field-tickets\/","subtitle":"Atlanta, GA"}}
And the load command (with redis running locally on the default port, or specify a redis connection string with the `--redis` argument):
- $ soulmate load venue --redis=redis://localhost:6379/0 < venues.json
+ $ soulmate load venue --redis=redis://localhost:6379/0 < venues.json
Once it's loaded, we can query this data by starting `soulmate-web`:
- $ soulmate-web --foreground --redis=redis://localhost:6379/0 --no-launch
+ $ soulmate-web --foreground --redis=redis://localhost:6379/0 --no-launch
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:
- {
- "term": "stad",
- "results": {
- "venue": [
- {
- "id": 28,
- "term": "Angel Stadium",
- "score": 85,
- "data": {
- "url": "/angel-stadium-tickets/",
- "subtitle": "Anaheim, CA"
+ {
+ "term": "stad",
+ "results": {
+ "venue": [
+ {
+ "id": 28,
+ "term": "Angel Stadium",
+ "score": 85,
+ "data": {
+ "url": "/angel-stadium-tickets/",
+ "subtitle": "Anaheim, CA"
+ }
+ },
+ {
+ "id": 1,
+ "term": "Dodger Stadium",
+ "score": 85,
+ "data": {
+ "url": "/dodger-stadium-tickets/",
+ "subtitle": "Los Angeles, CA"
+ }
+ },
+ {
+ "id": 29,
+ "term": "Sun Life Stadium",
+ "score": 84,
+ "data": {
+ "url": "/sun-life-stadium-tickets/",
+ "subtitle": "Miami, FL"
+ }
}
- },
- {
- "id": 1,
- "term": "Dodger Stadium",
- "score": 85,
- "data": {
- "url": "/dodger-stadium-tickets/",
- "subtitle": "Los Angeles, CA"
- }
- },
- {
- "id": 29,
- "term": "Sun Life Stadium",
- "score": 84,
- "data": {
- "url": "/sun-life-stadium-tickets/",
- "subtitle": "Miami, FL"
- }
- }
- ]
+ ]
+ }
}
- }
== Contributing to soulmate

0 comments on commit 04e99c0

Please sign in to comment.