@SuppressWarnings("unchecked")
public static BlurQuery getBlurQuery(CommandLine commandLine) {
List<String> argList = commandLine.getArgList();
Option[] options = commandLine.getOptions();
Query query = new Query();
// Start at 2 because 1st arg is command 2nd is table
query.setQuery(join(argList.subList(2, argList.size()), " "));
if (commandLine.hasOption(DISABLE_ROW_QUERY)) {
query.setRowQuery(false);
}
if (commandLine.hasOption(SCORE_TYPE)) {
String scoreTypeStr = commandLine.getOptionValue(SCORE_TYPE);
ScoreType scoreType = ScoreType.valueOf(scoreTypeStr.toUpperCase());
query.setScoreType(scoreType);
}
if (commandLine.hasOption(RECORD_FILTER)) {
String recordFilter = commandLine.getOptionValue(RECORD_FILTER);
query.setRecordFilter(recordFilter);
}
if (commandLine.hasOption(ROW_FILTER)) {
String rowFilter = commandLine.getOptionValue(ROW_FILTER);
query.setRecordFilter(rowFilter);
}
// String recordFilter;
// String rowFilter;
// String rowId;
// long start;
// int fetch;
// long maxQueryTime;
// long minimumNumberOfResults;
// List<Facet> facets;
// List<SortField> sortFields;
BlurQuery blurQuery = new BlurQuery();
blurQuery.setQuery(query);
Selector selector = new Selector(Main.selector);
if (!query.isRowQuery()) {
selector.setRecordOnly(true);
}
blurQuery.setSelector(selector);
blurQuery.setCacheResult(false);
blurQuery.setUseCacheIfPresent(false);