Skip to content

Commit

Permalink
updated parse and index to work with timestamped keys
Browse files Browse the repository at this point in the history
  • Loading branch information
dhgwilliam committed Nov 6, 2011
1 parent 76cde65 commit d9c31e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
end

get '/:key' do
@object = JSON.parse(redis.get("tag:google.com,2005:reader/item/#{params[:key]}"))
@object = JSON.parse(redis.get(redis.keys("*tag:google.com,2005:reader/item/#{params[:key]}")))
if @object.has_key?("content")
@item = @object.values_at("content")[0].values_at("content")[0]
elsif @object.has_key?("summary")
Expand Down
4 changes: 2 additions & 2 deletions parse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
google_json = JSON.parse(google_string)
item_array = google_json.values_at("items")[0]
item_array.each do |item|
item_id = item.values_at("id")[0]
item_id = "#{item.values_at("crawlTimeMsec").slice(0..9)[0]}:#{item.values_at("id")[0]}"
redis.set item_id, item.to_json
end
redis_test = redis.get "tag:google.com,2005:reader/item/0e5c79d3a27b42d4"
redis_test = redis.get redis.keys("*tag:google.com,2005:reader/item/0e5c79d3a27b42d4")[0]
puts JSON.parse(redis_test).values_at("id")

0 comments on commit d9c31e3

Please sign in to comment.