I found this bug in both 4.4 and 4.5

Using cloudSolrServer.setDefaultCollection(collectionId) does not work as
intended for an alias spanning more than 1 collection.
The virtual collection-alias collectionID is recoqnized as a existing
collection, but it does only query one of the collections it is mapped to.

You can confirm this easy in AliasIntegrationTest.

The test-class AliasIntegrationTest creates to cores with 2 and 3 different
documents. And then creates an alias pointing to both of them.

Line 153:
    // search with new cloud client
    CloudSolrServer cloudSolrServer = new
CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
    cloudSolrServer.setParallelUpdates(random().nextBoolean());
    query = new SolrQuery("*:*");
    query.set("collection", "testalias");
    res = cloudSolrServer.query(query);
    cloudSolrServer.shutdown();
    assertEquals(5, res.getResults().getNumFound());

No unit-test bug here, however if you change it from setting the
collectionid on the query but on CloudSolrServer instead,it will produce
the bug:

    // search with new cloud client
    CloudSolrServer cloudSolrServer = new
    CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
    cloudSolrServer.setDefaultCollection("testalias");
    cloudSolrServer.setParallelUpdates(random().nextBoolean());
    query = new SolrQuery("*:*");
    //query.set("collection", "testalias");
    res = cloudSolrServer.query(query);
    cloudSolrServer.shutdown();
    assertEquals(5, res.getResults().getNumFound());  <-- Assertion failure

Should I create a Jira issue for this?

From,
Thomas Egense

Reply via email to