Github user tflobbe commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/202#discussion_r137335160
--- Diff:
solr/core/src/test/org/apache/solr/response/TestCustomDocTransformer.java ---
@@ -68,6 +69,51 @@ public void testCustomTransformer() throws Exception {
"//str[.='xx#title_2#']",
"//str[.='xx#title_3#']");
}
+
+ @Test
+ public void testFinishCallInCustomFinishTransformer() throws Exception {
+ // Build a simple index
+ int max = 10;
+ for(int i=0; i<max; i++) {
+ SolrInputDocument sdoc = new SolrInputDocument();
+ sdoc.addField("id", i);
+ sdoc.addField("subject", "xx");
+ sdoc.addField("title", "title_"+i);
+ updateJ(jsonAdd(sdoc), null);
+ }
+ assertU(commit());
+ assertQ(req("q", "*:*"), "//*[@numFound='" + max + "']");
+
+ assertQ( req(
+ "q", "*:*",
+ "fl", "id,[customFinish]",
+ "rows", String.valueOf(max)
+ ),
+ // Check that the concatenated fields make it in the results
+ "//*[@numFound='" + max + "']");
+
+ // finish() will double the number of documents
+ assertEquals(max*2,
CustomFinishTransformerFactory.finishTrasformer.counter);
+ CustomFinishTransformerFactory.finishTrasformer.counter = 0;
--- End diff --
Is this needed? Shouldn't setContext() set this value?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]