You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2010/12/25 06:08:55 UTC
svn commit: r1052752 - in /lucene/dev/trunk/solr/src:
java/org/apache/solr/core/ java/org/apache/solr/request/
java/org/apache/solr/util/ webapp/src/org/apache/solr/servlet/
Author: yonik
Date: Sat Dec 25 05:08:55 2010
New Revision: 1052752
URL: http://svn.apache.org/viewvc?rev=1052752&view=rev
Log:
SOLR-1930: remove solr deprecations
Modified:
lucene/dev/trunk/solr/src/java/org/apache/solr/core/SolrCore.java
lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequest.java
lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java
lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java
lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/core/SolrCore.java?rev=1052752&r1=1052751&r2=1052752&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/core/SolrCore.java Sat Dec 25 05:08:55 2010
@@ -1375,18 +1375,7 @@ public final class SolrCore implements S
}
- /**
- * @deprecated Use {@link #execute(SolrRequestHandler, SolrQueryRequest, SolrQueryResponse)} instead.
- */
- @Deprecated
- public void execute(SolrQueryRequest req, SolrQueryResponse rsp) {
- SolrRequestHandler handler = getRequestHandler(req.getQueryType());
- if (handler==null) {
- log.warn(logid+"Unknown Request Handler '" + req.getQueryType() +"' :" + req);
- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + req.getQueryType() + "'", true);
- }
- execute(handler, req, rsp);
- }
+
public static void setResponseHeaderValues(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) {
// TODO should check that responseHeader has not been replaced by handler
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequest.java?rev=1052752&r1=1052751&r2=1052752&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequest.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequest.java Sat Dec 25 05:08:55 2010
@@ -63,50 +63,6 @@ public interface SolrQueryRequest {
*/
public void close();
- /**
- * Returns the input parameter value for the specified name
- * @return the value, or the first value if the parameter was
- * specified more then once; may be null.
- * @deprecated Use {@link #getParams()} instead.
- */
- @Deprecated
- public String getParam(String name);
-
- /**
- * Returns the input parameter values for the specified name
- * @return the values; may be null or empty depending on implementation
- * @deprecated Use {@link #getParams()} instead.
- */
- @Deprecated
- public String[] getParams(String name);
-
- /**
- * Returns the primary query string parameter of the request
- * @deprecated Use {@link #getParams()} and {@link CommonParams#Q} instead.
- */
- @Deprecated
- public String getQueryString();
-
- /**
- * Signifies the syntax and the handler that should be used
- * to execute this query.
- * @deprecated Use {@link #getParams()} and {@link CommonParams#QT} instead.
- */
- @Deprecated
- public String getQueryType();
-
- /** starting position in matches to return to client
- * @deprecated Use {@link #getParams()} and {@link CommonParams#START} instead.
- */
- @Deprecated
- public int getStart();
-
- /** number of matching documents to return
- * @deprecated Use {@link #getParams()} and {@link CommonParams#ROWS} instead.
- */
- @Deprecated
- public int getLimit();
-
/** The start time of this request in milliseconds */
public long getStartTime();
@@ -124,11 +80,6 @@ public interface SolrQueryRequest {
* Suitable for logging.
*/
public String getParamString();
-
- /******
- // Get the current elapsed time in milliseconds
- public long getElapsedTime();
- ******/
}
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java?rev=1052752&r1=1052751&r2=1052752&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/request/SolrQueryRequestBase.java Sat Dec 25 05:08:55 2010
@@ -43,32 +43,6 @@ import java.util.HashMap;
* @version $Id$
*/
public abstract class SolrQueryRequestBase implements SolrQueryRequest {
- /**
- * @deprecated Use org.apache.solr.common.params.CommonParams
- */
- @Deprecated
- public static final String QUERY_NAME="q";
- /**
- * @deprecated Use org.apache.solr.common.params.CommonParams
- */
- @Deprecated
- public static final String START_NAME="start";
- /**
- * @deprecated Use org.apache.solr.common.params.CommonParams
- */
- @Deprecated
- public static final String ROWS_NAME="rows";
- /**
- * @deprecated Use org.apache.solr.common.params.CommonParams
- */
- @Deprecated
- public static final String XSL_NAME="xsl";
- /**
- * @deprecated Use org.apache.solr.common.params.CommonParams
- */
- @Deprecated
- public static final String QUERYTYPE_NAME="qt";
-
protected final SolrCore core;
protected final SolrParams origParams;
protected SolrParams params;
@@ -98,99 +72,6 @@ public abstract class SolrQueryRequestBa
this.params = params;
}
- /**
- * @deprecated Use {@link #getParams()} instead.
- */
- @Deprecated
- public String getParam(String name) {
- return params.get(name);
- }
-
- /**
- * @deprecated Use {@link #getParams()} instead.
- */
- @Deprecated
- public String[] getParams(String name) {
- return params.getParams(name);
- }
-
- /**
- * @deprecated use getParams().required().getInt( name ) instead
- */
- @Deprecated
- public int getIntParam(String name) {
- String s = getParam(name);
- if (s==null) {
- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Missing required parameter '"+name+"' from " + this);
- }
- return Integer.parseInt(s);
- }
-
- /**
- * @deprecated use getParams().required().getInt( name ) instead
- */
- @Deprecated
- public int getIntParam(String name, int defval) {
- String s = getParam(name);
- return s==null ? defval : Integer.parseInt(s);
- }
-
- /**
- * @deprecated use getParams().required().getParam( name ) instead
- */
- @Deprecated
- public String getStrParam(String name) {
- String s = getParam(name);
- if (s==null) {
- throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,"Missing required parameter '"+name+"' from " + this);
- }
- return s;
- }
-
- /**
- * @deprecated use getParams().required().getParam( name ) instead
- */
- @Deprecated
- public String getStrParam(String name, String defval) {
- String s = getParam(name);
- return s==null ? defval : s;
- }
-
- /**
- * @deprecated Use {@link #getParams()} and {@link CommonParams#Q} instead.
- */
- @Deprecated
- public String getQueryString() {
- return params.get(CommonParams.Q);
- }
-
- /**
- * @deprecated Use {@link #getParams()} and {@link CommonParams#QT} instead.
- */
- @Deprecated
- public String getQueryType() {
- return params.get(CommonParams.QT);
- }
-
- /**
- * starting position in matches to return to client
- * @deprecated Use {@link #getParams()} and {@link CommonParams#START} instead.
- */
- @Deprecated
- public int getStart() {
- return params.getInt(CommonParams.START, 0);
- }
-
- /**
- * number of matching documents to return
- * @deprecated Use {@link #getParams()} and {@link CommonParams#ROWS} instead.
- */
- @Deprecated
- public int getLimit() {
- return params.getInt(CommonParams.ROWS, 10);
- }
-
-
protected final long startTime=System.currentTimeMillis();
// Get the start time of this request in milliseconds
public long getStartTime() {
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1052752&r1=1052751&r2=1052752&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/util/SolrPluginUtils.java Sat Dec 25 05:08:55 2010
@@ -64,17 +64,6 @@ import java.lang.reflect.InvocationTarge
* default parameter settings.
*/
public class SolrPluginUtils {
- final static Logger log = LoggerFactory.getLogger( SolrPluginUtils.class );
-
- /**
- * Set defaults on a SolrQueryRequest.
- *
- * RequestHandlers can use this method to ensure their defaults are
- * visible to other components such as the response writer
- */
- public static void setDefaults(SolrQueryRequest req, SolrParams defaults) {
- setDefaults(req, defaults, null, null);
- }
/**
* Set default-ish params on a SolrQueryRequest.
@@ -104,13 +93,6 @@ public class SolrPluginUtils {
}
- /**
- * standard param for field list
- *
- * @deprecated Use org.apache.solr.common.params.CommonParams.FL.
- */
- @Deprecated
- public static String FL = CommonParams.FL;
/**
* SolrIndexSearch.numDocs(Query,Query) freaks out if the filtering
@@ -123,59 +105,10 @@ public class SolrPluginUtils {
}
- /**
- * Returns the param, or the default if it's empty or not specified.
- * @deprecated use SolrParam.get(String,String)
- */
- @Deprecated
- public static String getParam(SolrQueryRequest req,
- String param, String def) {
- String v = req.getParam(param);
- // Note: parameters passed but given only white-space value are
- // considered equivalent to passing nothing for that parameter.
- if (null == v || "".equals(v.trim())) {
- return def;
- }
- return v;
- }
- /**
- * Treats the param value as a Number, returns the default if nothing is
- * there or if it's not a number.
- * @deprecated use SolrParam.getFloat(String,float)
- */
- @Deprecated
- public static Number getNumberParam(SolrQueryRequest req,
- String param, Number def) {
- Number r = def;
- String v = req.getParam(param);
- if (null == v || "".equals(v.trim())) {
- return r;
- }
- try {
- r = new Float(v);
- } catch (NumberFormatException e) {
- /* :NOOP" */
- }
- return r;
- }
- /**
- * Treats parameter value as a boolean. The string 'false' is false;
- * any other non-empty string is true.
- * @deprecated use SolrParam.getBool(String,boolean)
- */
- @Deprecated
- public static boolean getBooleanParam(SolrQueryRequest req,
- String param, boolean def) {
- String v = req.getParam(param);
- if (null == v || "".equals(v.trim())) {
- return def;
- }
- return !"false".equals(v.trim());
- }
private final static Pattern splitList=Pattern.compile(",| ");
@@ -451,23 +384,6 @@ public class SolrPluginUtils {
return out;
}
- /**
- * Generates an list of Explanations for each item in a list of docs.
- *
- * @param query The Query you want explanations in the context of
- * @param docs The Documents you want explained relative that query
- * @deprecated this returns the explanations as Strings, instead it
- * is recommeded to use getExplanations and call toString()
- * yourself, or use explanationsToNamedLists
- */
- @Deprecated
- public static NamedList getExplainList(Query query, DocList docs,
- SolrIndexSearcher searcher,
- IndexSchema schema)
- throws IOException {
-
- return explanationsToStrings(getExplanations(query,docs,searcher,schema));
- }
/**
* Executes a basic query
@@ -536,33 +452,6 @@ public class SolrPluginUtils {
}
return out;
}
- /**
- * Given a string containing functions with optional boosts, returns
- * an array of Queries representing those functions with the specified
- * boosts.
- * <p>
- * NOTE: intra-function whitespace is not allowed.
- * </p>
- * @see #parseFieldBoosts
- * @deprecated
- */
- @Deprecated
- public static List<Query> parseFuncs(IndexSchema s, String in)
- throws ParseException {
-
- Map<String,Float> ff = parseFieldBoosts(in);
- List<Query> funcs = new ArrayList<Query>(ff.keySet().size());
- for (String f : ff.keySet()) {
- Query fq = QueryParsing.parseFunction(f, s);
- Float b = ff.get(f);
- if (null != b) {
- fq.setBoost(b);
- }
- funcs.add(fq);
- }
- return funcs;
- }
-
/**
* Checks the number of optional clauses in the query, and compares it
@@ -885,15 +774,6 @@ public class SolrPluginUtils {
return ss;
}
- /**
- * Builds a list of Query objects that should be used to filter results
- * @see CommonParams#FQ
- * @return null if no filter queries
- */
- public static List<Query> parseFilterQueries(SolrQueryRequest req) throws ParseException {
- return parseQueryStrings(req, req.getParams().getParams(CommonParams.FQ));
- }
-
/** Turns an array of query strings into a List of Query objects.
*
* @return null if no queries are generated
@@ -984,27 +864,6 @@ public class SolrPluginUtils {
}
-
- /**
- * Given a SolrQueryResponse replace the DocList if it is in the result.
- * Otherwise add it to the response
- *
- * @since solr 1.4
- */
- public static void addOrReplaceResults(SolrQueryResponse rsp, SolrDocumentList docs)
- {
- NamedList vals = rsp.getValues();
- int idx = vals.indexOf( "response", 0 );
- if( idx >= 0 ) {
- log.debug("Replacing DocList with SolrDocumentList " + docs.size());
- vals.setVal( idx, docs );
- }
- else {
- log.debug("Adding SolrDocumentList response" + docs.size());
- vals.add( "response", docs );
- }
- }
-
public static void invokeSetters(Object bean, NamedList initArgs) {
if (initArgs == null) return;
Class clazz = bean.getClass();
Modified: lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java?rev=1052752&r1=1052751&r2=1052752&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java (original)
+++ lucene/dev/trunk/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java Sat Dec 25 05:08:55 2010
@@ -21,6 +21,7 @@ import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
+import org.apache.solr.common.params.CommonParams;
import org.apache.solr.request.SolrRequestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,11 +79,11 @@ public class SolrServlet extends HttpSer
SolrServletRequest solrReq = new SolrServletRequest(core, request);;
SolrQueryResponse solrRsp = new SolrQueryResponse();
try {
-
- SolrRequestHandler handler = core.getRequestHandler(solrReq.getQueryType());
+ String qt = solrReq.getParams().get(CommonParams.QT);
+ SolrRequestHandler handler = core.getRequestHandler(solrReq.getParams().get(CommonParams.QT));
if (handler==null) {
- log.warn("Unknown Request Handler '" + solrReq.getQueryType() +"' :" + solrReq);
- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + solrReq.getQueryType() + "'", true);
+ log.warn("Unknown Request Handler '" + qt +"' :" + solrReq);
+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + qt + "'", true);
}
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(solrReq, solrRsp));
core.execute(handler, solrReq, solrRsp );