mirror of https://github.com/apache/lucene.git
tests: close requests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eee3b95d88
commit
1bb9ec73e2
|
@ -25,6 +25,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
|
|||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.client.solrj.request.FieldAnalysisRequest;
|
||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -66,7 +67,8 @@ public class FieldAnalysisRequestHandlerTest extends AnalysisRequestHandlerTestB
|
|||
params.add(AnalysisParams.FIELD_VALUE, "the quick red fox jumped over the lazy brown dogs");
|
||||
params.add(CommonParams.Q, "fox brown");
|
||||
|
||||
FieldAnalysisRequest request = handler.resolveAnalysisRequest(new LocalSolrQueryRequest(h.getCore(), params));
|
||||
SolrQueryRequest req = new LocalSolrQueryRequest(h.getCore(), params);
|
||||
FieldAnalysisRequest request = handler.resolveAnalysisRequest(req);
|
||||
List<String> fieldNames = request.getFieldNames();
|
||||
assertEquals("Expecting 2 field names", 2, fieldNames.size());
|
||||
assertEquals("text", fieldNames.get(0));
|
||||
|
@ -78,25 +80,35 @@ public class FieldAnalysisRequestHandlerTest extends AnalysisRequestHandlerTestB
|
|||
assertEquals("the quick red fox jumped over the lazy brown dogs", request.getFieldValue());
|
||||
assertEquals("fox brown", request.getQuery());
|
||||
assertFalse(request.isShowMatch());
|
||||
req.close();
|
||||
|
||||
// testing overide of query value using analysis.query param
|
||||
params.add(AnalysisParams.QUERY, "quick lazy");
|
||||
request = handler.resolveAnalysisRequest(new LocalSolrQueryRequest(h.getCore(), params));
|
||||
req=new LocalSolrQueryRequest(h.getCore(), params);
|
||||
request = handler.resolveAnalysisRequest(req);
|
||||
assertEquals("quick lazy", request.getQuery());
|
||||
req.close();
|
||||
|
||||
// testing analysis.showmatch param
|
||||
params.add(AnalysisParams.SHOW_MATCH, "false");
|
||||
request = handler.resolveAnalysisRequest(new LocalSolrQueryRequest(h.getCore(), params));
|
||||
req=new LocalSolrQueryRequest(h.getCore(), params);
|
||||
request = handler.resolveAnalysisRequest(req);
|
||||
assertFalse(request.isShowMatch());
|
||||
req.close();
|
||||
|
||||
params.set(AnalysisParams.SHOW_MATCH, "true");
|
||||
request = handler.resolveAnalysisRequest(new LocalSolrQueryRequest(h.getCore(), params));
|
||||
req=new LocalSolrQueryRequest(h.getCore(), params);
|
||||
request = handler.resolveAnalysisRequest(req);
|
||||
assertTrue(request.isShowMatch());
|
||||
req.close();
|
||||
|
||||
// testing absence of query value
|
||||
params.remove(CommonParams.Q);
|
||||
params.remove(AnalysisParams.QUERY);
|
||||
request = handler.resolveAnalysisRequest(new LocalSolrQueryRequest(h.getCore(), params));
|
||||
req=new LocalSolrQueryRequest(h.getCore(), params);
|
||||
request = handler.resolveAnalysisRequest(req);
|
||||
assertNull(request.getQuery());
|
||||
req.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue