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 2016/10/26 18:12:52 UTC

[2/2] lucene-solr:jira/solr-8542-v2: SOLR-8542: cleanups (thank you IDE) + tweaks

SOLR-8542: cleanups (thank you IDE) + tweaks

($ = cleanup flagged this up)

* remove unused locals and privates

* make privates final where possible + LTRThreadModule lacked an accessor$

* always use blocks in if/while/for/do statements

* remove trailing whitespace

* correct indentation (for java but not for test) + FeatureLogger StringBuilder append tweak$

* organise imports (resulted in removal of some)

* within solr/contrib/ltr be consistent (for clarity) about 'import Outer.Inner' vs. 'Outer.Inner at point of use'
  e.g. SolrException.ErrorCode, Map.Entry, LTRScoringQuery.Something etc.
  with TODO$ identified as a result: SuppressSSL and SuppressCodecs is used in many of the tests (are they needed?)


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

Branch: refs/heads/jira/solr-8542-v2
Commit: 4e444db65253919120772db1722aed493741a1d5
Parents: f91f33b
Author: Christine Poerschke <cp...@apache.org>
Authored: Wed Oct 26 10:39:47 2016 -0500
Committer: Christine Poerschke <cp...@apache.org>
Committed: Wed Oct 26 13:01:21 2016 -0500

----------------------------------------------------------------------
 .../java/org/apache/solr/ltr/FeatureLogger.java |  38 +++---
 .../java/org/apache/solr/ltr/LTRRescorer.java   |  24 ++--
 .../org/apache/solr/ltr/LTRScoringQuery.java    | 135 +++++++++----------
 .../org/apache/solr/ltr/LTRThreadModule.java    |   4 +
 .../org/apache/solr/ltr/feature/Feature.java    |  34 ++---
 .../solr/ltr/feature/FieldLengthFeature.java    |   8 +-
 .../solr/ltr/feature/FieldValueFeature.java     |  10 +-
 .../solr/ltr/feature/OriginalScoreFeature.java  |   8 +-
 .../apache/solr/ltr/feature/SolrFeature.java    |  20 ++-
 .../apache/solr/ltr/feature/ValueFeature.java   |  19 +--
 .../apache/solr/ltr/model/LTRScoringModel.java  |  14 +-
 .../org/apache/solr/ltr/model/LinearModel.java  |   6 +-
 .../ltr/model/MultipleAdditiveTreesModel.java   |   6 +-
 .../apache/solr/ltr/norm/MinMaxNormalizer.java  |   9 +-
 .../org/apache/solr/ltr/norm/Normalizer.java    |   6 +-
 .../solr/ltr/norm/StandardNormalizer.java       |   9 +-
 .../ltr/store/rest/ManagedFeatureStore.java     |  14 +-
 .../solr/ltr/store/rest/ManagedModelStore.java  |  22 ++-
 .../LTRFeatureLoggerTransformerFactory.java     |  26 ++--
 .../solr/response/transform/package-info.java   |   4 +-
 .../apache/solr/search/LTRQParserPlugin.java    |  38 +++---
 .../org/apache/solr/search/package-info.java    |   4 +-
 .../org/apache/solr/ltr/TestLTROnSolrCloud.java |  17 +--
 .../apache/solr/ltr/TestLTRQParserExplain.java  |   5 +-
 .../apache/solr/ltr/TestLTRQParserPlugin.java   |  35 +++--
 .../solr/ltr/TestLTRReRankingPipeline.java      |  40 +++---
 .../apache/solr/ltr/TestLTRScoringQuery.java    |  31 +++--
 .../org/apache/solr/ltr/TestLTRWithFacet.java   |   3 +-
 .../org/apache/solr/ltr/TestLTRWithSort.java    |   5 +-
 .../solr/ltr/TestParallelWeightCreation.java    |  16 +--
 .../org/apache/solr/ltr/TestRerankBase.java     |  23 ++--
 .../solr/ltr/TestSelectiveWeightCreation.java   |  41 +++---
 .../ltr/feature/TestEdisMaxSolrFeature.java     |   6 +-
 .../ltr/feature/TestExternalValueFeatures.java  |   2 +-
 ...stFeatureExtractionFromMultipleSegments.java |  36 ++---
 .../solr/ltr/feature/TestFeatureLogging.java    |  10 +-
 .../ltr/feature/TestFeatureLtrScoringModel.java |   5 +-
 .../solr/ltr/feature/TestFeatureStore.java      |   2 +-
 .../ltr/feature/TestFieldLengthFeature.java     |   2 +-
 .../solr/ltr/feature/TestFilterSolrFeature.java |   4 +-
 .../ltr/feature/TestNoMatchSolrFeature.java     |   2 +-
 .../solr/ltr/feature/TestRankingFeature.java    |   8 +-
 .../ltr/feature/TestUserTermScoreWithQ.java     |   4 +-
 .../ltr/feature/TestUserTermScorerQuery.java    |   4 +-
 .../ltr/feature/TestUserTermScorereQDF.java     |   4 +-
 .../solr/ltr/feature/TestValueFeature.java      |   6 +-
 .../apache/solr/ltr/model/TestLinearModel.java  |  38 +++---
 .../model/TestMultipleAdditiveTreesModel.java   |  21 ++-
 .../solr/ltr/norm/TestMinMaxNormalizer.java     |   2 +-
 .../solr/ltr/norm/TestStandardNormalizer.java   |   6 +-
 .../solr/ltr/store/rest/TestModelManager.java   |   4 +-
 .../store/rest/TestModelManagerPersistence.java |  10 +-
 52 files changed, 409 insertions(+), 441 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/ltr/FeatureLogger.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/FeatureLogger.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/FeatureLogger.java
index 81efc81..a5afd05 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/FeatureLogger.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/FeatureLogger.java
@@ -21,7 +21,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.solr.ltr.LTRScoringQuery.FeatureInfo;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,11 +38,11 @@ public abstract class FeatureLogger<FV_TYPE> {
 
   protected enum FeatureFormat {DENSE, SPARSE};
   protected final FeatureFormat featureFormat;
-  
+
   protected FeatureLogger(FeatureFormat f) {
     this.featureFormat = f;
   }
-  
+
   /**
    * Log will be called every time that the model generates the feature values
    * for a document and a query.
@@ -51,14 +50,14 @@ public abstract class FeatureLogger<FV_TYPE> {
    * @param docid
    *          Solr document id whose features we are saving
    * @param featuresInfo
-   *          List of all the FeatureInfo objects which contain name and value
+   *          List of all the {@link LTRScoringQuery.FeatureInfo} objects which contain name and value
    *          for all the features triggered by the result set
    * @return true if the logger successfully logged the features, false
    *         otherwise.
    */
 
   public boolean log(int docid, LTRScoringQuery scoringQuery,
-      SolrIndexSearcher searcher, FeatureInfo[] featuresInfo) {
+      SolrIndexSearcher searcher, LTRScoringQuery.FeatureInfo[] featuresInfo) {
     final FV_TYPE featureVector = makeFeatureVector(featuresInfo);
     if (featureVector == null) {
       return false;
@@ -76,7 +75,7 @@ public abstract class FeatureLogger<FV_TYPE> {
    * format will be selected.
    * 'featureFormat' param: 'dense' will write features in dense format,
    * 'sparse' will write the features in sparse format, null or empty will
-   * default to 'sparse'  
+   * default to 'sparse'
    *
    *
    * @return a feature logger for the format specified.
@@ -108,7 +107,7 @@ public abstract class FeatureLogger<FV_TYPE> {
 
   }
 
-  public abstract FV_TYPE makeFeatureVector(FeatureInfo[] featuresInfo);
+  public abstract FV_TYPE makeFeatureVector(LTRScoringQuery.FeatureInfo[] featuresInfo);
 
   private static int fvCacheKey(LTRScoringQuery scoringQuery, int docid) {
     return  scoringQuery.hashCode() + (31 * docid);
@@ -121,7 +120,7 @@ public abstract class FeatureLogger<FV_TYPE> {
    *          Solr document id
    * @return String representation of the list of features calculated for docid
    */
-  
+
   public FV_TYPE getFeatureVector(int docid, LTRScoringQuery scoringQuery,
       SolrIndexSearcher searcher) {
     return (FV_TYPE) searcher.cacheLookup(QUERY_FV_CACHE_NAME, fvCacheKey(scoringQuery, docid));
@@ -133,14 +132,14 @@ public abstract class FeatureLogger<FV_TYPE> {
     public MapFeatureLogger(FeatureFormat f) {
       super(f);
     }
-    
+
     @Override
-    public Map<String,Float> makeFeatureVector(FeatureInfo[] featuresInfo) {
+    public Map<String,Float> makeFeatureVector(LTRScoringQuery.FeatureInfo[] featuresInfo) {
       boolean isDense = featureFormat.equals(FeatureFormat.DENSE);
       Map<String,Float> hashmap = Collections.emptyMap();
       if (featuresInfo.length > 0) {
         hashmap = new HashMap<String,Float>(featuresInfo.length);
-        for (FeatureInfo featInfo:featuresInfo){ 
+        for (LTRScoringQuery.FeatureInfo featInfo:featuresInfo){
           if (featInfo.isUsed() || isDense){
             hashmap.put(featInfo.getName(), featInfo.getValue());
           }
@@ -155,7 +154,7 @@ public abstract class FeatureLogger<FV_TYPE> {
     StringBuilder sb = new StringBuilder(500);
     char keyValueSep = ':';
     char featureSep = ';';
-    
+
     public CSVFeatureLogger(FeatureFormat f) {
       super(f);
     }
@@ -171,14 +170,15 @@ public abstract class FeatureLogger<FV_TYPE> {
     }
 
     @Override
-    public String makeFeatureVector(FeatureInfo[] featuresInfo) {
+    public String makeFeatureVector(LTRScoringQuery.FeatureInfo[] featuresInfo) {
       boolean isDense = featureFormat.equals(FeatureFormat.DENSE);
-      for (FeatureInfo featInfo:featuresInfo) {
-          if (featInfo.isUsed() || isDense){
-             sb.append(featInfo.getName()).append(keyValueSep)
-                 .append(featInfo.getValue());
-             sb.append(featureSep);
-          }
+      for (LTRScoringQuery.FeatureInfo featInfo:featuresInfo) {
+        if (featInfo.isUsed() || isDense){
+          sb.append(featInfo.getName())
+          .append(keyValueSep)
+          .append(featInfo.getValue())
+          .append(featureSep);
+        }
       }
 
       final String features = (sb.length() > 0 ? sb.substring(0,

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
index 607a9c8..27223b7 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java
@@ -29,8 +29,6 @@ import org.apache.lucene.search.Rescorer;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.Weight;
-import org.apache.solr.ltr.LTRScoringQuery.ModelWeight;
-import org.apache.solr.ltr.LTRScoringQuery.ModelWeight.ModelScorer;
 import org.apache.solr.search.SolrIndexSearcher;
 
 
@@ -115,12 +113,12 @@ public class LTRRescorer extends Rescorer {
     topN = Math.min(topN, firstPassTopDocs.totalHits);
     final ScoreDoc[] reranked = new ScoreDoc[topN];
     final List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
-    final ModelWeight modelWeight = (ModelWeight) searcher
+    final LTRScoringQuery.ModelWeight modelWeight = (LTRScoringQuery.ModelWeight) searcher
         .createNormalizedWeight(scoringQuery, true);
 
     final SolrIndexSearcher solrIndexSearch = (SolrIndexSearcher) searcher;
     scoreFeatures(solrIndexSearch, firstPassTopDocs,topN, modelWeight, hits, leaves, reranked);
-    // Must sort all documents that we reranked, and then select the top 
+    // Must sort all documents that we reranked, and then select the top
     Arrays.sort(reranked, new Comparator<ScoreDoc>() {
       @Override
       public int compare(ScoreDoc a, ScoreDoc b) {
@@ -139,16 +137,16 @@ public class LTRRescorer extends Rescorer {
 
     return new TopDocs(firstPassTopDocs.totalHits, reranked, reranked[0].score);
   }
-  
+
   public void scoreFeatures(SolrIndexSearcher solrIndexSearch, TopDocs firstPassTopDocs,
-      int topN, ModelWeight modelWeight, ScoreDoc[] hits, List<LeafReaderContext> leaves,
+      int topN, LTRScoringQuery.ModelWeight modelWeight, ScoreDoc[] hits, List<LeafReaderContext> leaves,
       ScoreDoc[] reranked) throws IOException {
-    
+
     int readerUpto = -1;
     int endDoc = 0;
     int docBase = 0;
 
-    ModelScorer scorer = null;
+    LTRScoringQuery.ModelWeight.ModelScorer scorer = null;
     int hitUpto = 0;
     final FeatureLogger<?> featureLogger = scoringQuery.getFeatureLogger();
 
@@ -166,11 +164,11 @@ public class LTRRescorer extends Rescorer {
         docBase = readerContext.docBase;
         scorer = modelWeight.scorer(readerContext);
       }
-      // Scorer for a ModelWeight should never be null since we always have to
+      // Scorer for a LTRScoringQuery.ModelWeight should never be null since we always have to
       // call score
       // even if no feature scorers match, since a model might use that info to
       // return a
-      // non-zero score. Same applies for the case of advancing a ModelScorer
+      // non-zero score. Same applies for the case of advancing a LTRScoringQuery.ModelWeight.ModelScorer
       // past the target
       // doc since the model algorithm still needs to compute a potentially
       // non-zero score from blank features.
@@ -226,15 +224,15 @@ public class LTRRescorer extends Rescorer {
     return modelWeight.explain(context, deBasedDoc);
   }
 
-  public static LTRScoringQuery.FeatureInfo[] extractFeaturesInfo(ModelWeight modelWeight,
+  public static LTRScoringQuery.FeatureInfo[] extractFeaturesInfo(LTRScoringQuery.ModelWeight modelWeight,
       int docid,
       Float originalDocScore,
       List<LeafReaderContext> leafContexts)
-      throws IOException {
+          throws IOException {
     final int n = ReaderUtil.subIndex(docid, leafContexts);
     final LeafReaderContext atomicContext = leafContexts.get(n);
     final int deBasedDoc = docid - atomicContext.docBase;
-    final ModelScorer r = modelWeight.scorer(atomicContext);
+    final LTRScoringQuery.ModelWeight.ModelScorer r = modelWeight.scorer(atomicContext);
     if ( (r == null) || (r.iterator().advance(deBasedDoc) != deBasedDoc) ) {
       return new LTRScoringQuery.FeatureInfo[0];
     } else {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
index 71a7ace..778e2be 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
@@ -24,7 +24,6 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Future;
@@ -44,8 +43,6 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Weight;
 import org.apache.solr.ltr.feature.Feature;
-import org.apache.solr.ltr.feature.Feature.FeatureWeight;
-import org.apache.solr.ltr.feature.Feature.FeatureWeight.FeatureScorer;
 import org.apache.solr.ltr.model.LTRScoringModel;
 import org.apache.solr.request.SolrQueryRequest;
 import org.slf4j.Logger;
@@ -83,8 +80,8 @@ public class LTRScoringQuery extends Query {
     this(ltrScoringModel, Collections.<String, String[]>emptyMap(), extractAllFeatures, null);
   }
 
-  public LTRScoringQuery(LTRScoringModel ltrScoringModel, 
-      Map<String, String[]> externalFeatureInfo, 
+  public LTRScoringQuery(LTRScoringModel ltrScoringModel,
+      Map<String, String[]> externalFeatureInfo,
       boolean extractAllFeatures, LTRThreadModule ltrThreadMgr) {
     this.ltrScoringModel = ltrScoringModel;
     this.efi = externalFeatureInfo;
@@ -128,7 +125,7 @@ public class LTRScoringQuery extends Query {
   public SolrQueryRequest getRequest() {
     return request;
   }
-  
+
   @Override
   public int hashCode() {
     final int prime = 31;
@@ -140,7 +137,7 @@ public class LTRScoringQuery extends Query {
       result = (prime * result) + 0;
     }
     else {
-      for (final Entry<String,String[]> entry : efi.entrySet()) {
+      for (final Map.Entry<String,String[]> entry : efi.entrySet()) {
         final String key = entry.getKey();
         final String[] values = entry.getValue();
         result = (prime * result) + key.hashCode();
@@ -178,7 +175,7 @@ public class LTRScoringQuery extends Query {
       if (other.efi == null || efi.size() != other.efi.size()) {
         return false;
       }
-      for(final Entry<String,String[]> entry : efi.entrySet()) {
+      for(final Map.Entry<String,String[]> entry : efi.entrySet()) {
         final String key = entry.getKey();
         final String[] otherValues = other.efi.get(key);
         if (otherValues == null || !Arrays.equals(otherValues,entry.getValue())) {
@@ -191,11 +188,11 @@ public class LTRScoringQuery extends Query {
 
   @Override
   public ModelWeight createWeight(IndexSearcher searcher, boolean needsScores, float boost)
-      throws IOException {   
+      throws IOException {
     final Collection<Feature> modelFeatures = ltrScoringModel.getFeatures();
     final Collection<Feature> allFeatures = ltrScoringModel.getAllFeatures();
     int modelFeatSize = modelFeatures.size();
-   
+
     Collection<Feature> features = null;
     if (this.extractAllFeatures) {
       features = allFeatures;
@@ -203,19 +200,19 @@ public class LTRScoringQuery extends Query {
     else{
       features =  modelFeatures;
     }
-    final FeatureWeight[] extractedFeatureWeights = new FeatureWeight[features.size()];
-    final FeatureWeight[] modelFeaturesWeights = new FeatureWeight[modelFeatSize];
-    List<FeatureWeight > featureWeights = new ArrayList<>(features.size());
-    
+    final Feature.FeatureWeight[] extractedFeatureWeights = new Feature.FeatureWeight[features.size()];
+    final Feature.FeatureWeight[] modelFeaturesWeights = new Feature.FeatureWeight[modelFeatSize];
+    List<Feature.FeatureWeight > featureWeights = new ArrayList<>(features.size());
+
     if (querySemaphore == null) {
-       createWeights(searcher, needsScores, boost, featureWeights, features);
+      createWeights(searcher, needsScores, boost, featureWeights, features);
     }
     else{
-       createWeightsParallel(searcher, needsScores, boost, featureWeights, features);
+      createWeightsParallel(searcher, needsScores, boost, featureWeights, features);
     }
     int i=0, j = 0;
     if (this.extractAllFeatures) {
-      for (final FeatureWeight fw : featureWeights) {
+      for (final Feature.FeatureWeight fw : featureWeights) {
         extractedFeatureWeights[i++] = fw;
       }
       for (final Feature f : modelFeatures){
@@ -223,31 +220,31 @@ public class LTRScoringQuery extends Query {
       }
     }
     else{
-      for (final FeatureWeight fw: featureWeights){
+      for (final Feature.FeatureWeight fw: featureWeights){
         extractedFeatureWeights[i++] = fw;
-        modelFeaturesWeights[j++] = fw; 
+        modelFeaturesWeights[j++] = fw;
       }
     }
     return new ModelWeight(searcher, modelFeaturesWeights, extractedFeatureWeights, allFeatures.size());
   }
 
-  private void createWeights(IndexSearcher searcher, boolean needsScores, float boost, 
-      List<FeatureWeight > featureWeights, Collection<Feature> features) throws IOException {
+  private void createWeights(IndexSearcher searcher, boolean needsScores, float boost,
+      List<Feature.FeatureWeight > featureWeights, Collection<Feature> features) throws IOException {
     final SolrQueryRequest req = getRequest();
     // since the feature store is a linkedhashmap order is preserved
     for (final Feature f : features) {
-        try{
-          FeatureWeight fw = f.createWeight(searcher, needsScores, req, originalQuery, efi);
-          featureWeights.add(fw);
-        } catch (final Exception e) {
-          throw new RuntimeException("Exception from createWeight for " + f.toString() + " "
-              + e.getMessage(), e);
-        }
+      try{
+        Feature.FeatureWeight fw = f.createWeight(searcher, needsScores, req, originalQuery, efi);
+        featureWeights.add(fw);
+      } catch (final Exception e) {
+        throw new RuntimeException("Exception from createWeight for " + f.toString() + " "
+            + e.getMessage(), e);
       }
+    }
   }
 
-  class CreateWeightCallable implements Callable<FeatureWeight>{
-    private Feature f;
+  class CreateWeightCallable implements Callable<Feature.FeatureWeight>{
+    final private Feature f;
     IndexSearcher searcher;
     boolean needsScores;
     SolrQueryRequest req;
@@ -260,9 +257,9 @@ public class LTRScoringQuery extends Query {
     }
 
     @Override
-    public FeatureWeight call() throws Exception{
+    public Feature.FeatureWeight call() throws Exception{
       try {
-        FeatureWeight fw  = f.createWeight(searcher, needsScores, req, originalQuery, efi);
+        Feature.FeatureWeight fw  = f.createWeight(searcher, needsScores, req, originalQuery, efi);
         return fw;
       } catch (final Exception e) {
         throw new RuntimeException("Exception from createWeight for " + f.toString() + " "
@@ -275,21 +272,21 @@ public class LTRScoringQuery extends Query {
   } // end of call CreateWeightCallable
 
   private void createWeightsParallel(IndexSearcher searcher, boolean needsScores, float boost,
-      List<FeatureWeight > featureWeights, Collection<Feature> features) throws RuntimeException {
+      List<Feature.FeatureWeight > featureWeights, Collection<Feature> features) throws RuntimeException {
 
     final SolrQueryRequest req = getRequest();
-    List<Future<FeatureWeight> > futures = new ArrayList<>(features.size());
+    List<Future<Feature.FeatureWeight> > futures = new ArrayList<>(features.size());
     try{
       for (final Feature f : features) {
         CreateWeightCallable callable = new CreateWeightCallable(f, searcher, needsScores, req);
-        RunnableFuture<FeatureWeight> runnableFuture = new FutureTask<>(callable);
-        querySemaphore.acquire(); // always acquire before the ltrSemaphore is acquired, to guarantee a that the current query is within the limit for max. threads 
+        RunnableFuture<Feature.FeatureWeight> runnableFuture = new FutureTask<>(callable);
+        querySemaphore.acquire(); // always acquire before the ltrSemaphore is acquired, to guarantee a that the current query is within the limit for max. threads
         ltrThreadMgr.acquireLTRSemaphore();//may block and/or interrupt
         ltrThreadMgr.execute(runnableFuture);//releases semaphore when done
         futures.add(runnableFuture);
       }
       //Loop over futures to get the feature weight objects
-      for (final Future<FeatureWeight> future : futures) {
+      for (final Future<Feature.FeatureWeight> future : futures) {
         featureWeights.add(future.get()); // future.get() will block if the job is still running
       }
     } catch (Exception e) { // To catch InterruptedException and ExecutionException
@@ -309,7 +306,7 @@ public class LTRScoringQuery extends Query {
     boolean used;
 
     FeatureInfo(String n, float v, boolean u){
-      name = n; value = v; used = u; 
+      name = n; value = v; used = u;
     }
 
     public void setScore(float score){
@@ -339,34 +336,34 @@ public class LTRScoringQuery extends Query {
 
     // List of the model's features used for scoring. This is a subset of the
     // features used for logging.
-    FeatureWeight[] modelFeatureWeights;
+    Feature.FeatureWeight[] modelFeatureWeights;
     float[] modelFeatureValuesNormalized;
-    FeatureWeight[] extractedFeatureWeights;
+    Feature.FeatureWeight[] extractedFeatureWeights;
 
     // List of all the feature names, values - used for both scoring and logging
     /*
-     *  What is the advantage of using a hashmap here instead of an array of objects?        
-     *     A set of arrays was used earlier and the elements were accessed using the featureId. 
-     *     With the updated logic to create weights selectively, 
-     *     the number of elements in the array can be fewer than the total number of features. 
-     *     When [features] are not requested, only the model features are extracted. 
-     *     In this case, the indexing by featureId, fails. For this reason, 
-     *     we need a map which holds just the features that were triggered by the documents in the result set. 
-     *  
+     *  What is the advantage of using a hashmap here instead of an array of objects?
+     *     A set of arrays was used earlier and the elements were accessed using the featureId.
+     *     With the updated logic to create weights selectively,
+     *     the number of elements in the array can be fewer than the total number of features.
+     *     When [features] are not requested, only the model features are extracted.
+     *     In this case, the indexing by featureId, fails. For this reason,
+     *     we need a map which holds just the features that were triggered by the documents in the result set.
+     *
      */
     FeatureInfo[] featuresInfo;
-    /* 
-     * @param modelFeatureWeights 
+    /*
+     * @param modelFeatureWeights
      *     - should be the same size as the number of features used by the model
      * @param extractedFeatureWeights
      *     - if features are requested from the same store as model feature store,
      *       this will be the size of total number of features in the model feature store
-     *       else, this will be the size of the modelFeatureWeights  
+     *       else, this will be the size of the modelFeatureWeights
      * @param allFeaturesSize
      *     - total number of feature in the feature store used by this model
      */
-    public ModelWeight(IndexSearcher searcher, FeatureWeight[] modelFeatureWeights,
-        FeatureWeight[] extractedFeatureWeights, int allFeaturesSize) {
+    public ModelWeight(IndexSearcher searcher, Feature.FeatureWeight[] modelFeatureWeights,
+        Feature.FeatureWeight[] extractedFeatureWeights, int allFeaturesSize) {
       super(LTRScoringQuery.this);
       this.searcher = searcher;
       this.extractedFeatureWeights = extractedFeatureWeights;
@@ -382,7 +379,7 @@ public class LTRScoringQuery extends Query {
         int featId = extractedFeatureWeights[i].getIndex();
         float value = extractedFeatureWeights[i].getDefaultValue();
         featuresInfo[featId] = new FeatureInfo(featName,value,false);
-      } 
+      }
     }
 
     public FeatureInfo[] getFeaturesInfo(){
@@ -395,10 +392,10 @@ public class LTRScoringQuery extends Query {
      */
     private void makeNormalizedFeatures() {
       int pos = 0;
-      for (final FeatureWeight feature : modelFeatureWeights) {
+      for (final Feature.FeatureWeight feature : modelFeatureWeights) {
         final int featureId = feature.getIndex();
         FeatureInfo fInfo = featuresInfo[featureId];
-        if (fInfo.isUsed()) { // not checking for finfo == null as that would be a bug we should catch 
+        if (fInfo.isUsed()) { // not checking for finfo == null as that would be a bug we should catch
           modelFeatureValuesNormalized[pos] = fInfo.getValue();
         } else {
           modelFeatureValuesNormalized[pos] = feature.getDefaultValue();
@@ -413,12 +410,12 @@ public class LTRScoringQuery extends Query {
         throws IOException {
 
       final Explanation[] explanations = new Explanation[this.featuresInfo.length];
-      for (final FeatureWeight feature : extractedFeatureWeights) {
+      for (final Feature.FeatureWeight feature : extractedFeatureWeights) {
         explanations[feature.getIndex()] = feature.explain(context, doc);
       }
       final List<Explanation> featureExplanations = new ArrayList<>();
       for (int idx = 0 ;idx < modelFeatureWeights.length; ++idx) {
-        final FeatureWeight f = modelFeatureWeights[idx]; 
+        final Feature.FeatureWeight f = modelFeatureWeights[idx];
         Explanation e = ltrScoringModel.getNormalizerExplanation(explanations[f.getIndex()], idx);
         featureExplanations.add(e);
       }
@@ -433,7 +430,7 @@ public class LTRScoringQuery extends Query {
 
     @Override
     public void extractTerms(Set<Term> terms) {
-      for (final FeatureWeight feature : extractedFeatureWeights) {
+      for (final Feature.FeatureWeight feature : extractedFeatureWeights) {
         feature.extractTerms(terms);
       }
     }
@@ -450,10 +447,10 @@ public class LTRScoringQuery extends Query {
     @Override
     public ModelScorer scorer(LeafReaderContext context) throws IOException {
 
-      final List<FeatureScorer> featureScorers = new ArrayList<FeatureScorer>(
+      final List<Feature.FeatureWeight.FeatureScorer> featureScorers = new ArrayList<Feature.FeatureWeight.FeatureScorer>(
           extractedFeatureWeights.length);
-      for (final FeatureWeight featureWeight : extractedFeatureWeights) {
-        final FeatureScorer scorer = featureWeight.scorer(context);
+      for (final Feature.FeatureWeight featureWeight : extractedFeatureWeights) {
+        final Feature.FeatureWeight.FeatureScorer scorer = featureWeight.scorer(context);
         if (scorer != null) {
           featureScorers.add(featureWeight.scorer(context));
         }
@@ -476,10 +473,10 @@ public class LTRScoringQuery extends Query {
         return docInfo;
       }
 
-      public ModelScorer(Weight weight, List<FeatureScorer> featureScorers) {
+      public ModelScorer(Weight weight, List<Feature.FeatureWeight.FeatureScorer> featureScorers) {
         super(weight);
         docInfo = new DocInfo();
-        for (final FeatureScorer subSocer : featureScorers) {
+        for (final Feature.FeatureWeight.FeatureScorer subSocer : featureScorers) {
           subSocer.setDocInfo(docInfo);
         }
         if (featureScorers.size() <= 1) { // TODO: Allow the use of dense
@@ -523,7 +520,7 @@ public class LTRScoringQuery extends Query {
         protected int activeDoc = -1;
 
         protected SparseModelScorer(Weight weight,
-            List<FeatureScorer> featureScorers) {
+            List<Feature.FeatureWeight.FeatureScorer> featureScorers) {
           super(weight);
           if (featureScorers.size() <= 1) {
             throw new IllegalArgumentException(
@@ -555,7 +552,7 @@ public class LTRScoringQuery extends Query {
           if (activeDoc == targetDoc) {
             for (DisiWrapper w = topList; w != null; w = w.next) {
               final Scorer subScorer = w.scorer;
-              FeatureWeight scFW = (FeatureWeight) subScorer.getWeight();
+              Feature.FeatureWeight scFW = (Feature.FeatureWeight) subScorer.getWeight();
               final int featureId = scFW.getIndex();
               featuresInfo[featureId].setScore(subScorer.score());
               featuresInfo[featureId].setUsed(true);
@@ -627,10 +624,10 @@ public class LTRScoringQuery extends Query {
         int activeDoc = -1; // The doc that our scorer's are actually at
         int targetDoc = -1; // The doc we were most recently told to go to
         int freq = -1;
-        List<FeatureScorer> featureScorers;
+        List<Feature.FeatureWeight.FeatureScorer> featureScorers;
 
         protected DenseModelScorer(Weight weight,
-            List<FeatureScorer> featureScorers) {
+            List<Feature.FeatureWeight.FeatureScorer> featureScorers) {
           super(weight);
           this.featureScorers = featureScorers;
         }
@@ -648,7 +645,7 @@ public class LTRScoringQuery extends Query {
             for (final Scorer scorer : featureScorers) {
               if (scorer.docID() == activeDoc) {
                 freq++;
-                FeatureWeight scFW = (FeatureWeight) scorer.getWeight();
+                Feature.FeatureWeight scFW = (Feature.FeatureWeight) scorer.getWeight();
                 final int featureId = scFW.getIndex();
                 featuresInfo[featureId].setScore(scorer.score());
                 featuresInfo[featureId].setUsed(true);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 0576f6f..9e71b2f 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
@@ -136,6 +136,10 @@ final public class LTRThreadModule implements NamedListInitializedPlugin {
     this.maxPoolSize = maxPoolSize;
   }
 
+  public void setKeepAliveTimeSeconds(long keepAliveTimeSeconds) {
+    this.keepAliveTimeSeconds = keepAliveTimeSeconds;
+  }
+
   public void setThreadNamePrefix(String threadNamePrefix) {
     this.threadNamePrefix = threadNamePrefix;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 87adde2..2a3973e 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
@@ -53,7 +53,7 @@ import org.apache.solr.util.SolrPluginUtils;
    }
 }</pre>
  * <p>
- * {@link Feature} is an abstract class and concrete classes should implement 
+ * {@link Feature} is an abstract class and concrete classes should implement
  * the {@link #validate()} function, and must implement the {@link #paramsToMap()}
  * and createWeight() methods.
  */
@@ -84,16 +84,16 @@ public abstract class Feature extends Query {
     this.name = name;
     this.params = params;
   }
-  
+
   /**
    * On construction of a feature, this function confirms
    * that the feature parameters are validated
-   * 
+   *
    * @throws FeatureException
    *             Feature Exception
    */
   protected void validate() throws FeatureException {
-    
+
   }
 
   @Override
@@ -138,21 +138,21 @@ public abstract class Feature extends Query {
 
   private boolean equalsTo(Feature other) {
     if (index != other.index) {
-        return false;
+      return false;
     }
     if (name == null) {
-        if (other.name != null) {
-            return false;
-        }
-    } else if (!name.equals(other.name)) {
+      if (other.name != null) {
         return false;
+      }
+    } else if (!name.equals(other.name)) {
+      return false;
     }
     if (params == null) {
-        if (other.params != null) {
-            return false;
-        }
-    } else if (!params.equals(other.params)) {
+      if (other.params != null) {
         return false;
+      }
+    } else if (!params.equals(other.params)) {
+      return false;
     }
     return true;
   }
@@ -204,7 +204,7 @@ public abstract class Feature extends Query {
      * @param searcher
      *          Solr searcher available for features if they need them
      */
-    public FeatureWeight(Query q, IndexSearcher searcher, 
+    public FeatureWeight(Query q, IndexSearcher searcher,
         SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) {
       super(q);
       this.searcher = searcher;
@@ -237,7 +237,9 @@ public abstract class Feature extends Query {
       float score = getDefaultValue();
       if (r != null) {
         r.iterator().advance(doc);
-        if (r.docID() == doc) score = r.score();
+        if (r.docID() == doc) {
+          score = r.score();
+        }
         return Explanation.match(score, toString());
       }else{
         return Explanation.match(score, "The feature has no value");
@@ -248,7 +250,7 @@ public abstract class Feature extends Query {
      * Used in the FeatureWeight's explain. Each feature should implement this
      * returning properties of the specific scorer useful for an explain. For
      * example "MyCustomClassFeature [name=" + name + "myVariable:" + myVariable +
-     * "]";  If not provided, a default implementation will return basic feature 
+     * "]";  If not provided, a default implementation will return basic feature
      * properties, which might not include query time specific values.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 20e5020..a173040 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
@@ -88,9 +88,9 @@ public class FieldLengthFeature extends Feature {
   }
 
   @Override
-  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores, 
+  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores,
       SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi)
-      throws IOException {
+          throws IOException {
 
     return new FieldLengthFeatureWeight(searcher, request, originalQuery, efi);
   }
@@ -98,7 +98,7 @@ public class FieldLengthFeature extends Feature {
 
   public class FieldLengthFeatureWeight extends FeatureWeight {
 
-    public FieldLengthFeatureWeight(IndexSearcher searcher, 
+    public FieldLengthFeatureWeight(IndexSearcher searcher,
         SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) {
       super(FieldLengthFeature.this, searcher, request, originalQuery, efi);
     }
@@ -107,7 +107,7 @@ public class FieldLengthFeature extends Feature {
     public FeatureScorer scorer(LeafReaderContext context) throws IOException {
       NumericDocValues norms = context.reader().getNormValues(field);
       if (norms == null){
-        return new ValueFeatureScorer(this, 0f, 
+        return new ValueFeatureScorer(this, 0f,
             DocIdSetIterator.all(DocIdSetIterator.NO_MORE_DOCS));
       }
       return new FieldLengthFeatureScorer(this, norms);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 49e0787..913c730 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
@@ -67,15 +67,15 @@ public class FieldValueFeature extends Feature {
   }
 
   @Override
-  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores, 
+  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores,
       SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi)
-      throws IOException {
+          throws IOException {
     return new FieldValueFeatureWeight(searcher, request, originalQuery, efi);
   }
 
   public class FieldValueFeatureWeight extends FeatureWeight {
 
-    public FieldValueFeatureWeight(IndexSearcher searcher, 
+    public FieldValueFeatureWeight(IndexSearcher searcher,
         SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) {
       super(FieldValueFeature.this, searcher, request, originalQuery, efi);
     }
@@ -123,8 +123,8 @@ public class FieldValueFeature extends Feature {
         } catch (final IOException e) {
           throw new FeatureException(
               e.toString() + ": " +
-              "Unable to extract feature for "
-              + name, e);
+                  "Unable to extract feature for "
+                  + name, e);
         }
         return getDefaultValue();
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 f141474..af1c0ec 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
@@ -29,7 +29,7 @@ import org.apache.lucene.search.Weight;
 import org.apache.solr.ltr.DocInfo;
 import org.apache.solr.request.SolrQueryRequest;
 /**
- * This feature returns the original score that the document had before performing 
+ * This feature returns the original score that the document had before performing
  * the reranking.
  * Example configuration:
  * <pre>{
@@ -60,19 +60,19 @@ public class OriginalScoreFeature extends Feature {
 
     final Weight w;
 
-    public OriginalScoreWeight(IndexSearcher searcher, 
+    public OriginalScoreWeight(IndexSearcher searcher,
         SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) throws IOException {
       super(OriginalScoreFeature.this, searcher, request, originalQuery, efi);
       w = searcher.createNormalizedWeight(originalQuery, true);
     };
 
-    
+
     @Override
     public String toString() {
       return "OriginalScoreFeature [query:" + originalQuery.toString() + "]";
     }
 
-    
+
 
     @Override
     public FeatureScorer scorer(LeafReaderContext context) throws IOException {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 2037c34..4482725 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
@@ -37,7 +37,6 @@ import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.search.SolrIndexSearcher.ProcessedFilter;
 import org.apache.solr.search.SyntaxError;
 /**
  * This feature allows you to reuse any Solr query as a feature. The value
@@ -106,9 +105,9 @@ public class SolrFeature extends Feature {
   }
 
   @Override
-  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores, 
+  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores,
       SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi)
-      throws IOException {
+          throws IOException {
     return new SolrFeatureWeight(searcher, request, originalQuery, efi);
   }
 
@@ -116,9 +115,10 @@ public class SolrFeature extends Feature {
   protected void validate() throws FeatureException {
     super.validate();
     if ((q == null || q.isEmpty()) &&
-         ((fq == null) || fq.isEmpty()))
+        ((fq == null) || fq.isEmpty())) {
       throw new FeatureException(getClass().getSimpleName()+
           ": Q or FQ must be provided");
+    }
   }
   /**
    * Weight for a SolrFeature
@@ -128,7 +128,7 @@ public class SolrFeature extends Feature {
     Query query;
     List<Query> queryAndFilters;
 
-    public SolrFeatureWeight(IndexSearcher searcher, 
+    public SolrFeatureWeight(IndexSearcher searcher,
         SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) throws IOException {
       super(SolrFeature.this, searcher, request, originalQuery, efi);
       try {
@@ -151,9 +151,7 @@ public class SolrFeature extends Feature {
         }
 
         // Build the filter queries
-        queryAndFilters = new ArrayList<Query>(); // If there are no fqs we
-                                                  // just want an empty
-                                                  // list
+        queryAndFilters = new ArrayList<Query>(); // If there are no fqs we just want an empty list
         if (fqs != null) {
           for (String fq : fqs) {
             if ((fq != null) && (fq.trim().length() != 0)) {
@@ -239,7 +237,7 @@ public class SolrFeature extends Feature {
      */
     public DocIdSetIterator getDocIdSetIteratorFromQueries(List<Query> queries,
         LeafReaderContext context) throws IOException {
-      final ProcessedFilter pf = ((SolrIndexSearcher) searcher)
+      final SolrIndexSearcher.ProcessedFilter pf = ((SolrIndexSearcher) searcher)
           .getProcessedFilter(null, queries);
       final Bits liveDocs = context.reader().getLiveDocs();
 
@@ -273,8 +271,8 @@ public class SolrFeature extends Feature {
         } catch (UnsupportedOperationException e) {
           throw new FeatureException(
               e.toString() + ": " +
-              "Unable to extract feature for "
-              + name, e);
+                  "Unable to extract feature for "
+                  + name, e);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 afb1f10..279a551 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
@@ -27,7 +27,7 @@ import org.apache.lucene.search.Query;
 import org.apache.solr.request.SolrQueryRequest;
 /**
  * This feature allows to return a constant given value for the current document.
- * 
+ *
  * Example configuration:
  * <pre>{
    "name" : "userFromMobile",
@@ -42,7 +42,7 @@ import org.apache.solr.request.SolrQueryRequest;
  *In the rerank request you can pass in rq={... efi.userFromMobile=1}, and the above
  *feature will return 1 for all the docs for that request.  If required is set to true,
  *the request will return an error since you failed to pass in the efi, otherwise if will
- *just skip the feature and use a default value of 0 instead. 
+ *just skip the feature and use a default value of 0 instead.
  **/
 public class ValueFeature extends Feature {
   private float configValue = -1f;
@@ -98,9 +98,9 @@ public class ValueFeature extends Feature {
   }
 
   @Override
-  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores, 
+  public FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores,
       SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi)
-      throws IOException {
+          throws IOException {
     return new ValueFeatureWeight(searcher, request, originalQuery, efi);
   }
 
@@ -108,7 +108,7 @@ public class ValueFeature extends Feature {
 
     final protected Float featureValue;
 
-    public ValueFeatureWeight(IndexSearcher searcher, 
+    public ValueFeatureWeight(IndexSearcher searcher,
         SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) {
       super(ValueFeature.this, searcher, request, originalQuery, efi);
       if (configValueStr != null) {
@@ -127,15 +127,16 @@ public class ValueFeature extends Feature {
 
     @Override
     public FeatureScorer scorer(LeafReaderContext context) throws IOException {
-      if(featureValue!=null)
+      if(featureValue!=null) {
         return new ValueFeatureScorer(this, featureValue,
             DocIdSetIterator.all(DocIdSetIterator.NO_MORE_DOCS));
-      else
+      } else {
         return null;
+      }
     }
-    
 
-    
+
+
 
 
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 70d5b6d..96efee7 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
@@ -24,8 +24,8 @@ import java.util.Map;
 
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.search.Explanation;
-import org.apache.solr.ltr.feature.Feature;
 import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.ltr.feature.Feature;
 import org.apache.solr.ltr.feature.FeatureException;
 import org.apache.solr.ltr.norm.IdentityNormalizer;
 import org.apache.solr.ltr.norm.Normalizer;
@@ -144,7 +144,7 @@ public abstract class LTRScoringModel {
   public List<Normalizer> getNorms() {
     return Collections.unmodifiableList(norms);
   }
-  
+
   /**
    * @return the name
    */
@@ -238,7 +238,7 @@ public abstract class LTRScoringModel {
   public String getFeatureStoreName() {
     return featureStoreName;
   }
-  
+
   /**
    * Given a list of normalized values for all features a scoring algorithm
    * cares about, calculate and return a score.
@@ -271,7 +271,7 @@ public abstract class LTRScoringModel {
   public String toString() {
     return  getClass().getSimpleName() + "(name="+getName()+")";
   }
-  
+
   /**
    * Goes through all the stored feature values, and calculates the normalized
    * values for all the features that will be used for scoring.
@@ -282,17 +282,17 @@ public abstract class LTRScoringModel {
       throw new FeatureException("Must have normalizer for every feature");
     }
     for(int idx = 0; idx < modelFeatureValuesNormalized.length; ++idx) {
-      modelFeatureValuesNormalized[idx] = 
+      modelFeatureValuesNormalized[idx] =
           norms.get(idx).normalize(modelFeatureValuesNormalized[idx]);
     }
   }
-  
+
   public Explanation getNormalizerExplanation(Explanation e, int idx) {
     Normalizer n = norms.get(idx);
     if (n != IdentityNormalizer.INSTANCE) {
       return n.explain(e);
     }
     return e;
-  } 
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 0e8d190..8fdab57 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
@@ -26,7 +26,7 @@ import org.apache.solr.ltr.feature.Feature;
 import org.apache.solr.ltr.norm.Normalizer;
 
 /**
- * A scoring model that computes scores using a dot product. 
+ * A scoring model that computes scores using a dot product.
  * Example models are RankSVM and Pranking.
  * <p>
  * Example configuration:
@@ -134,7 +134,9 @@ public class LinearModel extends LTRScoringModel {
     sb.append("(name=").append(getName());
     sb.append(",featureWeights=[");
     for (int ii = 0; ii < features.size(); ++ii) {
-      if (ii>0) sb.append(',');
+      if (ii>0) {
+        sb.append(',');
+      }
       final String key = features.get(ii).getName();
       sb.append(key).append('=').append(featureToWeight[ii]);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 0046b46..fa277cb 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
@@ -316,7 +316,7 @@ public class MultipleAdditiveTreesModel extends LTRScoringModel {
     }
   }
 
- @Override
+  @Override
   public float score(float[] modelFeatureValuesNormalized) {
     float score = 0;
     for (final RegressionTree t : trees) {
@@ -365,7 +365,9 @@ public class MultipleAdditiveTreesModel extends LTRScoringModel {
     sb.append("(name=").append(getName());
     sb.append(",trees=[");
     for (int ii = 0; ii < trees.size(); ++ii) {
-      if (ii>0) sb.append(',');
+      if (ii>0) {
+        sb.append(',');
+      }
       sb.append(trees.get(ii));
     }
     sb.append("])");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 6f9dd86..89c7b45 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
@@ -72,14 +72,15 @@ public class MinMaxNormalizer extends Normalizer {
     this.max = Float.parseFloat(max);
     updateDelta();
   }
-  
+
   @Override
   protected void validate() throws NormalizerException {
     super.validate();
-    if (delta == 0f)
-      throw 
+    if (delta == 0f) {
+      throw
       new NormalizerException("MinMax Normalizer delta must not be zero " +
-      "| min = " + min + ",max = " + max + ",delta = " + delta);
+          "| min = " + min + ",max = " + max + ",delta = " + delta);
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 70b4c92..7d77151 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
@@ -51,16 +51,16 @@ public abstract class Normalizer {
     f.validate();
     return f;
   }
-  
+
   /**
    * On construction of a normalizer, this function confirms
    * that the normalizer parameters are validated
-   * 
+   *
    * @throws NormalizerException
    *             Normalizer Exception
    */
   protected void validate() throws NormalizerException {
-    
+
   }
 
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 51238d9..20a984c 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
@@ -69,14 +69,15 @@ public class StandardNormalizer extends Normalizer {
   public float normalize(float value) {
     return (value - avg) / std;
   }
-  
+
   @Override
   protected void validate() throws NormalizerException {
     super.validate();
-    if (std <= 0f)
-      throw 
+    if (std <= 0f) {
+      throw
       new NormalizerException("Standard Normalizer standard deviation must "
-            + "be positive | avg = " + avg + ",std = " + std);
+          + "be positive | avg = " + avg + ",std = " + std);
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 fca10ad..a557bde 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
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
@@ -34,15 +33,14 @@ import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.rest.BaseSolrResource;
 import org.apache.solr.rest.ManagedResource;
 import org.apache.solr.rest.ManagedResourceObserver;
-import org.apache.solr.rest.ManagedResourceStorage.StorageIO;
+import org.apache.solr.rest.ManagedResourceStorage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Managed resource for a storing a feature.
  */
-public class ManagedFeatureStore extends ManagedResource implements
-    ManagedResource.ChildResourceSupport {
+public class ManagedFeatureStore extends ManagedResource implements ManagedResource.ChildResourceSupport {
 
   public static void registerManagedFeatureStore(SolrResourceLoader solrResourceLoader,
       ManagedResourceObserver managedResourceObserver) {
@@ -84,9 +82,9 @@ public class ManagedFeatureStore extends ManagedResource implements
   private static final String FEATURES_JSON_FIELD = "features";
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  
+
   public ManagedFeatureStore(String resourceId, SolrResourceLoader loader,
-      StorageIO storageIO) throws SolrException {
+      ManagedResourceStorage.StorageIO storageIO) throws SolrException {
     super(resourceId, loader, storageIO);
 
   }
@@ -175,7 +173,7 @@ public class ManagedFeatureStore extends ManagedResource implements
     } else {
       final FeatureStore store = getFeatureStore(childId);
       if (store == null) {
-        throw new SolrException(ErrorCode.BAD_REQUEST,
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
             "missing feature store [" + childId + "]");
       }
       response.add(FEATURES_JSON_FIELD,
@@ -200,7 +198,7 @@ public class ManagedFeatureStore extends ManagedResource implements
     o.put(PARAMS_KEY, feat.paramsToMap());
     return o;
   }
-  
+
   private static Feature fromFeatureMap(SolrResourceLoader solrResourceLoader,
       Map<String,Object> featureMap) {
     final String className = (String) featureMap.get(CLASS_KEY);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/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 c4addfb..8436751 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
@@ -21,8 +21,8 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrResourceLoader;
@@ -37,15 +37,14 @@ import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.rest.BaseSolrResource;
 import org.apache.solr.rest.ManagedResource;
 import org.apache.solr.rest.ManagedResourceObserver;
-import org.apache.solr.rest.ManagedResourceStorage.StorageIO;
+import org.apache.solr.rest.ManagedResourceStorage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Menaged resource for storing a model
  */
-public class ManagedModelStore extends ManagedResource implements
-    ManagedResource.ChildResourceSupport {
+public class ManagedModelStore extends ManagedResource implements ManagedResource.ChildResourceSupport {
 
   public static void registerManagedModelStore(SolrResourceLoader solrResourceLoader,
       ManagedResourceObserver managedResourceObserver) {
@@ -63,9 +62,6 @@ public class ManagedModelStore extends ManagedResource implements
   /** the model store rest endpoint **/
   public static final String REST_END_POINT = "/schema/model-store";
 
-  /** name of the attribute containing the features used by the mode **/
-  private static final Object MODEL_FEATURE_LIST = "features";
-
   /**
    * Managed model store: the name of the attribute containing all the models of
    * a model store
@@ -89,9 +85,9 @@ public class ManagedModelStore extends ManagedResource implements
   private ManagedFeatureStore managedFeatureStore;
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  
+
   public ManagedModelStore(String resourceId, SolrResourceLoader loader,
-      StorageIO storageIO) throws SolrException {
+      ManagedResourceStorage.StorageIO storageIO) throws SolrException {
     super(resourceId, loader, storageIO);
     store = new ModelStore();
   }
@@ -131,7 +127,7 @@ public class ManagedModelStore extends ManagedResource implements
           final LTRScoringModel algo = fromLTRScoringModelMap(solrResourceLoader, u, managedFeatureStore);
           addModel(algo);
         } catch (final ModelException e) {
-          throw new SolrException(ErrorCode.BAD_REQUEST, e);
+          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
         }
       }
     }
@@ -142,7 +138,7 @@ public class ManagedModelStore extends ManagedResource implements
       log.info("adding model {}", ltrScoringModel.getName());
       store.addModel(ltrScoringModel);
     } catch (final ModelException e) {
-      throw new SolrException(ErrorCode.BAD_REQUEST, e);
+      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
     }
   }
 
@@ -156,7 +152,7 @@ public class ManagedModelStore extends ManagedResource implements
           final LTRScoringModel algo = fromLTRScoringModelMap(solrResourceLoader, u, managedFeatureStore);
           addModel(algo);
         } catch (final ModelException e) {
-          throw new SolrException(ErrorCode.BAD_REQUEST, e);
+          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
         }
       }
     }
@@ -167,7 +163,7 @@ public class ManagedModelStore extends ManagedResource implements
         final LTRScoringModel algo = fromLTRScoringModelMap(solrResourceLoader, map, managedFeatureStore);
         addModel(algo);
       } catch (final ModelException e) {
-        throw new SolrException(ErrorCode.BAD_REQUEST, e);
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/response/transform/LTRFeatureLoggerTransformerFactory.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/response/transform/LTRFeatureLoggerTransformerFactory.java b/solr/contrib/ltr/src/java/org/apache/solr/response/transform/LTRFeatureLoggerTransformerFactory.java
index 605b990..d144292 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/response/transform/LTRFeatureLoggerTransformerFactory.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/response/transform/LTRFeatureLoggerTransformerFactory.java
@@ -25,24 +25,20 @@ import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.search.Explanation;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.ltr.FeatureLogger;
 import org.apache.solr.ltr.LTRRescorer;
 import org.apache.solr.ltr.LTRScoringQuery;
-import org.apache.solr.ltr.LTRScoringQuery.ModelWeight;
 import org.apache.solr.ltr.LTRThreadModule;
-import org.apache.solr.ltr.feature.Feature;
 import org.apache.solr.ltr.SolrQueryRequestContextUtils;
+import org.apache.solr.ltr.feature.Feature;
 import org.apache.solr.ltr.model.LTRScoringModel;
 import org.apache.solr.ltr.norm.Normalizer;
 import org.apache.solr.ltr.store.FeatureStore;
 import org.apache.solr.ltr.store.rest.ManagedFeatureStore;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.ResultContext;
-import org.apache.solr.response.transform.DocTransformer;
-import org.apache.solr.response.transform.TransformerFactory;
 import org.apache.solr.search.LTRQParserPlugin;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.util.SolrPluginUtils;
@@ -124,7 +120,7 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
     private List<LeafReaderContext> leafContexts;
     private SolrIndexSearcher searcher;
     private LTRScoringQuery scoringQuery;
-    private ModelWeight modelWeight;
+    private LTRScoringQuery.ModelWeight modelWeight;
     private FeatureLogger<?> featureLogger;
     private boolean docsWereNotReranked;
 
@@ -158,7 +154,7 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
       searcher = context.getSearcher();
       if (searcher == null) {
         throw new SolrException(
-            org.apache.solr.common.SolrException.ErrorCode.BAD_REQUEST,
+            SolrException.ErrorCode.BAD_REQUEST,
             "searcher is null");
       }
       leafContexts = searcher.getTopReaderContext().leaves();
@@ -174,13 +170,13 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
 
         final FeatureStore store = fr.getFeatureStore(featureStoreName);
         featureStoreName = store.getName(); // if featureStoreName was null before this gets actual name
-        
+
         try {
           final LoggingModel lm = new LoggingModel(loggingModelName,
               featureStoreName, store.getFeatures());
-          
-          scoringQuery = new LTRScoringQuery(lm, 
-              LTRQParserPlugin.extractEFIParams(params), 
+
+          scoringQuery = new LTRScoringQuery(lm,
+              LTRQParserPlugin.extractEFIParams(params),
               true,
               threadManager); // request feature weights to be created for all features
 
@@ -188,7 +184,7 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
           scoringQuery.setOriginalQuery(context.getQuery());
 
         }catch (final Exception e) {
-          throw new SolrException(ErrorCode.BAD_REQUEST,
+          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
               "retrieving the feature store "+featureStoreName, e);
         }
       }
@@ -203,10 +199,10 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
       try {
         modelWeight = scoringQuery.createWeight(searcher, true, 1f);
       } catch (final IOException e) {
-        throw new SolrException(ErrorCode.BAD_REQUEST, e.getMessage(), e);
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.getMessage(), e);
       }
       if (modelWeight == null) {
-        throw new SolrException(ErrorCode.BAD_REQUEST,
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
             "error logging the features, model weight is null");
       }
     }
@@ -236,7 +232,7 @@ public class LTRFeatureLoggerTransformerFactory extends TransformerFactory {
           featureStoreName, allFeatures, Collections.emptyMap());
     }
 
-    protected LoggingModel(String name, List<Feature> features, 
+    protected LoggingModel(String name, List<Feature> features,
         List<Normalizer> norms, String featureStoreName,
         List<Feature> allFeatures, Map<String,Object> params) {
       super(name, features, norms, featureStoreName, allFeatures, params);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/response/transform/package-info.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/response/transform/package-info.java b/solr/contrib/ltr/src/java/org/apache/solr/response/transform/package-info.java
index 7b48f36..bab3ebf 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/response/transform/package-info.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/response/transform/package-info.java
@@ -14,8 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
-/** 
+
+/**
  * APIs and implementations of {@link org.apache.solr.response.transform.DocTransformer} for modifying documents in Solr request responses
  */
 package org.apache.solr.response.transform;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/search/LTRQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/search/LTRQParserPlugin.java b/solr/contrib/ltr/src/java/org/apache/solr/search/LTRQParserPlugin.java
index ad2e81c..40cbaa9 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/search/LTRQParserPlugin.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/search/LTRQParserPlugin.java
@@ -27,23 +27,19 @@ import org.apache.lucene.analysis.util.ResourceLoaderAware;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.Query;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
+import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.ltr.LTRRescorer;
-import org.apache.solr.ltr.LTRThreadModule;
 import org.apache.solr.ltr.LTRScoringQuery;
+import org.apache.solr.ltr.LTRThreadModule;
 import org.apache.solr.ltr.SolrQueryRequestContextUtils;
 import org.apache.solr.ltr.model.LTRScoringModel;
-import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.ltr.store.rest.ManagedFeatureStore;
 import org.apache.solr.ltr.store.rest.ManagedModelStore;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.rest.ManagedResource;
 import org.apache.solr.rest.ManagedResourceObserver;
-import org.apache.solr.search.QParser;
-import org.apache.solr.search.QParserPlugin;
-import org.apache.solr.search.SyntaxError;
 import org.apache.solr.util.SolrPluginUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,7 +56,7 @@ public class LTRQParserPlugin extends QParserPlugin implements ResourceLoaderAwa
   private static Query defaultQuery = new MatchAllDocsQuery();
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  
+
   // params for setting custom external info that features can use, like query
   // intent
   static final String EXTERNAL_FEATURE_INFO = "efi.";
@@ -88,13 +84,13 @@ public class LTRQParserPlugin extends QParserPlugin implements ResourceLoaderAwa
     threadManager = LTRThreadModule.getInstance(args);
     SolrPluginUtils.invokeSetters(this, args);
   }
-  
+
   @Override
   public QParser createParser(String qstr, SolrParams localParams,
       SolrParams params, SolrQueryRequest req) {
     return new LTRQParser(qstr, localParams, params, req);
   }
-  
+
   /**
    * Given a set of local SolrParams, extract all of the efi.key=value params into a map
    * @param localParams Local request parameters that might conatin efi params
@@ -114,7 +110,7 @@ public class LTRQParserPlugin extends QParserPlugin implements ResourceLoaderAwa
     }
     return externalFeatureInfo;
   }
-  
+
 
   @Override
   public void inform(ResourceLoader loader) throws IOException {
@@ -126,15 +122,15 @@ public class LTRQParserPlugin extends QParserPlugin implements ResourceLoaderAwa
   @Override
   public void onManagedResourceInitialized(NamedList<?> args, ManagedResource res) throws SolrException {
     if (res instanceof ManagedFeatureStore) {
-        fr = (ManagedFeatureStore)res;
+      fr = (ManagedFeatureStore)res;
     }
     if (res instanceof ManagedModelStore){
-        mr = (ManagedModelStore)res;
+      mr = (ManagedModelStore)res;
     }
     if (mr != null && fr != null){
-        mr.setManagedFeatureStore(fr);
-        // now we can safely load the models
-        mr.loadStoredModels();
+      mr.setManagedFeatureStore(fr);
+      // now we can safely load the models
+      mr.loadStoredModels();
 
     }
   }
@@ -154,10 +150,10 @@ public class LTRQParserPlugin extends QParserPlugin implements ResourceLoaderAwa
         throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
             "Must provide model in the request");
       }
-     
+
       final LTRScoringModel ltrScoringModel = mr.getModel(modelName);
       if (ltrScoringModel == null) {
-        throw new SolrException(ErrorCode.BAD_REQUEST,
+        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
             "cannot find " + LTRQParserPlugin.MODEL + " " + modelName);
       }
 
@@ -166,13 +162,13 @@ public class LTRQParserPlugin extends QParserPlugin implements ResourceLoaderAwa
       final String fvStoreName = SolrQueryRequestContextUtils.getFvStoreName(req);
       // Check if features are requested and if the model feature store and feature-transform feature store are the same
       final boolean featuresRequestedFromSameStore = (modelFeatureStoreName.equals(fvStoreName) || fvStoreName == null) ? extractFeatures:false;
-      
-      final LTRScoringQuery scoringQuery = new LTRScoringQuery(ltrScoringModel, 
-          extractEFIParams(localParams), 
+
+      final LTRScoringQuery scoringQuery = new LTRScoringQuery(ltrScoringModel,
+          extractEFIParams(localParams),
           featuresRequestedFromSameStore, threadManager);
 
       // Enable the feature vector caching if we are extracting features, and the features
-      // we requested are the same ones we are reranking with 
+      // we requested are the same ones we are reranking with
       if (featuresRequestedFromSameStore) {
         scoringQuery.setFeatureLogger( SolrQueryRequestContextUtils.getFeatureLogger(req) );
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/java/org/apache/solr/search/package-info.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/search/package-info.java b/solr/contrib/ltr/src/java/org/apache/solr/search/package-info.java
index 67940b6..2286a93 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/search/package-info.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/search/package-info.java
@@ -14,8 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
-/** 
+
+/**
  * APIs and classes for {@linkplain org.apache.solr.search.QParserPlugin parsing} and {@linkplain org.apache.solr.search.SolrIndexSearcher processing} search requests
  */
 package org.apache.solr.search;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
index a8f938d..0eb661e 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
@@ -16,8 +16,8 @@
 package org.apache.solr.ltr;
 
 import java.io.File;
-import java.lang.invoke.MethodHandles;
 import java.util.SortedMap;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
@@ -28,25 +28,20 @@ import org.apache.solr.cloud.AbstractDistribZkTestBase;
 import org.apache.solr.cloud.MiniSolrCloudCluster;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.ltr.TestRerankBase;
 import org.apache.solr.ltr.feature.SolrFeature;
 import org.apache.solr.ltr.feature.ValueFeature;
 import org.apache.solr.ltr.model.LinearModel;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.AfterClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class TestLTROnSolrCloud extends TestRerankBase {
 
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
   private MiniSolrCloudCluster solrCluster;
   String solrconfig = "solrconfig-ltr.xml";
   String schema = "schema-ltr.xml";
-    
-  SortedMap<ServletHolder,String> extraServlets = null; 
+
+  SortedMap<ServletHolder,String> extraServlets = null;
 
   @Override
   public void setUp() throws Exception {
@@ -138,7 +133,7 @@ public class TestLTROnSolrCloud extends TestRerankBase {
   private void createCollection(String name, String config, int numShards, int numReplicas, int maxShardsPerNode)
       throws Exception {
     CollectionAdminResponse response;
-    CollectionAdminRequest.Create create = 
+    CollectionAdminRequest.Create create =
         CollectionAdminRequest.createCollection(name, config, numShards, numReplicas);
     create.setMaxShardsPerNode(maxShardsPerNode);
     response = create.process(solrCluster.getSolrClient());
@@ -199,14 +194,14 @@ public class TestLTROnSolrCloud extends TestRerankBase {
     );
     reloadCollection(COLLECTION);
   }
-  
+
   private void reloadCollection(String collection) throws Exception {
     CollectionAdminRequest.Reload reloadRequest = CollectionAdminRequest.reloadCollection(collection);
     CollectionAdminResponse response = reloadRequest.process(solrCluster.getSolrClient());
     assertEquals(0, response.getStatus());
     assertTrue(response.isSuccess());
   }
-  
+
   @AfterClass
   public static void after() throws Exception {
     FileUtils.deleteDirectory(tmpSolrHome);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java
index 8a46336..eb79249 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java
@@ -18,7 +18,6 @@ package org.apache.solr.ltr;
 
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.ltr.TestRerankBase;
 import org.apache.solr.ltr.model.LinearModel;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -51,7 +50,7 @@ public class TestLTRQParserExplain extends TestRerankBase {
     query.add("rows", "2");
     query.add("rq", "{!ltr reRankDocs=2 model=linear2}");
     query.add("fl", "*,score");
-    
+
     assertJQ(
         "/query" + query.toQueryString(),
         "/debug/explain/9=='\n13.5 = LinearModel(name=linear2,featureWeights=[constant1=1.5,constant2=3.5,pop=1.0]) model applied to features, sum of:\n  1.5 = prod of:\n    1.5 = weight on feature\n    1.0 = ValueFeature [name=constant1, params={value=1}]\n  7.0 = prod of:\n    3.5 = weight on feature\n    2.0 = ValueFeature [name=constant2, params={value=2}]\n  5.0 = prod of:\n    1.0 = weight on feature\n    5.0 = FieldValueFeature [name=pop, params={field=popularity}]\n'");
@@ -79,7 +78,7 @@ public class TestLTRQParserExplain extends TestRerankBase {
         + "queryIntentPerson=0.1231231,"
         + "queryIntentCompany=0.12121211"
         + "]) model applied to features, sum of:\n  0.0 = prod of:\n    0.0 = weight on feature\n    1.0 = ValueFeature [name=title, params={value=1}]\n  0.2 = prod of:\n    0.1 = weight on feature\n    2.0 = ValueFeature [name=description, params={value=2}]\n  0.4 = prod of:\n    0.2 = weight on feature\n    2.0 = ValueFeature [name=keywords, params={value=2}]\n  0.09 = prod of:\n    0.3 = weight on feature\n    0.3 = "+expectedExplainNormalizer+"\n      3.0 = ValueFeature [name=popularity, params={value=3}]\n  1.6 = prod of:\n    0.4 = weight on feature\n    4.0 = ValueFeature [name=text, params={value=4}]\n  0.6156155 = prod of:\n    0.1231231 = weight on feature\n    5.0 = ValueFeature [name=queryIntentPerson, params={value=5}]\n  0.60606056 = prod of:\n    0.12121211 = weight on feature\n    5.0 = ValueFeature [name=queryIntentCompany, params={value=5}]\n";
-    
+
     assertJQ(
         "/query" + query.toQueryString(),
         "/debug/explain/7=='"+expectedExplain+"'}");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4e444db6/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java
index 256aa92..c3f7dea 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java
@@ -18,7 +18,6 @@ package org.apache.solr.ltr;
 
 import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.ltr.TestRerankBase;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -71,37 +70,37 @@ public class TestLTRQParserPlugin extends TestRerankBase {
     assert (res.contains("cannot find model"));
   }
 
-  @Test    
-  public void ltrMoreResultsThanReRankedTest() throws Exception {   
-    final String solrQuery = "_query_:{!edismax qf='title' mm=100% v='bloomberg' tie=0.1}";   
-    final SolrQuery query = new SolrQuery();    
-    query.setQuery(solrQuery);    
-    query.add("fl", "*, score");    
-    query.add("rows", "4");   
-    query.add("fv", "true");    
-       
+  @Test
+  public void ltrMoreResultsThanReRankedTest() throws Exception {
+    final String solrQuery = "_query_:{!edismax qf='title' mm=100% v='bloomberg' tie=0.1}";
+    final SolrQuery query = new SolrQuery();
+    query.setQuery(solrQuery);
+    query.add("fl", "*, score");
+    query.add("rows", "4");
+    query.add("fv", "true");
+
     String nonRerankedScore = "0.09271725";
-    
+
     // Normal solr order
-    assertJQ("/query" + query.toQueryString(), 
+    assertJQ("/query" + query.toQueryString(),
         "/response/docs/[0]/id=='9'",
         "/response/docs/[1]/id=='8'",
         "/response/docs/[2]/id=='7'",
         "/response/docs/[3]/id=='6'",
         "/response/docs/[3]/score=="+nonRerankedScore
-    );    
-    
+    );
+
     query.add("rq", "{!ltr model=6029760550880411648 reRankDocs=3}");
-    
+
     // Different order for top 3 reranked, but last one is the same top nonreranked doc
-    assertJQ("/query" + query.toQueryString(), 
+    assertJQ("/query" + query.toQueryString(),
         "/response/docs/[0]/id=='7'",
         "/response/docs/[1]/id=='8'",
         "/response/docs/[2]/id=='9'",
         "/response/docs/[3]/id=='6'",
         "/response/docs/[3]/score=="+nonRerankedScore
-    );    
-  }  
+    );
+  }
 
   @Test
   public void ltrNoResultsTest() throws Exception {