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 2021/02/01 18:32:58 UTC

[lucene-solr] branch branch_8x updated: SOLR-15115: Remove unused methods from TestRerankBase (#2261)

This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 95c3a3f  SOLR-15115: Remove unused methods from TestRerankBase (#2261)
95c3a3f is described below

commit 95c3a3f87f653b1ba0f22d9e1b662e649845ad2a
Author: AndrĂ¡s Salamon <an...@melda.info>
AuthorDate: Mon Feb 1 18:31:58 2021 +0100

    SOLR-15115: Remove unused methods from TestRerankBase (#2261)
---
 .../test/org/apache/solr/ltr/TestRerankBase.java   | 52 ----------------------
 1 file changed, 52 deletions(-)

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 bf35d3d..4e397a5 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
@@ -17,7 +17,6 @@
 package org.apache.solr.ltr;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.lang.invoke.MethodHandles;
 import java.net.URL;
 import java.nio.file.Files;
@@ -28,7 +27,6 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Scanner;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
@@ -40,7 +38,6 @@ import org.apache.solr.ltr.feature.Feature;
 import org.apache.solr.ltr.feature.FeatureException;
 import org.apache.solr.ltr.feature.ValueFeature;
 import org.apache.solr.ltr.model.LTRScoringModel;
-import org.apache.solr.ltr.model.LinearModel;
 import org.apache.solr.ltr.model.ModelException;
 import org.apache.solr.ltr.store.FeatureStore;
 import org.apache.solr.ltr.store.rest.ManagedFeatureStore;
@@ -391,24 +388,6 @@ public class TestRerankBase extends RestTestBase {
     return getFeatures(Arrays.asList(names));
   }
 
-  protected static void loadModelAndFeatures(String name, int allFeatureCount,
-      int modelFeatureCount) throws Exception {
-    final String[] features = new String[modelFeatureCount];
-    final String[] weights = new String[modelFeatureCount];
-    for (int i = 0; i < allFeatureCount; i++) {
-      final String featureName = "c" + i;
-      if (i < modelFeatureCount) {
-        features[i] = featureName;
-        weights[i] = "\"" + featureName + "\":1.0";
-      }
-      loadFeature(featureName, ValueFeature.ValueFeatureWeight.class.getCanonicalName(),
-          "{\"value\":" + i + "}");
-    }
-
-    loadModel(name, LinearModel.class.getCanonicalName(), features,
-        "{\"weights\":{" + String.join(",", weights) + "}}");
-  }
-
   protected static void bulkIndex() throws Exception {
     assertU(adoc("title", "bloomberg different bla", "description",
         "bloomberg", "id", "6", "popularity", "1"));
@@ -421,37 +400,6 @@ public class TestRerankBase extends RestTestBase {
     assertU(commit());
   }
 
-  protected static void buildIndexUsingAdoc(String filepath)
-      throws FileNotFoundException {
-    final Scanner scn = new Scanner(new File(filepath), "UTF-8");
-    StringBuffer buff = new StringBuffer();
-    scn.nextLine();
-    scn.nextLine();
-    scn.nextLine(); // Skip the first 3 lines then add everything else
-    final ArrayList<String> docsToAdd = new ArrayList<String>();
-    while (scn.hasNext()) {
-      String curLine = scn.nextLine();
-      if (curLine.contains("</doc>")) {
-        buff.append(curLine + "\n");
-        docsToAdd.add(buff.toString().replace("</add>", "")
-            .replace("<doc>", "<add>\n<doc>")
-            .replace("</doc>", "</doc>\n</add>"));
-        if (!scn.hasNext()) {
-          break;
-        } else {
-          curLine = scn.nextLine();
-        }
-        buff = new StringBuffer();
-      }
-      buff.append(curLine + "\n");
-    }
-    for (final String doc : docsToAdd) {
-      assertU(doc.trim());
-    }
-    assertU(commit());
-    scn.close();
-  }
-
   protected static void doTestParamsToMap(String featureClassName,
       LinkedHashMap<String,Object> featureParams) throws Exception {