mirror of https://github.com/apache/lucene.git
tests: fix request reuse and request close bugs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1666830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1da43c81b3
commit
f0cc3bfb00
|
@ -91,11 +91,13 @@ public class MoreLikeThisHandlerTest extends SolrTestCaseJ4 {
|
||||||
,"//result/doc[2]/int[@name='id'][.='43']");
|
,"//result/doc[2]/int[@name='id'][.='43']");
|
||||||
|
|
||||||
params.set(CommonParams.Q, "id:44");
|
params.set(CommonParams.Q, "id:44");
|
||||||
|
mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
|
||||||
assertQ("morelike this - harrison ford",mltreq
|
assertQ("morelike this - harrison ford",mltreq
|
||||||
,"//result/doc[1]/int[@name='id'][.='45']");
|
,"//result/doc[1]/int[@name='id'][.='45']");
|
||||||
|
|
||||||
// test MoreLikeThis debug
|
// test MoreLikeThis debug
|
||||||
params.set(CommonParams.DEBUG_QUERY, "true");
|
params.set(CommonParams.DEBUG_QUERY, "true");
|
||||||
|
mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
|
||||||
assertQ("morelike this - harrison ford",mltreq
|
assertQ("morelike this - harrison ford",mltreq
|
||||||
,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='rawMLTQuery']"
|
,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='rawMLTQuery']"
|
||||||
,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='boostedMLTQuery']"
|
,"//lst[@name='debug']/lst[@name='moreLikeThis']/lst[@name='44']/str[@name='boostedMLTQuery']"
|
||||||
|
@ -106,11 +108,13 @@ public class MoreLikeThisHandlerTest extends SolrTestCaseJ4 {
|
||||||
// test that qparser plugins work
|
// test that qparser plugins work
|
||||||
params.remove(CommonParams.DEBUG_QUERY);
|
params.remove(CommonParams.DEBUG_QUERY);
|
||||||
params.set(CommonParams.Q, "{!field f=id}44");
|
params.set(CommonParams.Q, "{!field f=id}44");
|
||||||
|
mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
|
||||||
assertQ(mltreq
|
assertQ(mltreq
|
||||||
,"//result/doc[1]/int[@name='id'][.='45']");
|
,"//result/doc[1]/int[@name='id'][.='45']");
|
||||||
|
|
||||||
params.set(CommonParams.Q, "id:42");
|
params.set(CommonParams.Q, "id:42");
|
||||||
params.set(MoreLikeThisParams.QF,"name^5.0 subword^0.1");
|
params.set(MoreLikeThisParams.QF,"name^5.0 subword^0.1");
|
||||||
|
mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
|
||||||
assertQ("morelikethis with weights",mltreq
|
assertQ("morelikethis with weights",mltreq
|
||||||
,"//result/doc[1]/int[@name='id'][.='43']"
|
,"//result/doc[1]/int[@name='id'][.='43']"
|
||||||
,"//result/doc[2]/int[@name='id'][.='46']");
|
,"//result/doc[2]/int[@name='id'][.='46']");
|
||||||
|
@ -119,12 +123,14 @@ public class MoreLikeThisHandlerTest extends SolrTestCaseJ4 {
|
||||||
// test that qparser plugins work w/ the MoreLikeThisHandler
|
// test that qparser plugins work w/ the MoreLikeThisHandler
|
||||||
params.set(CommonParams.QT, "/mlt");
|
params.set(CommonParams.QT, "/mlt");
|
||||||
params.set(CommonParams.Q, "{!field f=id}44");
|
params.set(CommonParams.Q, "{!field f=id}44");
|
||||||
|
mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
|
||||||
assertQ(mltreq
|
assertQ(mltreq
|
||||||
,"//result/doc[1]/int[@name='id'][.='45']");
|
,"//result/doc[1]/int[@name='id'][.='45']");
|
||||||
|
|
||||||
// test that debugging works (test for MoreLikeThis*Handler*)
|
// test that debugging works (test for MoreLikeThis*Handler*)
|
||||||
params.set(CommonParams.QT, "/mlt");
|
params.set(CommonParams.QT, "/mlt");
|
||||||
params.set(CommonParams.DEBUG_QUERY, "true");
|
params.set(CommonParams.DEBUG_QUERY, "true");
|
||||||
|
mltreq.close(); mltreq = new LocalSolrQueryRequest(h.getCore(), params);
|
||||||
assertQ(mltreq
|
assertQ(mltreq
|
||||||
,"//result/doc[1]/int[@name='id'][.='45']"
|
,"//result/doc[1]/int[@name='id'][.='45']"
|
||||||
,"//lst[@name='debug']/lst[@name='explain']"
|
,"//lst[@name='debug']/lst[@name='explain']"
|
||||||
|
@ -134,5 +140,6 @@ public class MoreLikeThisHandlerTest extends SolrTestCaseJ4 {
|
||||||
// String response = h.query(mltreq);
|
// String response = h.query(mltreq);
|
||||||
// System.out.println(response);
|
// System.out.println(response);
|
||||||
|
|
||||||
|
mltreq.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue