You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2012/03/13 16:36:49 UTC

svn commit: r1300195 - in /lucene/dev/branches/branch_3x/solr: CHANGES.txt core/src/java/org/apache/solr/servlet/SolrRequestParsers.java example/solr/conf/solrconfig.xml webapp/web/admin/form.jsp

Author: dsmiley
Date: Tue Mar 13 15:36:49 2012
New Revision: 1300195

URL: http://svn.apache.org/viewvc?rev=1300195&view=rev
Log:
SOLR-3161 disable qt by default in solrconfig; update admin UI query form

Modified:
    lucene/dev/branches/branch_3x/solr/CHANGES.txt
    lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
    lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml
    lucene/dev/branches/branch_3x/solr/webapp/web/admin/form.jsp

Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=1300195&r1=1300194&r2=1300195&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Tue Mar 13 15:36:49 2012
@@ -38,6 +38,12 @@ Upgrading from Solr 3.5
 * SOLR-3040: The DIH's admin UI (dataimport.jsp) now requires DIH request handlers to start with
   a '/'. (dsmiley)
 
+* SOLR-3161: <requestDispatcher handleSelect="false"> is now the default. An existing config will
+  probably work as-is because handleSelect was explicitly enabled in default configs. HandleSelect
+  makes /select work as well as enables the 'qt' parameter. Instead, consider explicitly
+  configuring /select as is done in the example solrconfig.xml, and register your other search
+  handlers with a leading '/' which is a recommended practice.  (David Smiley, Erik Hatcher)
+
 New Features
 ----------------------
 * SOLR-2854: Now load URL content stream data (via stream.url) when called for during request handling,

Modified: lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java?rev=1300195&r1=1300194&r2=1300195&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java (original)
+++ lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java Tue Mar 13 15:36:49 2012
@@ -63,7 +63,7 @@ public class SolrRequestParsers 
   
   private HashMap<String, SolrRequestParser> parsers;
   private boolean enableRemoteStreams = false;
-  private boolean handleSelect = true;
+  private boolean handleSelect = false;
   private StandardRequestParser standard;
   
   /**

Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml?rev=1300195&r1=1300194&r2=1300195&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/solrconfig.xml Tue Mar 13 15:36:49 2012
@@ -597,17 +597,13 @@
        This section contains instructions for how the SolrDispatchFilter
        should behave when processing requests for this SolrCore.
 
-       handleSelect affects the behavior of requests such as /select?qt=XXX
-
-       handleSelect="true" will cause the SolrDispatchFilter to process
-       the request and will result in consistent error handling and
-       formatting for all types of requests.
-
-       handleSelect="false" will cause the SolrDispatchFilter to
-       ignore "/select" requests and fallback to using the legacy
-       SolrServlet and it's Solr 1.1 style error formatting
-    -->
-  <requestDispatcher handleSelect="true" >
+       If you wish to regain use of /select?qt=... style request handler
+       dispatching, then first add handleSelect="true" to
+       <requestDispatcher>. Then change the name of the request handler
+       named "/select" to something else without a leading "/", such as
+       simply "select" and add default="true" to it.
+   -->
+  <requestDispatcher>
     <!-- Request Parsing
 
          These settings indicate how Solr Requests may be parsed, and
@@ -689,17 +685,9 @@
 
        http://wiki.apache.org/solr/SolrRequestHandler
 
-       incoming queries will be dispatched to the correct handler
-       based on the path or the qt (query type) param.
+       Incoming queries will be dispatched to the correct handler
+       based on the matching request path piece.
 
-       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/[core/]select?qt=name
-
-       If a /select request is processed with out a qt param
-       specified, the requestHandler that declares default="true" will
-       be used.
-       
        If a Request Handler is declared with startup="lazy", then it will
        not be initialized until the first request that uses it.
 
@@ -713,7 +701,7 @@
        of SearchComponents (see below) and supports distributed
        queries across multiple shards
     -->
-  <requestHandler name="search" class="solr.SearchHandler" default="true">
+  <requestHandler name="/select" class="solr.SearchHandler">
     <!-- default values for query parameters can be specified, these
          will be overridden by parameters in the request
       -->
@@ -773,7 +761,7 @@
          <str>nameOfCustomComponent2</str>
        </arr>
       -->
-    </requestHandler>
+  </requestHandler>
 
   <!-- A Robust Example
 
@@ -1008,7 +996,7 @@
   <!-- ping/healthcheck -->
   <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
     <lst name="invariants">
-      <str name="qt">search</str>
+      <str name="qt">/select</str>
       <str name="q">solrpingquery</str>
     </lst>
     <lst name="defaults">
@@ -1023,7 +1011,7 @@
      <str name="echoHandler">true</str>
     </lst>
   </requestHandler>
-  
+
   <!-- Solr Replication
 
        The SolrReplicationHandler supports replicating indexes from a

Modified: lucene/dev/branches/branch_3x/solr/webapp/web/admin/form.jsp
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/webapp/web/admin/form.jsp?rev=1300195&r1=1300194&r2=1300195&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/webapp/web/admin/form.jsp (original)
+++ lucene/dev/branches/branch_3x/solr/webapp/web/admin/form.jsp Tue Mar 13 15:36:49 2012
@@ -16,9 +16,23 @@
  limitations under the License.
 --%>
 <%@include file="header.jsp" %>
-
+<script>
+function onQueryFormSubmit() {
+  if (queryForm.q.value.length==0) {
+      alert('no empty queries, please');
+      return false;
+  }
+  var qtDom = queryForm.qt;
+  var qt = qtDom.value;
+  if (qt[0] == "/") {
+    queryForm.action = ".."+qt;
+    qtDom.setAttribute("name","");//prevent submission (kind of a hack)
+  }
+  return true;
+}
+</script>
 <br clear="all">
-<form name="queryForm" method="GET" action="../select" accept-charset="UTF-8">
+<form name="queryForm" method="GET" action="../select" accept-charset="UTF-8" onSubmit="return onQueryFormSubmit()">
 <!-- these are good defaults to have if people bookmark the resulting
      URLs, but they should not show up in the form since they are very
      output type specific.
@@ -29,7 +43,16 @@
 <table>
 <tr>
   <td>
-	<strong>Solr/Lucene Statement</strong>
+	<strong>Request Handler</strong>
+  </td>
+  <td>
+  <!-- Note: look at the onSubmit handler which treats this input specially -->
+	<input name="qt" type="text" value="/select">
+  </td>
+</tr>
+<tr>
+  <td>
+	<strong>Query String</strong>
   </td>
   <td>
 	<textarea rows="5" cols="60" name="q"><%= defaultSearch %></textarea>
@@ -69,14 +92,6 @@
 </tr>
 <tr>
   <td>
-	<strong>Query Type</strong>
-  </td>
-  <td>
-	<input name="qt" type="text">
-  </td>
-</tr>
-<tr>
-  <td>
 	<strong>Output Type</strong>
   </td>
   <td>
@@ -121,7 +136,7 @@
   <td>
   </td>
   <td>
-    <input class="stdbutton" type="submit" value="search" onclick="if (queryForm.q.value.length==0) { alert('no empty queries, please'); return false; } else { queryForm.submit(); return false;} ">
+    <input class="stdbutton" type="submit" value="search">
   </td>
 </tr>
 </table>