mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-28 05:56:04 +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.
29 lines
850 B
Java
29 lines
850 B
Java
package com.twitter.search.earlybird_root;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
|
|
import com.twitter.common.util.Clock;
|
|
import com.twitter.search.common.root.WarmupConfig;
|
|
import com.twitter.search.earlybird.thrift.EarlybirdRequest;
|
|
|
|
public class EarlybirdProtectedWarmup extends EarlybirdWarmup {
|
|
|
|
public EarlybirdProtectedWarmup(Clock clock, WarmupConfig config) {
|
|
super(clock, config);
|
|
}
|
|
|
|
/**
|
|
* The protected cluster requires all queries to specify a fromUserIdFilter and a searcherId.
|
|
*/
|
|
@Override
|
|
protected EarlybirdRequest createRequest(int requestId) {
|
|
EarlybirdRequest request = super.createRequest(requestId);
|
|
|
|
Preconditions.checkState(request.isSetSearchQuery());
|
|
request.getSearchQuery().addToFromUserIDFilter64(requestId);
|
|
request.getSearchQuery().setSearcherId(0L);
|
|
|
|
return request;
|
|
}
|
|
}
|