Index: conf/nutch-default.xml
===================================================================
--- conf/nutch-default.xml	(revision 573680)
+++ conf/nutch-default.xml	(working copy)
@@ -1093,4 +1093,16 @@
   </description>
 </property>
 
+<!-- Web GUI properties -->
+<property>
+  <name>web-gui.search.max.hits.per.page</name>
+  <value>1000</value>
+  <description> The maximum number of hits to show per page. -1 if
+  unlimited. If the number of hits requested by the user (via
+  hitsPerPage parameter in the query string) is more than the value
+  specified in this property, then this value is assumed as the number
+  of hits per page.
+  </description>
+</property>
+
 </configuration>
Index: src/java/org/apache/nutch/searcher/OpenSearchServlet.java
===================================================================
--- src/java/org/apache/nutch/searcher/OpenSearchServlet.java	(revision 573680)
+++ src/java/org/apache/nutch/searcher/OpenSearchServlet.java	(working copy)
@@ -45,6 +45,7 @@
  * Nutch-specific extensions. */   
 public class OpenSearchServlet extends HttpServlet {
   private static final Map NS_MAP = new HashMap();
+  private int MAX_HITS_PER_PAGE;
 
   static {
     NS_MAP.put("opensearch", "http://a9.com/-/spec/opensearchrss/1.0/");
@@ -67,6 +68,7 @@
     } catch (IOException e) {
       throw new ServletException(e);
     }
+    MAX_HITS_PER_PAGE = conf.getInt("web-gui.search.max.hits.per.page", -1);
   }
 
   public void doGet(HttpServletRequest request, HttpServletResponse response)
@@ -95,6 +97,8 @@
     String hitsString = request.getParameter("hitsPerPage");
     if (hitsString != null)
       hitsPerPage = Integer.parseInt(hitsString);
+    if(MAX_HITS_PER_PAGE > 0 && hitsPerPage > MAX_HITS_PER_PAGE)
+      hitsPerPage = MAX_HITS_PER_PAGE;
 
     String sort = request.getParameter("sort");
     boolean reverse =
Index: src/web/jsp/search.jsp
===================================================================
--- src/web/jsp/search.jsp	(revision 573680)
+++ src/web/jsp/search.jsp	(working copy)
@@ -40,6 +40,11 @@
   private int HITS_TO_CLUSTER;
 
   /**
+   * Maximum hits per page to be displayed.
+   */
+  private int MAX_HITS_PER_PAGE;
+
+  /**
    * An instance of the clustering extension, if available.
    */
   private OnlineClusterer clusterer;
@@ -60,6 +65,9 @@
 
 	HITS_TO_CLUSTER = nutchConf.getInt("extension.clustering.hits-to-cluster", 100);
 
+    MAX_HITS_PER_PAGE = nutchConf.getInt("web-gui.search.max.hits.per.page",
+                                         -1);
+
     try {
       clusterer = new OnlineClustererFactory(nutchConf).getOnlineClusterer();
     } catch (PluginRuntimeException e) {
@@ -105,6 +113,8 @@
   String hitsString = request.getParameter("hitsPerPage");
   if (hitsString != null)
     hitsPerPage = Integer.parseInt(hitsString);
+  if(MAX_HITS_PER_PAGE > 0 && hitsPerPage > MAX_HITS_PER_PAGE)
+    hitsPerPage = MAX_HITS_PER_PAGE;
 
   int hitsPerSite = 2;                            // max hits per site
   String hitsPerSiteString = request.getParameter("hitsPerSite");
