lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r812246 - in /lucene/solr/trunk: CHANGES.txt src/common/org/apache/solr/common/params/ShardParams.java src/java/org/apache/solr/handler/component/QueryComponent.java src/java/org/apache/solr/handler/component/ResponseBuilder.java
Date Mon, 07 Sep 2009 18:28:16 GMT
Author: yonik
Date: Mon Sep  7 18:28:16 2009
New Revision: 812246

URL: http://svn.apache.org/viewvc?rev=812246&view=rev
Log:
SOLR-659: add shards.start shards.rows

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/common/org/apache/solr/common/params/ShardParams.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
    lucene/solr/trunk/src/java/org/apache/solr/handler/component/ResponseBuilder.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=812246&r1=812245&r2=812246&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Mon Sep  7 18:28:16 2009
@@ -292,7 +292,11 @@
 
 75. SOLR-1385 : Add an 'enable' attribute to all plugins  (noble)
 
-76. SOLR-SOLR-1414 : implicit core properties are not set for single core  (noble)
+76. SOLR-1414 : implicit core properties are not set for single core  (noble)
+
+77. SOLR-659 : Adds shards.start and shards.rows to distributed search
+    to allow more efficient bulk queries (those that retrieve many or all
+    documents).  (Brian Whitman via yonik)
 
 Optimizations
 ----------------------

Modified: lucene/solr/trunk/src/common/org/apache/solr/common/params/ShardParams.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/common/org/apache/solr/common/params/ShardParams.java?rev=812246&r1=812245&r2=812246&view=diff
==============================================================================
--- lucene/solr/trunk/src/common/org/apache/solr/common/params/ShardParams.java (original)
+++ lucene/solr/trunk/src/common/org/apache/solr/common/params/ShardParams.java Mon Sep  7
18:28:16 2009
@@ -24,6 +24,10 @@
   /** the shards to use (distributed configuration) */
   public static final String SHARDS = "shards";
   
+  /** per-shard start and rows */
+  public static final String SHARDS_ROWS = "shards.rows";
+  public static final String SHARDS_START = "shards.start";
+  
   /** IDs of the shard documents */
   public static final String IDS = "ids";
   

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=812246&r1=812245&r2=812246&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java Mon Sep
 7 18:28:16 2009
@@ -114,6 +114,14 @@
       List<String> lst = StrUtils.splitSmart(shards, ",", true);
       rb.shards = lst.toArray(new String[lst.size()]);
     }
+    String shards_rows = params.get(ShardParams.SHARDS_ROWS);
+    if(shards_rows != null) {
+      rb.shards_rows = Integer.parseInt(shards_rows);
+    }
+    String shards_start = params.get(ShardParams.SHARDS_START);
+    if(shards_start != null) {
+      rb.shards_start = Integer.parseInt(shards_start);
+    }
   }
 
   /**
@@ -330,14 +338,22 @@
 
     // set the start (offset) to 0 for each shard request so we can properly merge
     // results from the start.
-    sreq.params.set(CommonParams.START, "0");
-
+    if(rb.shards_start > -1) {
+      // if the client set shards.start set this explicitly
+      sreq.params.set(CommonParams.START,rb.shards_start);
+    } else {
+      sreq.params.set(CommonParams.START, "0");
+    }
     // TODO: should we even use the SortSpec?  That's obtained from the QParser, and
     // perhaps we shouldn't attempt to parse the query at this level?
     // Alternate Idea: instead of specifying all these things at the upper level,
     // we could just specify that this is a shard request.
-    sreq.params.set(CommonParams.ROWS, rb.getSortSpec().getOffset() + rb.getSortSpec().getCount());
-
+    if(rb.shards_rows > -1) {
+      // if the client set shards.rows set this explicity
+      sreq.params.set(CommonParams.ROWS,rb.shards_rows);
+    } else {
+      sreq.params.set(CommonParams.ROWS, rb.getSortSpec().getOffset() + rb.getSortSpec().getCount());
+    }
 
     // in this first phase, request only the unique key field
     // and any fields needed for merging.

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/component/ResponseBuilder.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/ResponseBuilder.java?rev=812246&r1=812245&r2=812246&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/component/ResponseBuilder.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/component/ResponseBuilder.java Mon
Sep  7 18:28:16 2009
@@ -94,6 +94,8 @@
 
   //The address of the Shard
   public String[] shards;
+  public int shards_rows = -1;
+  public int shards_start = -1;
   public List<ShardRequest> outgoing;  // requests to be sent
   public List<ShardRequest> finished;  // requests that have received responses from
all shards
 



Mime
View raw message