Skip to content

Instantly share code, notes, and snippets.

@erraggy
Created December 3, 2013 00:50
Show Gist options
  • Save erraggy/7761995 to your computer and use it in GitHub Desktop.
Save erraggy/7761995 to your computer and use it in GitHub Desktop.
WebCrawlingSchema.WebTable.query2.withKey("http://mycrawledsite.com/crawledpage.html")
.withColumns(_.title, _.lastCrawled)
.withFamilies(_.searchMetrics)
.singleOption() match {
case Some(pageRow) => {
println("Title: " + pageRow.column(_.title).getOrElse("No Title"))
println("Crawled on: " + pageRow.column(_.lastCrawled).getOrElse(new DateTime()))
pageRow.family(_.searchMetrics).foreach {
case (date: DateMidnight, views: Long) =>
println("Got " + views + " views on date " + date.toString("MM-dd-yyyy"))
}
//Do something with title and crawled date...
}
case None => {
println("Row not found")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment