Skip to content

Commit

Permalink
Remove LTRException, move FeatureException. (apache#82)
Browse files Browse the repository at this point in the history
* Remove hardly used LTRException.

Also param name tweaks for FeatureException and ModelException.

* Relocate FeatureException from ltr.util to ltr.feature package.
  • Loading branch information
cpoerschke authored and Michael Nilsson committed Sep 26, 2016
1 parent 269998c commit 4bee76f
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.ltr.util;
package org.apache.solr.ltr.feature;

public class FeatureException extends LTRException {
public class FeatureException extends RuntimeException {

private static final long serialVersionUID = 1L;

public FeatureException(String msg) {
super(msg);
public FeatureException(String message) {
super(message);
}

public FeatureException(String msg, Exception parent) {
super(msg, parent);
public FeatureException(String message, Exception cause) {
super(message, cause);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.util.FeatureException;

public class FeatureStore {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.solr.ltr.feature.norm.Normalizer;
import org.apache.solr.ltr.feature.norm.impl.IdentityNormalizer;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.util.FeatureException;

/**
* Contains all the data needed for loading a model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.apache.solr.ltr.feature.FeatureException;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.util.FeatureException;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.QParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.solr.ltr.feature.FeatureException;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.util.FeatureException;
import org.apache.solr.ltr.util.LTRUtils;
import org.apache.solr.request.SolrQueryRequest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrResourceLoader;
import org.apache.solr.ltr.feature.FeatureException;
import org.apache.solr.ltr.feature.FeatureStore;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.util.CommonLTRParams;
import org.apache.solr.ltr.util.FeatureException;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.rest.BaseSolrResource;
import org.apache.solr.rest.ManagedResource;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
*/
package org.apache.solr.ltr.util;

public class ModelException extends LTRException {
public class ModelException extends RuntimeException {

private static final long serialVersionUID = 1L;

public ModelException(String message) {
super(message);
}

public ModelException(String message, Exception parent) {
super(message, parent);
public ModelException(String message, Exception cause) {
super(message, cause);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.ContentStreamBase;
import org.apache.solr.core.SolrResourceLoader;
import org.apache.solr.ltr.feature.FeatureException;
import org.apache.solr.ltr.feature.LTRScoringAlgorithm;
import org.apache.solr.ltr.feature.impl.ValueFeature;
import org.apache.solr.ltr.feature.impl.ValueFeature.ValueFeatureWeight;
Expand All @@ -46,7 +47,6 @@
import org.apache.solr.ltr.rest.ManagedFeatureStore;
import org.apache.solr.ltr.rest.ManagedModelStore;
import org.apache.solr.ltr.util.CommonLTRParams;
import org.apache.solr.ltr.util.FeatureException;
import org.apache.solr.ltr.util.ModelException;
import org.apache.solr.request.SolrQueryRequestBase;
import org.apache.solr.response.SolrQueryResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.solr.ltr.feature.impl.OriginalScoreFeature;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.rest.ManagedFeatureStore;
import org.apache.solr.ltr.util.FeatureException;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.junit.AfterClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.solr.ltr.feature.impl.ValueFeature;
import org.apache.solr.ltr.ranking.Feature;
import org.apache.solr.ltr.rest.ManagedFeatureStore;
import org.apache.solr.ltr.util.FeatureException;
import org.junit.BeforeClass;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void testRankingSolrFeature() throws Exception {
query.add("rq", "{!ltr model=powdesS-model reRankDocs=4}");

assertJQ("/query" + query.toQueryString(),
"/error/msg/=='org.apache.solr.ltr.util.FeatureException: " +
"/error/msg/=='org.apache.solr.ltr.feature.FeatureException: " +
"java.lang.UnsupportedOperationException: " +
"Unable to extract feature for powdesS'");
// aftertest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.ltr.TestRerankBase;
import org.apache.solr.ltr.feature.FeatureException;
import org.apache.solr.ltr.ranking.RankSVMModel;
import org.apache.solr.ltr.util.FeatureException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down

0 comments on commit 4bee76f

Please sign in to comment.