mirror of https://github.com/apache/lucene.git
SOLR-659: add shards.start shards.rows
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@812246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
576e73cd5d
commit
3c96f846cd
|
@ -292,7 +292,11 @@ New Features
|
|||
|
||||
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
|
||||
----------------------
|
||||
|
|
|
@ -24,6 +24,10 @@ public interface ShardParams {
|
|||
/** 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";
|
||||
|
||||
|
|
|
@ -114,6 +114,14 @@ public class QueryComponent extends SearchComponent
|
|||
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 @@ public class QueryComponent extends SearchComponent
|
|||
|
||||
// set the start (offset) to 0 for each shard request so we can properly merge
|
||||
// results from the start.
|
||||
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.
|
||||
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.
|
||||
|
|
|
@ -94,6 +94,8 @@ public class ResponseBuilder
|
|||
|
||||
//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
|
||||
|
||||
|
|
Loading…
Reference in New Issue