当前位置: 首页>>代码示例>>Java>>正文


Java Scanner.clearColumns方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:57,代码来源:AccumuloFreeTextIndexer.java


注:本文中的org.apache.accumulo.core.client.Scanner.clearColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。