[
https://issues.apache.org/jira/browse/SOLR-10703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16155752#comment-16155752
]
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_r137335378
--- Diff:
solr/core/src/test/org/apache/solr/response/TestCustomDocTransformer.java ---
@@ -125,4 +171,86 @@ public static String getAsString(String field,
SolrDocument doc) {
}
return null;
}
+
+
+ public static class CustomFinishTransformerFactory extends
TransformerFactory {
+
+ static CustomFinishTransformer finishTrasformer = new
CustomFinishTransformer();
+
+ @Override
+ public DocTransformer create(String field, SolrParams params,
SolrQueryRequest req) {
+ return finishTrasformer;
+ }
+ }
+
+
+ public static class CustomFinishTransformer extends DocTransformer {
+ int counter;
+
+ public CustomFinishTransformer() {
+ }
+
+ @Override
+ public void setContext(ResultContext context){
+ super.setContext(context);
+ counter = 0;
+ }
+
+ @Override
+ public String getName() {
+ return "customFinish";
+ }
+
+ @Override
+ public void transform(SolrDocument doc, int docid) throws IOException {
+ counter++;
--- End diff --
Suggestion. Throw exception if close() was already called in this request
> 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]