You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ry...@apache.org on 2007/04/29 22:47:23 UTC
svn commit: r533558 - in /lucene/solr/trunk: ./ example/solr/conf/
src/test/test-files/solr/conf/ src/webapp/WEB-INF/
src/webapp/src/org/apache/solr/servlet/
Author: ryan
Date: Sun Apr 29 13:47:23 2007
New Revision: 533558
URL: http://svn.apache.org/viewvc?view=rev&rev=533558
Log:
SOLR-204: Make it possible for the request dispatcher to handle /select. This offers uniform error handling for /update and /select.
This change will affect anyone who has added "enableRemoteStreaming" to their solrconfig.xml since solr1.1
Where you had:
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
You now need:
<requestDispatcher handleSelect="true" >
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
</requestDispatcher>
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/example/solr/conf/solrconfig.xml
lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig.xml
lucene/solr/trunk/src/webapp/WEB-INF/web.xml
lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java
Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?view=diff&rev=533558&r1=533557&r2=533558
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Sun Apr 29 13:47:23 2007
@@ -151,6 +151,12 @@
24. SOLR-212: Added a DirectSolrConnection class. This lets you access
solr using the standard request/response formats, but does not require
an HTTP connection. It is designed for embedded applications. (ryan)
+
+25. SOLR-204: The request dispatcher (added in SOLR-104) can handle
+ calls to /select. This offers uniform error handling for /update and
+ /select. To enable this behavior, you must add:
+ <requestDispatcher handleSelect="true" > to your solrconfig.xml
+ See the example solrconfig.xml for details. (ryan)
Changes in runtime behavior
1. Highlighting using DisMax will only pick up terms from the main
Modified: lucene/solr/trunk/example/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/solrconfig.xml?view=diff&rev=533558&r1=533557&r2=533558
==============================================================================
--- lucene/solr/trunk/example/solr/conf/solrconfig.xml (original)
+++ lucene/solr/trunk/example/solr/conf/solrconfig.xml Sun Apr 29 13:47:23 2007
@@ -231,9 +231,17 @@
</query>
- <!--Make sure your system has some authentication before enabling remote streaming! -->
- <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
-
+ <!--
+ Let the dispatch filter handler /select?qt=XXX
+ handleSelect=true will use consistent error handling for /select and /update
+ handleSelect=false will use solr1.1 style error formatting
+ -->
+ <requestDispatcher handleSelect="true" >
+ <!--Make sure your system has some authentication before enabling remote streaming! -->
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+ </requestDispatcher>
+
+
<!-- requestHandler plugins... incoming queries will be dispatched to the
correct handler based on the qt (query type) param matching the
name of registered handlers.
Modified: lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig.xml?view=diff&rev=533558&r1=533557&r2=533558
==============================================================================
--- lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig.xml (original)
+++ lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig.xml Sun Apr 29 13:47:23 2007
@@ -267,7 +267,9 @@
</requestHandler>
<!-- enable streaming for testing... -->
- <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
+ <requestDispatcher handleSelect="true" >
+ <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
+ </requestDispatcher>
<admin>
<defaultQuery>solr</defaultQuery>
Modified: lucene/solr/trunk/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/WEB-INF/web.xml?view=diff&rev=533558&r1=533557&r2=533558
==============================================================================
--- lucene/solr/trunk/src/webapp/WEB-INF/web.xml (original)
+++ lucene/solr/trunk/src/webapp/WEB-INF/web.xml Sun Apr 29 13:47:23 2007
@@ -36,10 +36,6 @@
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
<!--
<init-param>
- <param-name>handle-select</param-name>
- <param-value>true</param-value>
- </init-param>
- <init-param>
<param-name>path-prefix</param-name>
<param-value>/xxx</param-value>
</init-param>
Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?view=diff&rev=533558&r1=533557&r2=533558
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java Sun Apr 29 13:47:23 2007
@@ -60,7 +60,10 @@
try {
// web.xml configuration
this.pathPrefix = config.getInitParameter( "path-prefix" );
- this.handleSelect = "true".equals( config.getInitParameter( "handle-select" ) );
+
+ // Let this filter take care of /select?xxx format
+ this.handleSelect =
+ SolrConfig.config.getBool( "requestDispatcher/@handleSelect", false );
log.info("user.dir=" + System.getProperty("user.dir"));
core = SolrCore.getSolrCore();
Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java?view=diff&rev=533558&r1=533557&r2=533558
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrRequestParsers.java Sun Apr 29 13:47:23 2007
@@ -32,12 +32,12 @@
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
-import javax.xml.xpath.XPathConstants;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.solr.core.Config;
+import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SolrException;
import org.apache.solr.util.ContentStream;
@@ -47,9 +47,6 @@
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrQueryRequestBase;
import org.apache.solr.util.ContentStreamBase;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
public class SolrRequestParsers
@@ -71,21 +68,13 @@
{
this.core = core;
- long uploadLimitKB = 2000; // 2MB default
- NodeList nodes = (NodeList)config.evaluate("requestParsers", XPathConstants.NODESET);
- if( nodes!=null && nodes.getLength()>0 ) {
- // only look at the first node.
- NamedNodeMap attrs = nodes.item(0).getAttributes();
- Node node = attrs.getNamedItem( "enableRemoteStreaming" );
- if( node != null ) {
- enableRemoteStreams = Boolean.parseBoolean( node.getTextContent() );
- }
- node = attrs.getNamedItem( "multipartUploadLimitInKB" );
- if( node != null ) {
- uploadLimitKB = Long.parseLong( node.getTextContent() );
- }
- }
-
+ // Read the configuration
+ long uploadLimitKB = SolrConfig.config.getInt(
+ "requestDispatcher/requestParsers/@multipartUploadLimitInKB", 2000 ); // 2MB default
+
+ this.enableRemoteStreams = SolrConfig.config.getBool(
+ "requestDispatcher/requestParsers/@enableRemoteStreaming", false );
+
MultipartRequestParser multi = new MultipartRequestParser( uploadLimitKB );
RawRequestParser raw = new RawRequestParser();
standard = new StandardRequestParser( multi, raw );
@@ -390,6 +379,8 @@
throw new SolrException( 400, "Unsuported method: "+method );
}
}
+
+