Search in sources :

Example 1 with AggValueSource

use of org.apache.solr.search.facet.AggValueSource in project lucene-solr by apache.

the class FunctionQParser method parseAgg.

/** @lucene.experimental */
public AggValueSource parseAgg(int flags) throws SyntaxError {
    String id = sp.getId();
    AggValueSource vs = null;
    boolean hasParen = false;
    if ("agg".equals(id)) {
        hasParen = sp.opt("(");
        vs = parseAgg(flags | FLAG_IS_AGG);
    } else {
        // parse as an aggregation...
        if (!id.startsWith("agg_")) {
            id = "agg_" + id;
        }
        hasParen = sp.opt("(");
        ValueSourceParser argParser = req.getCore().getValueSourceParser(id);
        argParser = req.getCore().getValueSourceParser(id);
        if (argParser == null) {
            throw new SyntaxError("Unknown aggregation " + id + " in (" + sp + ")");
        }
        ValueSource vv = argParser.parse(this);
        if (!(vv instanceof AggValueSource)) {
            if (argParser == null) {
                throw new SyntaxError("Expected aggregation from " + id + " but got (" + vv + ") in (" + sp + ")");
            }
        }
        vs = (AggValueSource) vv;
    }
    if (hasParen) {
        sp.expect(")");
    }
    if ((flags & FLAG_CONSUME_DELIMITER) != 0) {
        consumeArgumentDelimiter();
    }
    return vs;
}
Also used : ValueSource(org.apache.lucene.queries.function.ValueSource) AggValueSource(org.apache.solr.search.facet.AggValueSource) AggValueSource(org.apache.solr.search.facet.AggValueSource)

Aggregations

ValueSource (org.apache.lucene.queries.function.ValueSource)1 AggValueSource (org.apache.solr.search.facet.AggValueSource)1