Search in sources :

Example 11 with Type

use of com.tuplejump.stargate.lucene.Type in project stargate-core by tuplejump.

the class Group method addTuple.

public void addTuple(Tuple tuple) {
    Tuple key = tuple.project(groupByFields, groupByExpressions);
    Collection<Aggregate> groupValue = groups.get(key);
    if (groupValue.isEmpty()) {
        for (AggregateFactory aggregateFactory : aggregatesToCalculate) {
            Type valueType = AggregateFunction.getLuceneType(options, aggregateFactory.getField());
            Aggregate aggregate = aggregateFactory.getAggregate(valueType);
            aggregate.aggregate(tuple);
            groups.put(key, aggregate);
        }
    } else {
        for (Aggregate aggregate : groupValue) {
            aggregate.aggregate(tuple);
        }
    }
}
Also used : Type(com.tuplejump.stargate.lucene.Type)

Aggregations

Type (com.tuplejump.stargate.lucene.Type)11 Properties (com.tuplejump.stargate.lucene.Properties)9 Term (org.apache.lucene.index.Term)6 Query (org.apache.lucene.search.Query)5 NumericConfig (org.apache.lucene.queryparser.flexible.standard.config.NumericConfig)3 CQL3Type (org.apache.cassandra.cql3.CQL3Type)2 Analyzer (org.apache.lucene.analysis.Analyzer)2 FieldType (org.apache.lucene.document.FieldType)2 Options (com.tuplejump.stargate.lucene.Options)1 ParseException (java.text.ParseException)1 ColumnDefinition (org.apache.cassandra.config.ColumnDefinition)1 PerFieldAnalyzerWrapper (org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper)1 BooleanQuery (org.apache.lucene.search.BooleanQuery)1 FuzzyQuery (org.apache.lucene.search.FuzzyQuery)1 NumericRangeQuery (org.apache.lucene.search.NumericRangeQuery)1 PhraseQuery (org.apache.lucene.search.PhraseQuery)1 PrefixQuery (org.apache.lucene.search.PrefixQuery)1 RegexpQuery (org.apache.lucene.search.RegexpQuery)1 TermQuery (org.apache.lucene.search.TermQuery)1 WildcardQuery (org.apache.lucene.search.WildcardQuery)1