Search in sources :

Example 1 with EventFieldIterator

use of datawave.query.iterator.EventFieldIterator in project datawave by NationalSecurityAgency.

the class IteratorBuildingVisitor method buildExceededFromTermFrequency.

/**
 * @param data
 */
private NestedIterator<Key> buildExceededFromTermFrequency(String identifier, JexlNode rootNode, JexlNode sourceNode, LiteralRange<?> range, Object data) {
    if (limitLookup) {
        ChainableEventDataQueryFilter wrapped = createWrappedTermFrequencyFilter(identifier, sourceNode, attrFilter);
        NestedIterator<Key> eventFieldIterator = new EventFieldIterator(rangeLimiter, source.deepCopy(env), identifier, new AttributeFactory(this.typeMetadata), getEventFieldAggregator(identifier, wrapped));
        TermFrequencyIndexBuilder builder = new TermFrequencyIndexBuilder();
        builder.setSource(source.deepCopy(env));
        builder.setTypeMetadata(typeMetadata);
        builder.setFieldsToAggregate(fieldsToAggregate);
        builder.setTimeFilter(timeFilter);
        builder.setAttrFilter(attrFilter);
        builder.setDatatypeFilter(datatypeFilter);
        builder.setEnv(env);
        builder.setTermFrequencyAggregator(getTermFrequencyAggregator(identifier, sourceNode, attrFilter, attrFilter != null ? attrFilter.getMaxNextCount() : -1));
        builder.setNode(rootNode);
        Range fiRange = getFiRangeForTF(range);
        builder.setRange(fiRange);
        builder.setField(identifier);
        NestedIterator<Key> tfIterator = builder.build();
        OrIterator tfMerge = new OrIterator(Arrays.asList(tfIterator, eventFieldIterator));
        return tfMerge;
    } else {
        QueryException qe = new QueryException(DatawaveErrorCode.UNEXPECTED_SOURCE_NODE, MessageFormat.format("{0}", "buildExceededFromTermFrequency"));
        throw new DatawaveFatalQueryException(qe);
    }
}
Also used : ChainableEventDataQueryFilter(datawave.query.predicate.ChainableEventDataQueryFilter) DatawaveFatalQueryException(datawave.query.exceptions.DatawaveFatalQueryException) QueryException(datawave.webservice.query.exception.QueryException) EventFieldIterator(datawave.query.iterator.EventFieldIterator) TermFrequencyIndexBuilder(datawave.query.iterator.builder.TermFrequencyIndexBuilder) OrIterator(datawave.query.iterator.logic.OrIterator) DatawaveFatalQueryException(datawave.query.exceptions.DatawaveFatalQueryException) AttributeFactory(datawave.query.attributes.AttributeFactory) LiteralRange(datawave.query.jexl.LiteralRange) Range(org.apache.accumulo.core.data.Range) Key(org.apache.accumulo.core.data.Key) PartialKey(org.apache.accumulo.core.data.PartialKey)

Aggregations

AttributeFactory (datawave.query.attributes.AttributeFactory)1 DatawaveFatalQueryException (datawave.query.exceptions.DatawaveFatalQueryException)1 EventFieldIterator (datawave.query.iterator.EventFieldIterator)1 TermFrequencyIndexBuilder (datawave.query.iterator.builder.TermFrequencyIndexBuilder)1 OrIterator (datawave.query.iterator.logic.OrIterator)1 LiteralRange (datawave.query.jexl.LiteralRange)1 ChainableEventDataQueryFilter (datawave.query.predicate.ChainableEventDataQueryFilter)1 QueryException (datawave.webservice.query.exception.QueryException)1 Key (org.apache.accumulo.core.data.Key)1 PartialKey (org.apache.accumulo.core.data.PartialKey)1 Range (org.apache.accumulo.core.data.Range)1