You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2017/09/19 11:47:40 UTC

[2/2] lucene-solr:branch_7x: 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/197b22b3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/197b22b3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/197b22b3

Branch: refs/heads/branch_7x
Commit: 197b22b39cb2d211e5ef938f8405254580b7b29c
Parents: 89c9f62
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Sep 11 12:41:19 2017 -0700
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Sep 19 11:14:17 2017 +0100

----------------------------------------------------------------------
 .../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/197b22b3/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");