lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject lucene-solr:jira/solr-8542-v2: SOLR-8542: ltr/*/*.java tweaks
Date Tue, 01 Nov 2016 17:01:39 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-8542-v2 0942859e6 -> af550f54e


SOLR-8542: ltr/*/*.java tweaks

* fix broken javadocs link
* make Normalizer.validate abstract/required instead of empty/optional
* make Feature.validate abstract/required instead of empty/optional
* make LTRThreadModule.validate private
* make LTRScoringModel.validate protected instead of public
* removed some commented out code and made some methods/members less-visible/final
* replace Sets.newHashSet with Collections.singleton
* added comment re: REST_END_POINT public-ness instead of package visibility
* removed 3 unused and 2 low-value/little-used (Feature|Model)Store methods


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

Branch: refs/heads/jira/solr-8542-v2
Commit: af550f54e5e9532200dd1d8f2d2d3004ef890b8b
Parents: 0942859
Author: Christine Poerschke <cpoerschke@apache.org>
Authored: Tue Nov 1 10:31:38 2016 +0000
Committer: Christine Poerschke <cpoerschke@apache.org>
Committed: Tue Nov 1 16:56:10 2016 +0000

----------------------------------------------------------------------
 .../src/java/org/apache/solr/ltr/LTRThreadModule.java |  2 +-
 .../src/java/org/apache/solr/ltr/feature/Feature.java | 10 ++++------
 .../apache/solr/ltr/feature/FieldLengthFeature.java   |  8 ++++++++
 .../apache/solr/ltr/feature/FieldValueFeature.java    | 12 ++++++++++--
 .../apache/solr/ltr/feature/OriginalScoreFeature.java |  6 +++++-
 .../java/org/apache/solr/ltr/feature/SolrFeature.java |  6 +-----
 .../org/apache/solr/ltr/feature/ValueFeature.java     | 10 +++++++---
 .../org/apache/solr/ltr/model/LTRScoringModel.java    |  2 +-
 .../java/org/apache/solr/ltr/model/LinearModel.java   |  2 +-
 .../solr/ltr/model/MultipleAdditiveTreesModel.java    |  2 +-
 .../org/apache/solr/ltr/norm/IdentityNormalizer.java  |  4 ++++
 .../org/apache/solr/ltr/norm/MinMaxNormalizer.java    |  1 -
 .../src/java/org/apache/solr/ltr/norm/Normalizer.java |  8 +++-----
 .../org/apache/solr/ltr/norm/StandardNormalizer.java  |  1 -
 .../java/org/apache/solr/ltr/store/FeatureStore.java  | 13 -------------
 .../java/org/apache/solr/ltr/store/ModelStore.java    | 14 +++-----------
 .../solr/ltr/store/rest/ManagedFeatureStore.java      |  3 ++-
 .../apache/solr/ltr/store/rest/ManagedModelStore.java |  4 ++--
 solr/contrib/ltr/src/java/overview.html               |  2 +-
 .../test/org/apache/solr/ltr/TestLTRScoringQuery.java |  6 ++++++
 20 files changed, 60 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRThreadModule.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRThreadModule.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRThreadModule.java
index 9e71b2f..8e2563f 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRThreadModule.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRThreadModule.java
@@ -112,7 +112,7 @@ final public class LTRThreadModule implements NamedListInitializedPlugin
{
         );
   }
 
-  public void validate() {
+  private void validate() {
     if (totalPoolThreads <= 0){
       throw new IllegalArgumentException("totalPoolThreads cannot be less than 1");
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/Feature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/Feature.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/Feature.java
index 2a3973e..228b964 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/Feature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/Feature.java
@@ -86,15 +86,13 @@ public abstract class Feature extends Query {
   }
 
   /**
-   * On construction of a feature, this function confirms
-   * that the feature parameters are validated
+   * As part of creation of a feature instance, this function confirms
+   * that the feature parameters are valid.
    *
    * @throws FeatureException
    *             Feature Exception
    */
-  protected void validate() throws FeatureException {
-
-  }
+  protected abstract void validate() throws FeatureException;
 
   @Override
   public String toString(String field) {
@@ -271,7 +269,7 @@ public abstract class Feature extends Query {
 
       final protected String name;
       private DocInfo docInfo;
-      protected DocIdSetIterator itr;
+      final protected DocIdSetIterator itr;
 
       public FeatureScorer(Feature.FeatureWeight weight,
           DocIdSetIterator itr) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldLengthFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldLengthFeature.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldLengthFeature.java
index a173040..4c17aff 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldLengthFeature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldLengthFeature.java
@@ -61,6 +61,14 @@ public class FieldLengthFeature extends Feature {
     return params;
   }
 
+  @Override
+  protected void validate() throws FeatureException {
+    if (field == null || field.isEmpty()) {
+      throw new FeatureException(getClass().getSimpleName()+
+          ": field must be provided");
+    }
+  }
+
   /** Cache of decoded bytes. */
 
   private static final float[] NORM_TABLE = new float[256];

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
index 913c730..279adbc 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
@@ -17,6 +17,7 @@
 package org.apache.solr.ltr.feature;
 
 import java.io.IOException;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
@@ -29,7 +30,6 @@ import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.solr.request.SolrQueryRequest;
 
-import com.google.common.collect.Sets;
 /**
  * This feature returns the value of a field in the current document
  * Example configuration:
@@ -52,7 +52,7 @@ public class FieldValueFeature extends Feature {
 
   public void setField(String field) {
     this.field = field;
-    fieldAsSet = Sets.newHashSet(field);
+    fieldAsSet = Collections.singleton(field);
   }
 
   @Override
@@ -62,6 +62,14 @@ public class FieldValueFeature extends Feature {
     return params;
   }
 
+  @Override
+  protected void validate() throws FeatureException {
+    if (field == null || field.isEmpty()) {
+      throw new FeatureException(getClass().getSimpleName()+
+          ": field must be provided");
+    }
+  }
+
   public FieldValueFeature(String name, Map<String,Object> params) {
     super(name, params);
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
index af1c0ec..125615c 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
@@ -50,6 +50,10 @@ public class OriginalScoreFeature extends Feature {
   }
 
   @Override
+  protected void validate() throws FeatureException {
+  }
+
+  @Override
   public OriginalScoreWeight createWeight(IndexSearcher searcher,
       boolean needsScores, SolrQueryRequest request, Query originalQuery, Map<String,String[]>
efi) throws IOException {
     return new OriginalScoreWeight(searcher, request, originalQuery, efi);
@@ -82,7 +86,7 @@ public class OriginalScoreFeature extends Feature {
     }
 
     public class OriginalScoreScorer extends FeatureScorer {
-      Scorer originalScorer;
+      final private Scorer originalScorer;
 
       public OriginalScoreScorer(FeatureWeight weight, Scorer originalScorer) {
         super(weight,null);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java
index 4482725..cb7c1a0 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/SolrFeature.java
@@ -113,7 +113,6 @@ public class SolrFeature extends Feature {
 
   @Override
   protected void validate() throws FeatureException {
-    super.validate();
     if ((q == null || q.isEmpty()) &&
         ((fq == null) || fq.isEmpty())) {
       throw new FeatureException(getClass().getSimpleName()+
@@ -183,8 +182,6 @@ public class SolrFeature extends Feature {
 
     private LocalSolrQueryRequest makeRequest(SolrCore core, String solrQuery,
         List<String> fqs, String df) {
-      // Map.Entry<String, String> [] entries = new NamedListEntry[q.length /
-      // 2];
       final NamedList<String> returnList = new NamedList<String>();
       if ((solrQuery != null) && !solrQuery.isEmpty()) {
         returnList.add(CommonParams.Q, solrQuery);
@@ -192,7 +189,6 @@ public class SolrFeature extends Feature {
       if (fqs != null) {
         for (final String fq : fqs) {
           returnList.add(CommonParams.FQ, fq);
-          // entries[i/2] = new NamedListEntry<>(q[i], q[i+1]);
         }
       }
       if ((df != null) && !df.isEmpty()) {
@@ -235,7 +231,7 @@ public class SolrFeature extends Feature {
      * @return DocIdSetIterator to traverse documents that matched all filter
      *         criteria
      */
-    public DocIdSetIterator getDocIdSetIteratorFromQueries(List<Query> queries,
+    private DocIdSetIterator getDocIdSetIteratorFromQueries(List<Query> queries,
         LeafReaderContext context) throws IOException {
       final SolrIndexSearcher.ProcessedFilter pf = ((SolrIndexSearcher) searcher)
           .getProcessedFilter(null, queries);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/ValueFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/ValueFeature.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/ValueFeature.java
index 279a551..61aa9e5 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/ValueFeature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/ValueFeature.java
@@ -59,9 +59,6 @@ public class ValueFeature extends Feature {
     this.value = value;
     if (value instanceof String) {
       configValueStr = (String) value;
-      if (configValueStr.trim().isEmpty()) {
-        throw new FeatureException("Empty field 'value' in params for " + this);
-      }
     } else if (value instanceof Double) {
       configValue = ((Double) value).floatValue();
     } else if (value instanceof Float) {
@@ -93,6 +90,13 @@ public class ValueFeature extends Feature {
     return params;
   }
 
+  @Override
+  protected void validate() throws FeatureException {
+    if (configValueStr != null && configValueStr.trim().isEmpty()) {
+      throw new FeatureException("Empty field 'value' in params for " + this);
+    }
+  }
+
   public ValueFeature(String name, Map<String,Object> params) {
     super(name, params);
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LTRScoringModel.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LTRScoringModel.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LTRScoringModel.java
index 96efee7..9edcfe5 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LTRScoringModel.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LTRScoringModel.java
@@ -122,7 +122,7 @@ public abstract class LTRScoringModel {
    * Validate that settings make sense and throws
    * {@link ModelException} if they do not make sense.
    */
-  public void validate() throws ModelException {
+  protected void validate() throws ModelException {
     if (features.isEmpty()) {
       throw new ModelException("no features declared for model "+name);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LinearModel.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LinearModel.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LinearModel.java
index 8fdab57..57fc5ad 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LinearModel.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/LinearModel.java
@@ -81,7 +81,7 @@ public class LinearModel extends LTRScoringModel {
   }
 
   @Override
-  public void validate() throws ModelException {
+  protected void validate() throws ModelException {
     super.validate();
 
     final ArrayList<String> missingWeightFeatureNames = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/MultipleAdditiveTreesModel.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/MultipleAdditiveTreesModel.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/MultipleAdditiveTreesModel.java
index fa277cb..4fa595e 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/MultipleAdditiveTreesModel.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/model/MultipleAdditiveTreesModel.java
@@ -306,7 +306,7 @@ public class MultipleAdditiveTreesModel extends LTRScoringModel {
   }
 
   @Override
-  public void validate() throws ModelException {
+  protected void validate() throws ModelException {
     super.validate();
     if (trees == null) {
       throw new ModelException("no trees declared for model "+name);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/IdentityNormalizer.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/IdentityNormalizer.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/IdentityNormalizer.java
index d26eac9..a3d1026 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/IdentityNormalizer.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/IdentityNormalizer.java
@@ -42,6 +42,10 @@ public class IdentityNormalizer extends Normalizer {
   }
 
   @Override
+  protected void validate() throws NormalizerException {
+  }
+
+  @Override
   public String toString() {
     return getClass().getSimpleName();
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/MinMaxNormalizer.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/MinMaxNormalizer.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/MinMaxNormalizer.java
index 89c7b45..92e233c 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/MinMaxNormalizer.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/MinMaxNormalizer.java
@@ -75,7 +75,6 @@ public class MinMaxNormalizer extends Normalizer {
 
   @Override
   protected void validate() throws NormalizerException {
-    super.validate();
     if (delta == 0f) {
       throw
       new NormalizerException("MinMax Normalizer delta must not be zero " +

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/Normalizer.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/Normalizer.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/Normalizer.java
index 7d77151..2b311f8 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/Normalizer.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/Normalizer.java
@@ -53,14 +53,12 @@ public abstract class Normalizer {
   }
 
   /**
-   * On construction of a normalizer, this function confirms
-   * that the normalizer parameters are validated
+   * As part of creation of a normalizer instance, this function confirms
+   * that the normalizer parameters are valid.
    *
    * @throws NormalizerException
    *             Normalizer Exception
    */
-  protected void validate() throws NormalizerException {
-
-  }
+  protected abstract void validate() throws NormalizerException;
 
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/StandardNormalizer.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/StandardNormalizer.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/StandardNormalizer.java
index 20a984c..7ab525c 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/StandardNormalizer.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/norm/StandardNormalizer.java
@@ -72,7 +72,6 @@ public class StandardNormalizer extends Normalizer {
 
   @Override
   protected void validate() throws NormalizerException {
-    super.validate();
     if (std <= 0f) {
       throw
       new NormalizerException("Standard Normalizer standard deviation must "

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/FeatureStore.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/FeatureStore.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/FeatureStore.java
index e1d8751..ab2595f 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/FeatureStore.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/FeatureStore.java
@@ -44,15 +44,6 @@ public class FeatureStore {
     return store.get(name);
   }
 
-  public int size() {
-    return store.size();
-  }
-
-  @SuppressWarnings("unused")
-  public boolean containsFeature(String name) {
-    return store.containsKey(name);
-  }
-
   public void add(Feature feature) {
     final String name = feature.getName();
     if (store.containsKey(name)) {
@@ -68,10 +59,6 @@ public class FeatureStore {
     return Collections.unmodifiableList(storeValues);
   }
 
-  public void clear() {
-    store.clear();
-  }
-
   @Override
   public String toString() {
     return "FeatureStore [features=" + store.keySet() + "]";

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/ModelStore.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/ModelStore.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/ModelStore.java
index 7032660..dbb065f 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/ModelStore.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/ModelStore.java
@@ -40,18 +40,10 @@ public class ModelStore {
     return availableModels.get(name);
   }
 
-  public boolean containsModel(String modelName) {
-    return availableModels.containsKey(modelName);
-  }
-
   public void clear() {
     availableModels.clear();
   }
 
-  public int size() {
-    return availableModels.size();
-  }
-
   public List<LTRScoringModel> getModels() {
     final List<LTRScoringModel> availableModelsValues =
         new ArrayList<LTRScoringModel>(availableModels.values());
@@ -63,15 +55,15 @@ public class ModelStore {
     return "ModelStore [availableModels=" + availableModels.keySet() + "]";
   }
 
-  public void delete(String modelName) {
-    availableModels.remove(modelName);
+  public LTRScoringModel delete(String modelName) {
+    return availableModels.remove(modelName);
   }
 
   public synchronized void addModel(LTRScoringModel modeldata)
       throws ModelException {
     final String name = modeldata.getName();
 
-    if (containsModel(name)) {
+    if (availableModels.containsKey(name)) {
       throw new ModelException("model '" + name
           + "' already exists. Please use a different name");
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedFeatureStore.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedFeatureStore.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedFeatureStore.java
index a557bde..62b0fe5 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedFeatureStore.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedFeatureStore.java
@@ -57,6 +57,7 @@ public class ManagedFeatureStore extends ManagedResource implements ManagedResou
 
   /** the feature store rest endpoint **/
   public static final String REST_END_POINT = "/schema/feature-store";
+  // TODO: reduce from public to package visibility (once tests no longer need public access)
 
   /** name of the attribute containing the feature class **/
   static final String CLASS_KEY = "class";
@@ -182,7 +183,7 @@ public class ManagedFeatureStore extends ManagedResource implements ManagedResou
   }
 
   private static List<Object> featuresAsManagedResources(FeatureStore store) {
-    final List<Object> features = new ArrayList<Object>(store.size());
+    final List<Object> features = new ArrayList<Object>();
     for (final Feature f : store.getFeatures()) {
       final LinkedHashMap<String,Object> m = toFeatureMap(f);
       m.put(FEATURE_STORE_NAME_KEY, store.getName());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java
index 8436751..97aaa40 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/store/rest/ManagedModelStore.java
@@ -61,6 +61,7 @@ public class ManagedModelStore extends ManagedResource implements ManagedResourc
 
   /** the model store rest endpoint **/
   public static final String REST_END_POINT = "/schema/model-store";
+  // TODO: reduce from public to package visibility (once tests no longer need public access)
 
   /**
    * Managed model store: the name of the attribute containing all the models of
@@ -174,8 +175,7 @@ public class ManagedModelStore extends ManagedResource implements ManagedResourc
   public synchronized void doDeleteChild(BaseSolrResource endpoint, String childId) {
     if (childId.equals("*")) {
       store.clear();
-    }
-    if (store.containsModel(childId)) {
+    } else {
       store.delete(childId);
     }
     storeManagedData(applyUpdatesToManagedData(null));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/java/overview.html
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/overview.html b/solr/contrib/ltr/src/java/overview.html
index 47179f0..ccae361 100644
--- a/solr/contrib/ltr/src/java/overview.html
+++ b/solr/contrib/ltr/src/java/overview.html
@@ -37,7 +37,7 @@ feature engineering and feature extraction.
 <p>
 A Learning to Rank model is plugged into the ranking through the {@link org.apache.solr.search.LTRQParserPlugin},
 a {@link org.apache.solr.search.QParserPlugin}. The plugin will
-read from the request the model (instance of {@link org.apache.solr.ltr.LTRScoringModel})
+read from the request the model (instance of {@link org.apache.solr.ltr.model.LTRScoringModel})
 used to perform the request plus other
 parameters. The plugin will generate a {@link org.apache.solr.search.LTRQParserPlugin.LTRQuery
LTRQuery}:
 a particular {@link org.apache.solr.search.RankQuery}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/af550f54/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
index bf241b7..0576c99 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRScoringQuery.java
@@ -49,6 +49,7 @@ import org.apache.solr.ltr.model.ModelException;
 import org.apache.solr.ltr.model.TestLinearModel;
 import org.apache.solr.ltr.norm.IdentityNormalizer;
 import org.apache.solr.ltr.norm.Normalizer;
+import org.apache.solr.ltr.norm.NormalizerException;
 import org.junit.Test;
 
 public class TestLTRScoringQuery extends LuceneTestCase {
@@ -289,6 +290,11 @@ public class TestLTRScoringQuery extends LuceneTestCase {
       public LinkedHashMap<String,Object> paramsToMap() {
         return null;
       }
+
+      @Override
+      protected void validate() throws NormalizerException {
+      }
+
     };
     norms =
         new ArrayList<Normalizer>(


Mime
View raw message