lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject [39/50] lucene-solr:feature/autoscaling_72: TestRerankBase.getModelInJson to permit empty features array.
Date Mon, 18 Sep 2017 16:25:13 GMT
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 <cpoerschke@apache.org>
Authored: Mon Sep 11 12:41:19 2017 -0700
Committer: Christine Poerschke <cpoerschke@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");


Mime
View raw message