[GitHub] lucene-solr pull request #202: SOLR-10703 DocTransformer implements Closeabl...

2017-09-17 Thread diegoceccarelli
Github user diegoceccarelli commented on a diff in the pull request:

https://github.com/apache/lucene-solr/pull/202#discussion_r139309859
  
--- Diff: solr/solrj/src/java/org/apache/solr/common/util/IOUtils.java ---
@@ -31,7 +32,7 @@ public static void closeQuietly(Closeable closeable) {
 closeable.close();
   }
 } catch (Exception e) {
-  LOG.error("Error while closing", e);
+  SolrException.log(LOG, "Error while closing "+closeable.getClass());
--- End diff --

I had to modify the logging here in order to have `ignoreException` working 
in the tests. 


---

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[GitHub] lucene-solr pull request #202: SOLR-10703 DocTransformer implements Closeabl...

2017-09-06 Thread tflobbe
Github user tflobbe commented on a diff in the pull request:

https://github.com/apache/lucene-solr/pull/202#discussion_r137335651
  
--- 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

[GitHub] lucene-solr pull request #202: SOLR-10703 DocTransformer implements Closeabl...

2017-09-06 Thread tflobbe
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

[GitHub] lucene-solr pull request #202: SOLR-10703 DocTransformer implements Closeabl...

2017-09-06 Thread tflobbe
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


---

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org