ParameterBroker params = new ParameterBroker(args[0]);
PrintStream out = new PrintStream(System.out, true, "UTF-8");
PrintStream err = new PrintStream(System.err, true, "UTF-8");
GQueries queries = new GQueriesJsonImpl();
queries.read(params.getParamValue(QUERIES_OPTION));
Stopper stopper = null;
if(params.getParamValue(STOPPER_OPTION) != null)
stopper = new Stopper(params.getParamValue(STOPPER_OPTION));
// max number of docs to send to output
int numResults = 1000;
try {
if (params.getParamValue(NUM_RESULTS_OPTION) != null) {
numResults = Integer.parseInt(params.getParamValue(NUM_RESULTS_OPTION));
}
} catch (NumberFormatException e) {
err.println("Invalid " + NUM_RESULTS_OPTION + ": " + params.getParamValue(NUM_RESULTS_OPTION));
System.exit(-1);
}
int fbDocs = 0;
try {
if (params.getParamValue(FB_DOCS_OPTION) != null) {
fbDocs = Integer.parseInt(params.getParamValue(FB_DOCS_OPTION));
}
} catch (NumberFormatException e) {
err.println("Invalid " + FB_DOCS_OPTION + ": " + params.getParamValue(FB_DOCS_OPTION));
System.exit(-1);
}
int fbTerms = 0;
try {
if (params.getParamValue(FB_TERMS_OPTION) != null) {
fbTerms = Integer.parseInt(params.getParamValue(FB_TERMS_OPTION));
}
} catch (NumberFormatException e) {
err.println("Invalid " + FB_TERMS_OPTION + ": " + params.getParamValue(FB_TERMS_OPTION));
System.exit(-1);
}
// authentication credentials
String group = params.getParamValue(GROUP_OPTION);
if(group==null) {
err.println("Invalid " + GROUP_OPTION + ": must set a valid group ID");
System.exit(-1);
}
String token = params.getParamValue(TOKEN_OPTION);
if(group==null) {
err.println("Invalid " + TOKEN_OPTION + ": must set a valid authentication token");
System.exit(-1);
}
TrecSearchThriftClient client = new TrecSearchThriftClient(params.getParamValue(HOST_OPTION),
Integer.parseInt(params.getParamValue(PORT_OPTION)), group, token);
Iterator<GQuery> queryIterator = queries.iterator();
while(queryIterator.hasNext()) {
GQuery query = queryIterator.next();
System.err.println(query.getTitle());
String queryText = query.getText();