Skip to content

Instantly share code, notes, and snippets.

View bowd's full-sized avatar
always.

boqdan bowd

always.
View GitHub Profile
Updates:
totals
{ 'b' }
tracks
{ 't', 'b', 'u' } # This is theoretically irrelevant
# because track links 1-to-1 to user
{ 't', 'b' }
@bowd
bowd / Access Pattern
Created October 29, 2010 14:39
Access patterns
Updates:
totals
{ 'b' }
tracks
{ 't', 'b', 'u' } # This is theoretically irrelevant
# because track links 1-to-1 to user
{ 't', 'b' }
Indexes for [apps/track]
_id_
t_1
t_-1_b_-1_v_-1_c_-1
t_-1_b_-1_v_-1_d_-1
t_-1_b_-1_v_-1_f_-1
t_-1_b_-1_v_-1_p_-1
Indexes for [apps/track/slim]
_id_
t_1
if exists?(referrer = event[:referrer])
if ((matches = referrer.match(/([^\#]+)\#(.+)?\:(.+)?/))) && matches.size == 4
detail = "#{DETAILS}.#{escape(matches[2])}.#{escape(matches[3])}.#{PLAYS}"
# Here we split the stuff in the specialised referrer
# i.e. facebook.com#p:AwsomePage
# And we increment the detail below, but in the REFERRER for the update
# referrer is passed instead of matches[1] ( which is just the facebook.com )
buckets.each do |bucket|
@referrers_per_track.update({ TRACK => track_id, BUCKET => bucket, REFERRER => referrer }, {
'$inc' => {