mirror of https://github.com/apache/lucene.git
SOLR-3313 Rename Query Type to Request Handler
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1351932 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
96d5d8e481
commit
f12b94ab86
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
* <requestHandler name="test" class="solr.tst.TestRequestHandler" />
|
||||
* <requestHandler name="/test" class="solr.tst.TestRequestHandler" />
|
||||
* </code>
|
||||
* <p>
|
||||
* A single instance of any registered SolrRequestHandler is created
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
* 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 Query Type that corresponds to the query request handler on the server.
|
||||
* @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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue