mirror of https://github.com/apache/lucene.git
additional distributed faceting tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@638529 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d0a0cacbcd
commit
bd79f33d0a
|
@ -20,6 +20,7 @@ package org.apache.solr;
|
|||
import org.apache.solr.client.solrj.SolrServer;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.SolrResponse;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||
|
@ -65,6 +66,9 @@ public class TestDistributedSearch extends TestCase {
|
|||
String id="id";
|
||||
String t1="a_t";
|
||||
String i1="a_i";
|
||||
String oddField="oddField_s";
|
||||
String missingField="missing_but_valid_field_t";
|
||||
String invalidField="invalid_field_not_in_schema";
|
||||
|
||||
|
||||
@Override public void setUp() throws Exception
|
||||
|
@ -434,6 +438,7 @@ public class TestDistributedSearch extends TestCase {
|
|||
index(id,10, i1, 4321 ,t1,"this too shal pass");
|
||||
index(id,11, i1, -987 ,t1,"An eye for eye only ends up making the whole world blind.");
|
||||
index(id,12, i1, 379 ,t1,"Great works are performed, not by strength, but by perseverance.");
|
||||
index(id,13, i1, 232 ,t1,"no eggs on wall, lesson learned", oddField, "odd man out");
|
||||
|
||||
commit();
|
||||
|
||||
|
@ -476,9 +481,20 @@ public class TestDistributedSearch extends TestCase {
|
|||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.query","quick", "facet.query","all", "facet.query","*:*");
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.offset",1);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1,"facet.mincount",2);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field","missing_field_t","facet.mincount",2);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.mincount",2);
|
||||
|
||||
// test field that is valid in schema but missing in all shards
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",missingField, "facet.mincount",2);
|
||||
// test field that is valid in schema and missing in some shards
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",oddField, "facet.mincount",2);
|
||||
|
||||
try {
|
||||
// test error produced for field that is invalid for schema
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",invalidField, "facet.mincount",2);
|
||||
fail("SolrServerException expected for invalid field that is not in schema");
|
||||
} catch (SolrServerException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
// index the same document to two servers and make sure things
|
||||
// don't blow up.
|
||||
|
|
|
@ -40,10 +40,7 @@ import org.apache.solr.core.MultiCore;
|
|||
import org.apache.solr.core.SolrConfig;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.core.SolrResourceLoader;
|
||||
import org.apache.solr.request.QueryResponseWriter;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.request.SolrQueryResponse;
|
||||
import org.apache.solr.request.SolrRequestHandler;
|
||||
import org.apache.solr.request.*;
|
||||
import org.apache.solr.servlet.cache.HttpCacheHeaderUtil;
|
||||
import org.apache.solr.servlet.cache.Method;
|
||||
|
||||
|
@ -285,12 +282,19 @@ public class SolrDispatchFilter implements Filter
|
|||
// Now write it out
|
||||
QueryResponseWriter responseWriter = core.getQueryResponseWriter(solrReq);
|
||||
response.setContentType(responseWriter.getContentType(solrReq, solrRsp));
|
||||
if (Method.HEAD != Method.getMethod(req.getMethod())) {
|
||||
PrintWriter out = response.getWriter();
|
||||
responseWriter.write(out, solrReq, solrRsp);
|
||||
if (Method.HEAD != Method.getMethod(req.getMethod())) {
|
||||
if (responseWriter instanceof BinaryQueryResponseWriter) {
|
||||
BinaryQueryResponseWriter binWriter = (BinaryQueryResponseWriter) responseWriter;
|
||||
binWriter.write(response.getOutputStream(), solrReq, solrRsp);
|
||||
} else {
|
||||
PrintWriter out = response.getWriter();
|
||||
responseWriter.write(out, solrReq, solrRsp);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//else http HEAD request, nothing to write out, waited this long just to get ContentType
|
||||
}
|
||||
//else http HEAD request, nothing to write out, waited this long just to get ContentType
|
||||
}
|
||||
}
|
||||
return; // we are done with a valid handler
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue