I have a gradle project in which I posted an xml file to solr. when searching any keyword through select query(in browser), I get the desired result. But when I do the same thing in my test case, it doesn’t search anything and give back the result as numFound=0 due to which my test case fails.
this is my test case:
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.request.SolrQueryRequest;
import org.junit.BeforeClass;
import org.junit.Test;
public class SolrQueriesTest extends SolrTestCaseJ4 {
@BeforeClass
public static void initTestCore() throws Exception {
SolrTestCaseJ4.initCore("./solrhome/collection1/conf/solrconfig.xml", "./solrhome/collection1/conf/schema.xml", "./solrhome/");
}
private static SolrQueryRequest facetRequest(String filter) {
return req("qt", "/select", "q", filter);
}
@Test
public void findAll() {
assertQ(facetRequest("Dress"),
"//result[@numFound='1']");
}
}