use of datawave.query.config.ContentQueryConfiguration in project datawave by NationalSecurityAgency.
the class ContentQueryTable method setupQuery.
@Override
public void setupQuery(GenericQueryConfiguration genericConfig) throws Exception {
if (!genericConfig.getClass().getName().equals(ContentQueryConfiguration.class.getName())) {
throw new QueryException("Did not receive a ContentQueryConfiguration instance!!");
}
final ContentQueryConfiguration config = (ContentQueryConfiguration) genericConfig;
try {
final BatchScanner scanner = this.scannerFactory.newScanner(config.getTableName(), config.getAuthorizations(), this.queryThreads, config.getQuery());
scanner.setRanges(config.getRanges());
if (null != this.viewName) {
final IteratorSetting cfg = new IteratorSetting(50, RegExFilter.class);
cfg.addOption(RegExFilter.COLQ_REGEX, this.viewName);
scanner.addScanIterator(cfg);
}
this.iterator = scanner.iterator();
this.scanner = scanner;
} catch (TableNotFoundException e) {
throw new RuntimeException("Table not found: " + this.getTableName(), e);
}
}
use of datawave.query.config.ContentQueryConfiguration in project datawave by NationalSecurityAgency.
the class ContentQueryTable method initialize.
@Override
public GenericQueryConfiguration initialize(final Connector connection, final Query settings, final Set<Authorizations> auths) throws Exception {
// Initialize the config and scanner factory
final ContentQueryConfiguration config = new ContentQueryConfiguration(this, settings);
this.scannerFactory = new ScannerFactory(connection);
config.setConnector(connection);
config.setAuthorizations(auths);
// Re-assign the view name if specified via params
Parameter p = settings.findParameter(QueryParameters.CONTENT_VIEW_NAME);
if (null != p && !StringUtils.isEmpty(p.getParameterValue())) {
this.viewName = p.getParameterValue();
}
// Decide whether or not to include the content of child events
String end;
p = settings.findParameter(QueryParameters.CONTENT_VIEW_ALL);
if ((null != p) && (null != p.getParameterValue()) && StringUtils.isNotBlank(p.getParameterValue())) {
end = ALL;
} else {
end = PARENT_ONLY;
}
// Configure ranges
final Collection<Range> ranges = this.createRanges(settings, end);
config.setRanges(ranges);
return config;
}
Aggregations