You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/09/18 16:25:13 UTC

[39/50] lucene-solr:feature/autoscaling_72: TestRerankBase.getModelInJson to permit empty features array.

TestRerankBase.getModelInJson to permit empty features array.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/708ed8fb
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/708ed8fb
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/708ed8fb

Branch: refs/heads/feature/autoscaling_72
Commit: 708ed8fb4880bf1a7dcb9211f4eb1923bdd325d8
Parents: 0c831b9
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Sep 11 12:41:19 2017 -0700
Committer: Christine Poerschke <cp...@apache.org>
Committed: Mon Sep 11 12:47:44 2017 -0700

----------------------------------------------------------------------
 .../src/test/org/apache/solr/ltr/TestRerankBase.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/708ed8fb/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java
index 6f5e0ce..796fe39 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java
@@ -239,12 +239,14 @@ public class TestRerankBase extends RestTestBase {
         .append(",\n");
     sb.append("\"class\":").append('"').append(type).append('"').append(",\n");
     sb.append("\"features\":").append('[');
-    for (final String feature : features) {
-      sb.append("\n\t{ ");
-      sb.append("\"name\":").append('"').append(feature).append('"')
-          .append("},");
+    if (features.length > 0) {
+      for (final String feature : features) {
+        sb.append("\n\t{ ");
+        sb.append("\"name\":").append('"').append(feature).append('"')
+        .append("},");
+      }
+      sb.deleteCharAt(sb.length() - 1);
     }
-    sb.deleteCharAt(sb.length() - 1);
     sb.append("\n]\n");
     if (params != null) {
       sb.append(",\n");