本文整理汇总了Java中org.apache.accumulo.core.client.Scanner.clearColumns方法的典型用法代码示例。如果您正苦于以下问题:Java Scanner.clearColumns方法的具体用法?Java Scanner.clearColumns怎么用?Java Scanner.clearColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.client.Scanner
的用法示例。
在下文中一共展示了Scanner.clearColumns方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryText
import org.apache.accumulo.core.client.Scanner; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public CloseableIteration<Statement, QueryEvaluationException> queryText(final String query, final StatementConstraints contraints)
throws IOException {
final Scanner docTableScan = getScanner(getFreeTextDocTablename(conf));
// test the query to see if it's parses correctly.
SimpleNode root = parseQuery(query);
// unroll any wildcard nodes before it goes to the server
unrollWildcards(root);
final String unrolledQuery = ASTNodeUtils.serializeExpression(root);
// Add S P O C constraints to query
final StringBuilder constrainedQuery = new StringBuilder("(" + unrolledQuery + ")");
if (contraints.hasSubject()) {
constrainedQuery.append(" AND ");
constrainedQuery.append(ColumnPrefixes.getSubjColFam(contraints.getSubject().toString()).toString());
}
if (contraints.hasContext()) {
constrainedQuery.append(" AND ");
constrainedQuery.append(ColumnPrefixes.getContextColFam(contraints.getContext().toString()).toString());
}
if (contraints.hasPredicates()) {
constrainedQuery.append(" AND (");
final List<String> predicates = new ArrayList<String>();
for (final URI u : contraints.getPredicates()) {
predicates.add(ColumnPrefixes.getPredColFam(u.stringValue()).toString());
}
constrainedQuery.append(StringUtils.join(predicates, " OR "));
constrainedQuery.append(")");
}
// Verify that the query is a reasonable size
root = parseQuery(constrainedQuery.toString());
final int termCount = ASTNodeUtils.termCount(root);
if (termCount > queryTermLimit) {
throw new IOException("Query contains too many terms. Term limit: " + queryTermLimit + ". Term Count: " + termCount);
}
// perform query
docTableScan.clearScanIterators();
docTableScan.clearColumns();
final int iteratorPriority = 20;
final String iteratorName = "booleanTree";
final IteratorSetting ii = new IteratorSetting(iteratorPriority, iteratorName, BooleanTreeIterator.class);
BooleanTreeIterator.setQuery(ii, constrainedQuery.toString());
docTableScan.addScanIterator(ii);
docTableScan.setRange(new Range());
return getIteratorWrapper(docTableScan);
}