Skip to content

Instantly share code, notes, and snippets.

@devth
Created February 20, 2012 23:31
Show Gist options
  • Save devth/1872287 to your computer and use it in GitHub Desktop.
Save devth/1872287 to your computer and use it in GitHub Desktop.
// Build filtered, sorted map of compared ratings
val compared = ListMap(
productFeatureComparison.getProductComparedRatings.asScala.toMap
// Filter out products that have no offers
.filterNot { case (pid, _) => lowestOffer(products.get(pid)) == None}
// Sort by similarity descending
.sortBy{-_._2.getSimilarity}:_*)
// Use the first 10
.take(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment