[
https://issues.apache.org/jira/browse/SOLR-12315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16908044#comment-16908044
]
Chongchen Chen commented on SOLR-12315:
---------------------------------------
I tried to reproduce your problem, but failed. here's my unit test code.
can you give me your files in solr.home .
{code:java}
package org.apache.solr.cloud;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.stream.Stream;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.Group;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputDocument;
import org.junit.BeforeClass;
import org.junit.Test;
public class NumStableTest extends SolrCloudTestCase {
private static final String COLLECTION = "num_stable" ;
private static final int numShards = 3;
private static final int numReplicas = 2;
private static final int maxShardsPerNode = 2;
private static final int nodeCount = (numShards*numReplicas +
(maxShardsPerNode-1))/maxShardsPerNode;
private static final String id = "id";
private static final int docNum = 200;
@BeforeClass
public static void setupCluster() throws Exception {
// create and configure cluster
configureCluster(nodeCount)
.addConfig("conf", configset("cloud-dynamic"))
.configure();
// create an empty collection
CollectionAdminRequest.createCollection(COLLECTION, "conf", numShards,
numReplicas)
.setMaxShardsPerNode(maxShardsPerNode)
.process(cluster.getSolrClient());
Random rnd = random();
UpdateRequest r = new UpdateRequest();
// add documents
for(int i = 0; i < docNum; i++){
SolrInputDocument doc = sdoc(id, "1",
"monthly_payment_i", "" + rnd.nextInt(1000),
"score_d", "" + rnd.nextInt(1000),
"car_age_id_i", "" + rnd.nextInt(1000),
"car_variant_and_offer_type_s1", "" + rnd.nextInt(4));
r.add(doc);
}
r.commit(cluster.getSolrClient(), COLLECTION);
}
@Test
public void testNumStable() throws Exception {
String[] params = {
"q", "*:*",
"fl", "id",
"group.sort", "monthly_payment_i asc, score_d desc",
"group.limit", "100",
"sort", "car_age_id_i asc, score_d desc",
"debugQuery", "on",
"group.field", "car_variant_and_offer_type_s1",
"group", "true"
};
final SolrQuery solrQuery1 = new SolrQuery("rows","2", params);
final SolrQuery solrQuery2 = new SolrQuery("rows", "6", params);
final CloudSolrClient cloudSolrClient = cluster.getSolrClient();
final QueryResponse rsp1 = cloudSolrClient.query(COLLECTION, solrQuery1);
final QueryResponse rsp2 = cloudSolrClient.query(COLLECTION, solrQuery2);
final List<Group> grp1 =
rsp1.getGroupResponse().getValues().get(0).getValues();
final List<Group> grp2 =
rsp2.getGroupResponse().getValues().get(0).getValues();
assertEquals(grp1.size(), grp2.size());
int groupNum = grp1.size();
for(int i = 0; i < groupNum; i++){
Group g1 = grp1.get(i);
Group g2 = grp2.get(i);
assertEquals(g1.getResult().getNumFound(), g2.getResult().getNumFound());
}
}
}
{code}
> the number of docs in each group depends on rows
> ------------------------------------------------
>
> Key: SOLR-12315
> URL: https://issues.apache.org/jira/browse/SOLR-12315
> Project: Solr
> Issue Type: Bug
> Components: search
> Affects Versions: 7.1
> Reporter: Duo Chen
> Priority: Critical
> Attachments: difference.jpeg
>
>
> Hi,
> We used Solr Cloud 7.1.0(3 nodes, 3 shards with 2 replicas). When we used
> group query, we found that the number of docs in each group depends on the
> rows number(group number).
> When the rows bigger then 5, the return docs are correct and stable, for the
> rest, the number of docs is smaller than the actual result.
> Could you please explain why and give me some suggestion about how to decide
> the rows number?
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]