Skip to content

Apache Lucene open-source search software

SOLR-3313 Rename Query Type to Request Handler

David Wayne Smileyf12b94ab86e3
diff --git a/solr/contrib/clustering/src/test-files/clustering/solr/conf/solrconfig.xml b/solr/contrib/clustering/src/test-files/clustering/solr/conf/solrconfig.xml
index 430c0616564..44728523d17 100644
--- a/solr/contrib/clustering/src/test-files/clustering/solr/conf/solrconfig.xml
+++ b/solr/contrib/clustering/src/test-files/clustering/solr/conf/solrconfig.xml
@@ -265,7 +265,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/contrib/dataimporthandler-extras/src/test-files/dihextras/solr/conf/dataimport-solrconfig.xml b/solr/contrib/dataimporthandler-extras/src/test-files/dihextras/solr/conf/dataimport-solrconfig.xml
index ca6186cbe42..1b263dd6ee2 100644
--- a/solr/contrib/dataimporthandler-extras/src/test-files/dihextras/solr/conf/dataimport-solrconfig.xml
+++ b/solr/contrib/dataimporthandler-extras/src/test-files/dihextras/solr/conf/dataimport-solrconfig.xml
@@ -219,7 +219,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java
index bdfaee454c4..0f7824a3c99 100644
--- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java
+++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SolrEntityProcessor.java
@@ -69,7 +69,7 @@ public class SolrEntityProcessor extends EntityProcessorBase {
private int rows = ROWS_DEFAULT;
private String[] filterQueries;
private String[] fields;
- private String queryType;
+ private String requestHandler;// 'qt' param
private int timeout = TIMEOUT_SECS;
private boolean initDone = false;
@@ -169,7 +169,7 @@ public class SolrEntityProcessor extends EntityProcessorBase {
if (fieldsAsString != null) {
this.fields = fieldsAsString.split(",");
}
- this.queryType = context.getResolvedEntityAttribute(CommonParams.QT);
+ this.requestHandler = context.getResolvedEntityAttribute(CommonParams.QT);
String timeoutAsString = context.getResolvedEntityAttribute(TIMEOUT);
if (timeoutAsString != null) {
this.timeout = Integer.parseInt(timeoutAsString);
@@ -183,7 +183,7 @@ public class SolrEntityProcessor extends EntityProcessorBase {
solrQuery.addField(field);
}
}
- solrQuery.setQueryType(queryType);
+ solrQuery.setRequestHandler(requestHandler);
solrQuery.setFilterQueries(filterQueries);
solrQuery.setTimeAllowed(timeout * 1000);
diff --git a/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/contentstream-solrconfig.xml b/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/contentstream-solrconfig.xml
index d5df80a3a36..3a8b15dd208 100644
--- a/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/contentstream-solrconfig.xml
+++ b/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/contentstream-solrconfig.xml
@@ -219,7 +219,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-nodatasource-solrconfig.xml b/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-nodatasource-solrconfig.xml
index 925283c4df3..796f83185e1 100644
--- a/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-nodatasource-solrconfig.xml
+++ b/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-nodatasource-solrconfig.xml
@@ -221,7 +221,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-solrconfig.xml b/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-solrconfig.xml
index 5d54c517cae..16d4575de7b 100644
--- a/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-solrconfig.xml
+++ b/solr/contrib/dataimporthandler/src/test-files/dih/solr/conf/dataimport-solrconfig.xml
@@ -219,7 +219,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/contrib/extraction/src/test-files/extraction/solr/conf/solrconfig.xml b/solr/contrib/extraction/src/test-files/extraction/solr/conf/solrconfig.xml
index 674b9db11ee..a63987d2b7f 100644
--- a/solr/contrib/extraction/src/test-files/extraction/solr/conf/solrconfig.xml
+++ b/solr/contrib/extraction/src/test-files/extraction/solr/conf/solrconfig.xml
@@ -162,7 +162,7 @@
based HashBitset. -->
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the qt (query type) param matching the
+ correct handler based on the 'qt' param matching the
name of registered handlers.
The "standard" request handler is the default and will be used if qt
is not specified in the request.
diff --git a/solr/contrib/uima/src/test-files/uima/solr/conf/solrconfig.xml b/solr/contrib/uima/src/test-files/uima/solr/conf/solrconfig.xml
index 5decc62731c..3419b01f6b2 100644
--- a/solr/contrib/uima/src/test-files/uima/solr/conf/solrconfig.xml
+++ b/solr/contrib/uima/src/test-files/uima/solr/conf/solrconfig.xml
@@ -363,7 +363,7 @@
<!--
requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name If no qt is defined, the
diff --git a/solr/contrib/uima/src/test-files/uima/uima-tokenizers-solrconfig.xml b/solr/contrib/uima/src/test-files/uima/uima-tokenizers-solrconfig.xml
index 54d8590a623..65edfd095c3 100644
--- a/solr/contrib/uima/src/test-files/uima/uima-tokenizers-solrconfig.xml
+++ b/solr/contrib/uima/src/test-files/uima/uima-tokenizers-solrconfig.xml
@@ -363,7 +363,7 @@
<!--
requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name If no qt is defined, the
diff --git a/solr/core/src/java/org/apache/solr/request/SolrRequestHandler.java b/solr/core/src/java/org/apache/solr/request/SolrRequestHandler.java
index 0297c535a38..9479f0e0703 100644
--- a/solr/core/src/java/org/apache/solr/request/SolrRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/request/SolrRequestHandler.java
@@ -28,10 +28,10 @@ import org.apache.solr.response.SolrQueryResponse;
* One way to register a SolrRequestHandler with the core is thorugh the <code>solrconfig.xml</code> file.
* <p>
* Example <code>solrconfig.xml</code> entry to register a <code>SolrRequestHandler</code> implementation to
- * handle all queries with a query type of "test":
+ * handle all queries with a Request Handler of "/test":
* <p>
* <code>
- * &lt;requestHandler name="test" class="solr.tst.TestRequestHandler" /&gt;
+ * &lt;requestHandler name="/test" class="solr.tst.TestRequestHandler" /&gt;
* </code>
* <p>
* A single instance of any registered SolrRequestHandler is created
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
index 681e5f96172..cbff34f0e7f 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -234,7 +234,7 @@ public class SolrDispatchFilter implements Filter
if( qt != null && qt.startsWith("/") && (handler instanceof ContentStreamHandlerBase)) {
//For security reasons it's a bad idea to allow a leading '/', ex: /select?qt=/update see SOLR-3161
//There was no restriction from Solr 1.4 thru 3.5 and it's not supported for update handlers.
- throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Invalid query type. Do not use /select to access: "+qt);
+ throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Invalid Request Handler ('qt'). Do not use /select to access: "+qt);
}
}
}
diff --git a/solr/core/src/test-files/solr/conf/solrconfig.xml b/solr/core/src/test-files/solr/conf/solrconfig.xml
index e78b2e92a28..7a7ba7d547a 100644
--- a/solr/core/src/test-files/solr/conf/solrconfig.xml
+++ b/solr/core/src/test-files/solr/conf/solrconfig.xml
@@ -195,7 +195,7 @@
based HashBitset. -->
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the qt (query type) param matching the
+ correct handler based on the 'qt' param matching the
name of registered handlers.
The "standard" request handler is the default and will be used if qt
is not specified in the request.
diff --git a/solr/example/example-DIH/solr/db/conf/solrconfig.xml b/solr/example/example-DIH/solr/db/conf/solrconfig.xml
index 095944be7cc..2346ccbd666 100644
--- a/solr/example/example-DIH/solr/db/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/db/conf/solrconfig.xml
@@ -258,7 +258,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/example/example-DIH/solr/mail/conf/solrconfig.xml b/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
index 0b0b7181637..2436f138015 100644
--- a/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
@@ -283,7 +283,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/example/example-DIH/solr/rss/conf/solrconfig.xml b/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
index 529928d7b37..0a3b4f71cea 100644
--- a/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/rss/conf/solrconfig.xml
@@ -258,7 +258,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/example/example-DIH/solr/solr/conf/solrconfig.xml b/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
index 429dccb99f8..7131689f42e 100644
--- a/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
@@ -258,7 +258,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/example/example-DIH/solr/tika/conf/solrconfig.xml b/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
index a2e339f7b12..6ec5b78e5d1 100644
--- a/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/tika/conf/solrconfig.xml
@@ -222,7 +222,7 @@
<!-- requestHandler plugins... incoming queries will be dispatched to the
- correct handler based on the path or the qt (query type) param.
+ correct handler based on the path or the 'qt' param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java
index 33768aabc08..33fd8eb3be6 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java
@@ -17,7 +17,6 @@
package org.apache.solr.client.solrj;
-import org.apache.solr.client.solrj.util.ClientUtils;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.FacetParams;
import org.apache.solr.common.params.HighlightParams;
@@ -26,7 +25,6 @@ import org.apache.solr.common.params.StatsParams;
import org.apache.solr.common.params.TermsParams;
import org.apache.solr.common.util.DateUtil;
-import java.text.NumberFormat;
import java.util.Date;
import java.util.regex.Pattern;
@@ -709,21 +707,39 @@ public class SolrQuery extends ModifiableSolrParams
}
/**
- * Query type used to determine the request handler.
- * @see org.apache.solr.client.solrj.request.QueryRequest#getPath()
- *
- * @param qt Query Type that corresponds to the query request handler on the server.
+ * The Request Handler to use (see the solrconfig.xml), which is stored in the "qt" parameter.
+ * Normally it starts with a '/' and if so it will be used by
+ * {@link org.apache.solr.client.solrj.request.QueryRequest#getPath()} in the URL instead of the "qt" parameter.
+ * If this is left blank, then the default of "/select" is assumed.
+ *
+ * @param qt The Request Handler name corresponding to one in solrconfig.xml on the server.
* @return this
*/
- public SolrQuery setQueryType(String qt) {
+ public SolrQuery setRequestHandler(String qt) {
this.set(CommonParams.QT, qt);
return this;
}
- public String getQueryType() {
+ public String getRequestHandler() {
return this.get(CommonParams.QT);
}
+ /**
+ * @deprecated See {@link #setRequestHandler(String)}.
+ */
+ @Deprecated
+ public SolrQuery setQueryType(String qt) {
+ return setRequestHandler(qt);
+ }
+
+ /**
+ * @deprecated See {@link #getRequestHandler()}.
+ */
+ @Deprecated
+ public String getQueryType() {
+ return getRequestHandler();
+ }
+
/**
* @see ModifiableSolrParams#set(String,String[])
* @param name
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java b/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
index 81bdd653ca9..38bfe831913 100755
--- a/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/CommonParams.java
@@ -39,7 +39,7 @@ public interface CommonParams {
*/
public static final String TZ = "TZ";
- /** the query type - which query handler should handle the request */
+ /** the Request Handler (formerly known as the Query Type) - which Request Handler should handle the request */
public static final String QT ="qt";
/** the response writer type - the format of the response */
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java b/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java
index c9d51a682eb..d90a6b6f7e3 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/ShardParams.java
@@ -37,7 +37,7 @@ public interface ShardParams {
/** The requested URL for this shard */
public static final String SHARD_URL = "shard.url";
- /** query type for shard requests */
+ /** The Request Handler for shard requests */
public static final String SHARDS_QT = "shards.qt";
/** Request detailed match info for each shard (true/false) */
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
index ff713e1958d..70ce9a7a80c 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
@@ -203,7 +203,7 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
catch( Exception ex ) {}
assertEquals( 1, getSolrCore("corefoo").query( new SolrQuery( "id:BBB" ) ).getResults().size() );
- NamedList<Object> response = getSolrCore("corefoo").query(new SolrQuery().setQueryType("/admin/system")).getResponse();
+ NamedList<Object> response = getSolrCore("corefoo").query(new SolrQuery().setRequestHandler("/admin/system")).getResponse();
NamedList<Object> coreInfo = (NamedList<Object>) response.get("core");
String indexDir = (String) ((NamedList<Object>) coreInfo.get("directory")).get("index");
// test delete index on core
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java
index a6b61864802..abefc27ad94 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrQueryTest.java
@@ -166,7 +166,7 @@ public class SolrQueryTest extends LuceneTestCase {
assertEquals("foo", q.setQuery("foo").getQuery());
assertEquals(10, q.setRows(10).getRows().intValue());
assertEquals(10, q.setStart(10).getStart().intValue());
- assertEquals("foo", q.setQueryType("foo").getQueryType());
+ assertEquals("foo", q.setRequestHandler("foo").getRequestHandler());
assertEquals(10, q.setTimeAllowed(10).getTimeAllowed().intValue());
// non-standard
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
index 28fb60b1233..e6db4f9b294 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
@@ -57,7 +57,7 @@ public class TermsResponseTest extends SolrJettyTestBase {
getSolrServer().commit(true, true);
SolrQuery query = new SolrQuery();
- query.setQueryType("/terms");
+ query.setRequestHandler("/terms");
query.setTerms(true);
query.setTermsLimit(5);
query.setTermsLower("s");