Search in sources :

Example 71 with SolrParams

use of org.apache.solr.common.params.SolrParams in project lucene-solr by apache.

the class ConcurrentUpdateSolrClient method request.

@Override
public NamedList<Object> request(final SolrRequest request, String collection) throws SolrServerException, IOException {
    if (!(request instanceof UpdateRequest)) {
        return client.request(request, collection);
    }
    UpdateRequest req = (UpdateRequest) request;
    // this happens for commit...
    if (streamDeletes) {
        if ((req.getDocuments() == null || req.getDocuments().isEmpty()) && (req.getDeleteById() == null || req.getDeleteById().isEmpty()) && (req.getDeleteByIdMap() == null || req.getDeleteByIdMap().isEmpty())) {
            if (req.getDeleteQuery() == null) {
                blockUntilFinished();
                return client.request(request, collection);
            }
        }
    } else {
        if ((req.getDocuments() == null || req.getDocuments().isEmpty())) {
            blockUntilFinished();
            return client.request(request, collection);
        }
    }
    SolrParams params = req.getParams();
    if (params != null) {
        // check if it is waiting for the searcher
        if (params.getBool(UpdateParams.WAIT_SEARCHER, false)) {
            log.info("blocking for commit/optimize");
            // empty the queue
            blockUntilFinished();
            return client.request(request, collection);
        }
    }
    try {
        CountDownLatch tmpLock = lock;
        if (tmpLock != null) {
            tmpLock.await();
        }
        Update update = new Update(req, collection);
        boolean success = queue.offer(update);
        for (; ; ) {
            synchronized (runners) {
                // is filling up, allow 1 add'l runner to help process the queue
                if (runners.isEmpty() || (queue.remainingCapacity() < queue.size() && runners.size() < threadCount)) {
                    // We need more runners, so start a new one.
                    addRunner();
                } else {
                    // conditions.
                    if (success)
                        break;
                }
            }
            //
            if (!success) {
                success = queue.offer(update, 100, TimeUnit.MILLISECONDS);
            }
        }
    } catch (InterruptedException e) {
        log.error("interrupted", e);
        throw new IOException(e.getLocalizedMessage());
    }
    // RETURN A DUMMY result
    NamedList<Object> dummy = new NamedList<>();
    dummy.add("NOTE", "the request is processed in a background stream");
    return dummy;
}
Also used : UpdateRequest(org.apache.solr.client.solrj.request.UpdateRequest) NamedList(org.apache.solr.common.util.NamedList) SolrParams(org.apache.solr.common.params.SolrParams) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) IOException(java.io.IOException) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 72 with SolrParams

use of org.apache.solr.common.params.SolrParams in project lucene-solr by apache.

the class TestTolerantUpdateProcessorRandomCloud method allDocs.

/** uses a Cursor to iterate over every doc in the index, recording the 'id_i' value in a BitSet */
private static final BitSet allDocs(final SolrClient c, final int maxDocIdExpected) throws Exception {
    BitSet docs = new BitSet(maxDocIdExpected + 1);
    String cursorMark = CURSOR_MARK_START;
    int docsOnThisPage = Integer.MAX_VALUE;
    while (0 < docsOnThisPage) {
        final SolrParams p = params("q", "*:*", "rows", "100", // note: not numeric, but we don't actual care about the order
        "sort", "id asc", CURSOR_MARK_PARAM, cursorMark);
        QueryResponse rsp = c.query(p);
        cursorMark = rsp.getNextCursorMark();
        docsOnThisPage = 0;
        for (SolrDocument doc : rsp.getResults()) {
            docsOnThisPage++;
            int id_i = ((Integer) doc.get("id_i")).intValue();
            assertTrue("found id_i bigger then expected " + maxDocIdExpected + ": " + id_i, id_i <= maxDocIdExpected);
            docs.set(id_i);
        }
        cursorMark = rsp.getNextCursorMark();
    }
    return docs;
}
Also used : SolrDocument(org.apache.solr.common.SolrDocument) QueryResponse(org.apache.solr.client.solrj.response.QueryResponse) BitSet(java.util.BitSet) SolrParams(org.apache.solr.common.params.SolrParams)

Example 73 with SolrParams

use of org.apache.solr.common.params.SolrParams in project lucene-solr by apache.

the class TestReplicationHandler method watchCoreStartAt.

/**
   * Polls the SolrCore stats using the specified client until the "startTime" 
   * time for collection is after the specified "min".  Will loop for 
   * at most "timeout" milliseconds before throwing an assertion failure.
   * 
   * @param client The SolrClient to poll
   * @param timeout the max milliseconds to continue polling for
   * @param min the startTime value must exceed this value before the method will return, if null this method will return the first startTime value encountered.
   * @return the startTime value of collection
   */
private Date watchCoreStartAt(SolrClient client, final long timeout, final Date min) throws InterruptedException, IOException, SolrServerException {
    final long sleepInterval = 200;
    long timeSlept = 0;
    try (HttpSolrClient adminClient = adminClient(client)) {
        SolrParams p = params("action", "status", "core", "collection1");
        while (timeSlept < timeout) {
            QueryRequest req = new QueryRequest(p);
            req.setPath("/admin/cores");
            try {
                NamedList data = adminClient.request(req);
                for (String k : new String[] { "status", "collection1" }) {
                    Object o = data.get(k);
                    assertNotNull("core status rsp missing key: " + k, o);
                    data = (NamedList) o;
                }
                Date startTime = (Date) data.get("startTime");
                assertNotNull("core has null startTime", startTime);
                if (null == min || startTime.after(min)) {
                    return startTime;
                }
            } catch (SolrException e) {
                // workarround for SOLR-4668
                if (500 != e.code()) {
                    throw e;
                }
            // else server possibly from the core reload in progress...
            }
            timeSlept += sleepInterval;
            Thread.sleep(sleepInterval);
        }
        fail("timed out waiting for collection1 startAt time to exceed: " + min);
        // compilation neccessity
        return min;
    }
}
Also used : HttpSolrClient(org.apache.solr.client.solrj.impl.HttpSolrClient) QueryRequest(org.apache.solr.client.solrj.request.QueryRequest) NamedList(org.apache.solr.common.util.NamedList) SolrParams(org.apache.solr.common.params.SolrParams) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) Date(java.util.Date) SolrException(org.apache.solr.common.SolrException)

Example 74 with SolrParams

use of org.apache.solr.common.params.SolrParams in project lucene-solr by apache.

the class TestSQLHandler method testSelectDistinctFacets.

private void testSelectDistinctFacets() throws Exception {
    try {
        CloudJettyRunner jetty = this.cloudJettys.get(0);
        del("*:*");
        commit();
        indexr("id", "1", "text", "XXXX XXXX", "str_s", "a", "field_i", "1");
        indexr("id", "2", "text", "XXXX XXXX", "str_s", "b", "field_i", "2");
        indexr("id", "3", "text", "XXXX XXXX", "str_s", "a", "field_i", "20");
        indexr("id", "4", "text", "XXXX XXXX", "str_s", "b", "field_i", "2");
        indexr("id", "5", "text", "XXXX XXXX", "str_s", "c", "field_i", "30");
        indexr("id", "6", "text", "XXXX XXXX", "str_s", "c", "field_i", "30");
        indexr("id", "7", "text", "XXXX XXXX", "str_s", "c", "field_i", "50");
        indexr("id", "8", "text", "XXXX XXXX", "str_s", "c", "field_i", "60");
        commit();
        SolrParams sParams = mapParams(CommonParams.QT, "/sql", "aggregationMode", "facet", "stmt", "select distinct str_s, field_i from collection1 order by str_s asc, field_i asc");
        System.out.println("######## selectDistinctFacets #######");
        SolrStream solrStream = new SolrStream(jetty.url, sParams);
        List<Tuple> tuples = getTuples(solrStream);
        //assert(false);
        assert (tuples.size() == 6);
        Tuple tuple;
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 1);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 20);
        tuple = tuples.get(2);
        assert (tuple.get("str_s").equals("b"));
        assert (tuple.getLong("field_i") == 2);
        tuple = tuples.get(3);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 30);
        tuple = tuples.get(4);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 50);
        tuple = tuples.get(5);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 60);
        //reverse the sort
        sParams = mapParams(CommonParams.QT, "/sql", "aggregationMode", "facet", "stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 6);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 60);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 50);
        tuple = tuples.get(2);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 30);
        tuple = tuples.get(3);
        assert (tuple.get("str_s").equals("b"));
        assert (tuple.getLong("field_i") == 2);
        tuple = tuples.get(4);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 20);
        tuple = tuples.get(5);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 1);
        //reverse the sort
        sParams = mapParams(CommonParams.QT, "/sql", "aggregationMode", "facet", "stmt", "select distinct str_s as myString, field_i as myInt from collection1 order by str_s desc, myInt desc");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 6);
        tuple = tuples.get(0);
        assert (tuple.get("myString").equals("c"));
        assert (tuple.getLong("myInt") == 60);
        tuple = tuples.get(1);
        assert (tuple.get("myString").equals("c"));
        assert (tuple.getLong("myInt") == 50);
        tuple = tuples.get(2);
        assert (tuple.get("myString").equals("c"));
        assert (tuple.getLong("myInt") == 30);
        tuple = tuples.get(3);
        assert (tuple.get("myString").equals("b"));
        assert (tuple.getLong("myInt") == 2);
        tuple = tuples.get(4);
        assert (tuple.get("myString").equals("a"));
        assert (tuple.getLong("myInt") == 20);
        tuple = tuples.get(5);
        assert (tuple.get("myString").equals("a"));
        assert (tuple.getLong("myInt") == 1);
        //test with limit
        sParams = mapParams(CommonParams.QT, "/sql", "aggregationMode", "facet", "stmt", "select distinct str_s, field_i from collection1 order by str_s desc, field_i desc limit 2");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 2);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 60);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 50);
        // Test without a sort. Sort should be asc by default.
        sParams = mapParams(CommonParams.QT, "/sql", "aggregationMode", "facet", "stmt", "select distinct str_s, field_i from collection1");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 6);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 1);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 20);
        tuple = tuples.get(2);
        assert (tuple.get("str_s").equals("b"));
        assert (tuple.getLong("field_i") == 2);
        tuple = tuples.get(3);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 30);
        tuple = tuples.get(4);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 50);
        tuple = tuples.get(5);
        assert (tuple.get("str_s").equals("c"));
        assert (tuple.getLong("field_i") == 60);
        // Test with a predicate.
        sParams = mapParams(CommonParams.QT, "/sql", "aggregationMode", "facet", "stmt", "select distinct str_s, field_i from collection1 where str_s = 'a'");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 2);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 1);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("a"));
        assert (tuple.getLong("field_i") == 20);
    } finally {
        delete();
    }
}
Also used : SolrParams(org.apache.solr.common.params.SolrParams) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) SolrStream(org.apache.solr.client.solrj.io.stream.SolrStream) Tuple(org.apache.solr.client.solrj.io.Tuple)

Example 75 with SolrParams

use of org.apache.solr.common.params.SolrParams in project lucene-solr by apache.

the class TestSQLHandler method testParallelBasicGrouping.

private void testParallelBasicGrouping() throws Exception {
    try {
        CloudJettyRunner jetty = this.cloudJettys.get(0);
        del("*:*");
        commit();
        indexr("id", "1", "text", "XXXX XXXX", "str_s", "a", "field_i", "7");
        indexr("id", "2", "text", "XXXX XXXX", "str_s", "b", "field_i", "8");
        indexr("id", "3", "text", "XXXX XXXX", "str_s", "a", "field_i", "20");
        indexr("id", "4", "text", "XXXX XXXX", "str_s", "b", "field_i", "11");
        indexr("id", "5", "text", "XXXX XXXX", "str_s", "c", "field_i", "30");
        indexr("id", "6", "text", "XXXX XXXX", "str_s", "c", "field_i", "40");
        indexr("id", "7", "text", "XXXX XXXX", "str_s", "c", "field_i", "50");
        indexr("id", "8", "text", "XXXX XXXX", "str_s", "c", "field_i", "60");
        commit();
        SolrParams sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s " + "order by sum(field_i) asc limit 2");
        SolrStream solrStream = new SolrStream(jetty.url, sParams);
        List<Tuple> tuples = getTuples(solrStream);
        //Only two results because of the limit.
        assert (tuples.size() == 2);
        Tuple tuple;
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 10);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("a"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 27);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 7);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 20);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 14);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), " + "cast(avg(1.0 * field_i) as float) from collection1 where text='XXXX' group by str_s " + "order by sum(field_i) asc limit 2");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        //Only two results because of the limit.
        assert (tuples.size() == 2);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 9.5);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("a"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 27);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 7);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 20);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 13.5);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i) as mySum, min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s order by mySum asc limit 2");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        //Only two results because of the limit.
        assert (tuples.size() == 2);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        assert (tuple.getDouble("mySum") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 10);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("a"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        assert (tuple.getDouble("mySum") == 27);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 7);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 20);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 14);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s order by str_s desc");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 3);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("c"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 4);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 180);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 30);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 60);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 45);
        tuple = tuples.get(1);
        assert (tuple.get("str_s").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 10);
        tuple = tuples.get(2);
        assert (tuple.get("str_s").equals("a"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 27);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 7);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 20);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 14);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s as myString, count(*), sum(field_i), min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s order by myString desc");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 3);
        tuple = tuples.get(0);
        assert (tuple.get("myString").equals("c"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 4);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 180);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 30);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 60);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 45);
        tuple = tuples.get(1);
        assert (tuple.get("myString").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 10);
        tuple = tuples.get(2);
        assert (tuple.get("myString").equals("a"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 27);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 7);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 20);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 14);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s having sum(field_i) = 19");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 1);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 10);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s " + "having ((sum(field_i) = 19) AND (min(field_i) = 8))");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 1);
        tuple = tuples.get(0);
        assert (tuple.get("str_s").equals("b"));
        //count(*)
        assert (tuple.getDouble("EXPR$1") == 2);
        //sum(field_i)
        assert (tuple.getDouble("EXPR$2") == 19);
        //min(field_i)
        assert (tuple.getDouble("EXPR$3") == 8);
        //max(field_i)
        assert (tuple.getDouble("EXPR$4") == 11);
        //avg(field_i)
        assert (tuple.getDouble("EXPR$5") == 10);
        sParams = mapParams(CommonParams.QT, "/sql", "numWorkers", "2", "aggregationMode", "map_reduce", "stmt", "select str_s, count(*), sum(field_i), min(field_i), max(field_i), " + "avg(field_i) from collection1 where text='XXXX' group by str_s " + "having ((sum(field_i) = 19) AND (min(field_i) = 100))");
        solrStream = new SolrStream(jetty.url, sParams);
        tuples = getTuples(solrStream);
        assert (tuples.size() == 0);
    } finally {
        delete();
    }
}
Also used : SolrParams(org.apache.solr.common.params.SolrParams) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) SolrStream(org.apache.solr.client.solrj.io.stream.SolrStream) Tuple(org.apache.solr.client.solrj.io.Tuple)

Aggregations

SolrParams (org.apache.solr.common.params.SolrParams)310 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)179 SolrException (org.apache.solr.common.SolrException)78 Test (org.junit.Test)45 Tuple (org.apache.solr.client.solrj.io.Tuple)43 SolrDocument (org.apache.solr.common.SolrDocument)42 ArrayList (java.util.ArrayList)41 NamedList (org.apache.solr.common.util.NamedList)40 MapSolrParams (org.apache.solr.common.params.MapSolrParams)37 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)37 IOException (java.io.IOException)35 SolrDocumentList (org.apache.solr.common.SolrDocumentList)34 HashMap (java.util.HashMap)33 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)30 SolrClientCache (org.apache.solr.client.solrj.io.SolrClientCache)27 UpdateRequest (org.apache.solr.client.solrj.request.UpdateRequest)26 SimpleOrderedMap (org.apache.solr.common.util.SimpleOrderedMap)24 Map (java.util.Map)22 SolrIndexSearcher (org.apache.solr.search.SolrIndexSearcher)22 SolrCore (org.apache.solr.core.SolrCore)20