Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
Created September 30, 2011 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorenmacbeth/1252919 to your computer and use it in GitHub Desktop.
Save sorenmacbeth/1252919 to your computer and use it in GitHub Desktop.
(defn landings [root]
(let [ybtag (select-fields (ybtag-tap root) ["!psn" "!pvi" "!lo" "!ln" "!g_C" "!g_r" "!g_c" "!r" "!nv"])
landing-sq (<- [!pub !country !region !city !kw !ref !url !pv-id ?c]
(ybtag !pub !pv-id !url !ln !country !region !city !r !nv)
(not= !r nil)
(expand-fields !r :> !kw !ref)
(= !ln "true")
(= !nv "1")
(c/count ?c))]
(<- [!pub !country !region !city !kw !ref !url ?s]
(landing-sq !pub !country !region !city !kw !ref !url !pv-id ?c)
(c/sum ?c :> ?s))))
(defn landings [root]
(let [ybtag (select-fields (ybtag-tap root) ["!psn" "!pvi" "!lo" "!ln" "!g_C" "!g_r" "!g_c" "!r" "!nv"])
landing-sq (<- [!pub !country !region !city !kw !ref !url !pv-id ?c]
(ybtag !pub !pv-id !url !ln !country !region !city !r !nv)
(not= !r nil)
(expand-fields !r :> !kw !ref)
(= !ln "true")
(= !nv "0")
(c/count ?c))]
(<- [!pub !country !region !city !kw !ref !url ?s]
(landing-sq !pub !country !region !city !kw !ref !url !pv-id ?c)
(c/sum ?c :> ?s))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment