[
https://issues.apache.org/jira/browse/SOLR-10703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16155751#comment-16155751
]
ASF GitHub Bot commented on SOLR-10703:
---------------------------------------
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?
> DocTransformer implements Closeable
> -----------------------------------
>
> Key: SOLR-10703
> URL: https://issues.apache.org/jira/browse/SOLR-10703
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Diego Ceccarelli
> Priority: Minor
> Fix For: 7.0
>
>
> This patch -adds a {{prepare}} and a {{finish}} method to the interface of
> {{DocTransformer}}- allowing a developer to perform actions before/after a
> doc transformer is applied to a result set. My use case was to benchmark the
> performance of a transformer, since transformer time is not part of
> {{QTime}}.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]