mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-14 15:18:55 +02:00
![twitter-team](/assets/img/avatar_default.png)
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
17 lines
758 B
Scala
17 lines
758 B
Scala
package com.twitter.product_mixer.component_library.gate
|
|
|
|
import com.twitter.product_mixer.component_library.model.query.ads.AdsQuery
|
|
import com.twitter.product_mixer.core.functional_component.gate.Gate
|
|
import com.twitter.product_mixer.core.model.common.identifier.GateIdentifier
|
|
import com.twitter.product_mixer.core.pipeline.PipelineQuery
|
|
import com.twitter.stitch.Stitch
|
|
|
|
object NonEmptyAdsQueryStringGate extends Gate[PipelineQuery with AdsQuery] {
|
|
override val identifier: GateIdentifier = GateIdentifier("NonEmptyAdsQueryString")
|
|
|
|
override def shouldContinue(query: PipelineQuery with AdsQuery): Stitch[Boolean] = {
|
|
val queryString = query.searchRequestContext.flatMap(_.queryString)
|
|
Stitch.value(queryString.exists(_.trim.nonEmpty))
|
|
}
|
|
}
|