mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
b389c3d302
Pushservice is the main recommendation service we use to surface recommendations to our users via notifications. It fetches candidates from various sources, ranks them in order of relevance, and applies filters to determine the best one to send.
29 lines
890 B
Scala
29 lines
890 B
Scala
package com.twitter.frigate.pushservice.store
|
|
|
|
import com.twitter.explore_ranker.thriftscala.ExploreRanker
|
|
import com.twitter.explore_ranker.thriftscala.ExploreRankerResponse
|
|
import com.twitter.explore_ranker.thriftscala.ExploreRankerRequest
|
|
import com.twitter.storehaus.ReadableStore
|
|
import com.twitter.util.Future
|
|
|
|
/** A Store for Video Tweet Recommendations from Explore
|
|
*
|
|
* @param exploreRankerService
|
|
*/
|
|
case class ExploreRankerStore(exploreRankerService: ExploreRanker.MethodPerEndpoint)
|
|
extends ReadableStore[ExploreRankerRequest, ExploreRankerResponse] {
|
|
|
|
/** Method to get video recommendations
|
|
*
|
|
* @param request explore ranker request object
|
|
* @return
|
|
*/
|
|
override def get(
|
|
request: ExploreRankerRequest
|
|
): Future[Option[ExploreRankerResponse]] = {
|
|
exploreRankerService.getRankedResults(request).map { response =>
|
|
Some(response)
|
|
}
|
|
}
|
|
}
|