You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2012/08/08 20:23:13 UTC
svn commit: r1370871 - in /lucene/dev/branches/branch_4x: ./ dev-tools/
lucene/ lucene/analysis/
lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/
lucene/benchmark/ lucene/core/ lucene/demo/ lucene/facet/ lucene/grouping/
luce...
Author: hossman
Date: Wed Aug 8 18:23:11 2012
New Revision: 1370871
URL: http://svn.apache.org/viewvc?rev=1370871&view=rev
Log:
SOLR-3229: Fixed TermVectorComponent to work with distributed search (merge r1370870)
Added:
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
- copied unchanged from r1370870, lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/dev-tools/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/BUILD.txt (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (props changed)
lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt (props changed)
lucene/dev/branches/branch_4x/lucene/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/MIGRATE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/README.txt (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/ (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java (props changed)
lucene/dev/branches/branch_4x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_4x/lucene/benchmark/ (props changed)
lucene/dev/branches/branch_4x/lucene/build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/common-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/demo/ (props changed)
lucene/dev/branches/branch_4x/lucene/facet/ (props changed)
lucene/dev/branches/branch_4x/lucene/grouping/ (props changed)
lucene/dev/branches/branch_4x/lucene/highlighter/ (props changed)
lucene/dev/branches/branch_4x/lucene/ivy-settings.xml (props changed)
lucene/dev/branches/branch_4x/lucene/join/ (props changed)
lucene/dev/branches/branch_4x/lucene/licenses/ (props changed)
lucene/dev/branches/branch_4x/lucene/memory/ (props changed)
lucene/dev/branches/branch_4x/lucene/misc/ (props changed)
lucene/dev/branches/branch_4x/lucene/module-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/queries/ (props changed)
lucene/dev/branches/branch_4x/lucene/queryparser/ (props changed)
lucene/dev/branches/branch_4x/lucene/sandbox/ (props changed)
lucene/dev/branches/branch_4x/lucene/site/ (props changed)
lucene/dev/branches/branch_4x/lucene/spatial/ (props changed)
lucene/dev/branches/branch_4x/lucene/suggest/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_4x/lucene/tools/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/solr/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/solr/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/README.txt (props changed)
lucene/dev/branches/branch_4x/solr/build.xml (props changed)
lucene/dev/branches/branch_4x/solr/cloud-dev/ (props changed)
lucene/dev/branches/branch_4x/solr/common-build.xml (props changed)
lucene/dev/branches/branch_4x/solr/contrib/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java
lucene/dev/branches/branch_4x/solr/dev-tools/ (props changed)
lucene/dev/branches/branch_4x/solr/example/ (props changed)
lucene/dev/branches/branch_4x/solr/lib/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/scripts/ (props changed)
lucene/dev/branches/branch_4x/solr/solrj/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_4x/solr/testlogging.properties (props changed)
lucene/dev/branches/branch_4x/solr/webapp/ (props changed)
Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1370871&r1=1370870&r2=1370871&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Wed Aug 8 18:23:11 2012
@@ -22,6 +22,11 @@ $Id$
================== 4.0.0 ==================
+Upgrading from Solr 4.0.0-BETA
+----------------------
+
+In order to better support distributed search mode, the TermVectorComponent's response format has been changed so that if the schema defines a uniqueKeyField, then that field value is used as the "key" for each document in it's response section, instead of the internal lucene doc id. Users w/o a uniqueKeyField will continue to see the same response format. See SOLR-3229 for more details.
+
Bug Fixes
----------------------
@@ -29,6 +34,7 @@ Bug Fixes
to tlog flags not being cleared when no updates were buffered during a previous
replication. (Markus Jelsma, Mark Miller, yonik)
+* SOLR-3229: Fixed TermVectorComponent to work with distributed search
================== 4.0.0-BETA ===================
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java?rev=1370871&r1=1370870&r2=1370871&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java Wed Aug 8 18:23:11 2012
@@ -11,6 +11,7 @@ import java.util.Set;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.FieldInfo;
@@ -141,6 +142,15 @@ public class TermVectorComponent extends
NamedList<Object> termVectors = new NamedList<Object>();
rb.rsp.add(TERM_VECTORS, termVectors);
+
+ IndexSchema schema = rb.req.getSchema();
+ SchemaField keyField = schema.getUniqueKeyField();
+ String uniqFieldName = null;
+ if (keyField != null) {
+ uniqFieldName = keyField.getName();
+ termVectors.add("uniqueKeyFieldName", uniqFieldName);
+ }
+
FieldOptions allFields = new FieldOptions();
//figure out what options we have, and try to get the appropriate vector
allFields.termFreq = params.getBool(TermVectorParams.TF, false);
@@ -158,8 +168,6 @@ public class TermVectorComponent extends
allFields.tfIdf = true;
}
- //use this to validate our fields
- IndexSchema schema = rb.req.getSchema();
//Build up our per field mapping
Map<String, FieldOptions> fieldOptions = new HashMap<String, FieldOptions>();
NamedList<List<String>> warnings = new NamedList<List<String>>();
@@ -175,6 +183,11 @@ public class TermVectorComponent extends
// workarround SOLR-3523
if (null == field || "score".equals(field)) continue;
+ // we don't want to issue warnings about the uniqueKey field
+ // since it can cause lots of confusion in distributed requests
+ // where the uniqueKey field is injected into the fl for merging
+ final boolean fieldIsUniqueKey = field.equals(uniqFieldName);
+
SchemaField sf = schema.getFieldOrNull(field);
if (sf != null) {
if (sf.storeTermVector()) {
@@ -190,15 +203,15 @@ public class TermVectorComponent extends
option.tfIdf = params.getFieldBool(field, TermVectorParams.TF_IDF, allFields.tfIdf);
//Validate these are even an option
option.positions = params.getFieldBool(field, TermVectorParams.POSITIONS, allFields.positions);
- if (option.positions && !sf.storeTermPositions()){
+ if (option.positions && !sf.storeTermPositions() && !fieldIsUniqueKey){
noPos.add(field);
}
option.offsets = params.getFieldBool(field, TermVectorParams.OFFSETS, allFields.offsets);
- if (option.offsets && !sf.storeTermOffsets()){
+ if (option.offsets && !sf.storeTermOffsets() && !fieldIsUniqueKey){
noOff.add(field);
}
} else {//field doesn't have term vectors
- noTV.add(field);
+ if (!fieldIsUniqueKey) noTV.add(field);
}
} else {
//field doesn't exist
@@ -206,6 +219,11 @@ public class TermVectorComponent extends
}
}
} //else, deal with all fields
+
+ // NOTE: currently all typs of warnings are schema driven, and garunteed
+ // to be consistent across all shards - if additional types of warnings
+ // are added that might be differnet between shards, finishStage() needs
+ // to be changed to account for that.
boolean hasWarnings = false;
if (!noTV.isEmpty()) {
warnings.add("noTermVectors", noTV);
@@ -236,11 +254,7 @@ public class TermVectorComponent extends
IndexReader reader = searcher.getIndexReader();
//the TVMapper is a TermVectorMapper which can be used to optimize loading of Term Vectors
- SchemaField keyField = schema.getUniqueKeyField();
- String uniqFieldName = null;
- if (keyField != null) {
- uniqFieldName = keyField.getName();
- }
+
//Only load the id field to get the uniqueKey of that
//field
@@ -277,7 +291,6 @@ public class TermVectorComponent extends
while (iter.hasNext()) {
Integer docId = iter.next();
NamedList<Object> docNL = new NamedList<Object>();
- termVectors.add("doc-" + docId, docNL);
if (keyField != null) {
reader.document(docId, getUniqValue);
@@ -286,9 +299,13 @@ public class TermVectorComponent extends
uniqVal = uniqValues.get(0);
uniqValues.clear();
docNL.add("uniqueKey", uniqVal);
- termVectors.add("uniqueKeyFieldName", uniqFieldName);
+ termVectors.add(uniqVal, docNL);
}
+ } else {
+ // support for schemas w/o a unique key,
+ termVectors.add("doc-" + docId, docNL);
}
+
if ( null != fields ) {
for (Map.Entry<String, FieldOptions> entry : fieldOptions.entrySet()) {
final String field = entry.getKey();
@@ -394,46 +411,6 @@ public class TermVectorComponent extends
return result;
}
- @Override
- public int distributedProcess(ResponseBuilder rb) throws IOException {
- int result = ResponseBuilder.STAGE_DONE;
- if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {
- //Go ask each shard for it's vectors
- // for each shard, collect the documents for that shard.
- HashMap<String, Collection<ShardDoc>> shardMap = new HashMap<String, Collection<ShardDoc>>();
- for (ShardDoc sdoc : rb.resultIds.values()) {
- Collection<ShardDoc> shardDocs = shardMap.get(sdoc.shard);
- if (shardDocs == null) {
- shardDocs = new ArrayList<ShardDoc>();
- shardMap.put(sdoc.shard, shardDocs);
- }
- shardDocs.add(sdoc);
- }
- // Now create a request for each shard to retrieve the stored fields
- for (Collection<ShardDoc> shardDocs : shardMap.values()) {
- ShardRequest sreq = new ShardRequest();
- sreq.purpose = ShardRequest.PURPOSE_GET_FIELDS;
-
- sreq.shards = new String[]{shardDocs.iterator().next().shard};
-
- sreq.params = new ModifiableSolrParams();
-
- // add original params
- sreq.params.add(rb.req.getParams());
- sreq.params.remove(CommonParams.Q);//remove the query
- ArrayList<String> ids = new ArrayList<String>(shardDocs.size());
- for (ShardDoc shardDoc : shardDocs) {
- ids.add(shardDoc.id.toString());
- }
- sreq.params.add(TermVectorParams.DOC_IDS, StrUtils.join(ids, ','));
-
- rb.addRequest(this, sreq);
- }
- result = ResponseBuilder.STAGE_DONE;
- }
- return result;
- }
-
private static int getDocFreq(IndexReader reader, String field, BytesRef term) {
int result = 1;
try {
@@ -449,6 +426,40 @@ public class TermVectorComponent extends
}
+ @Override
+ public void finishStage(ResponseBuilder rb) {
+ if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {
+
+ NamedList termVectors = new NamedList<Object>();
+ Map.Entry<String, Object>[] arr = new NamedList.NamedListEntry[rb.resultIds.size()];
+
+ for (ShardRequest sreq : rb.finished) {
+ if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) == 0 || !sreq.params.getBool(COMPONENT_NAME, false)) {
+ continue;
+ }
+ for (ShardResponse srsp : sreq.responses) {
+ NamedList<Object> nl = (NamedList<Object>)srsp.getSolrResponse().getResponse().get(TERM_VECTORS);
+ for (int i=0; i < nl.size(); i++) {
+ String key = nl.getName(i);
+ ShardDoc sdoc = rb.resultIds.get(key);
+ if (null == sdoc) {
+ // metadata, only need from one node, leave in order
+ if (termVectors.indexOf(key,0) < 0) {
+ termVectors.add(key, nl.getVal(i));
+ }
+ } else {
+ int idx = sdoc.positionInResponse;
+ arr[idx] = new NamedList.NamedListEntry<Object>(key, nl.getVal(i));
+ }
+ }
+ }
+ }
+ // remove nulls in case not all docs were able to be retrieved
+ termVectors.addAll(SolrPluginUtils.removeNulls(new NamedList<Object>(arr)));
+ rb.rsp.add(TERM_VECTORS, termVectors);
+ }
+ }
+
//////////////////////// NamedListInitializedPlugin methods //////////////////////
@Override
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java?rev=1370871&r1=1370870&r2=1370871&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java Wed Aug 8 18:23:11 2012
@@ -121,7 +121,7 @@ public class TermVectorComponentTest ext
@Test
public void testBasics() throws Exception {
assertJQ(req("json.nl","map", "qt",tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, "true", TermVectorParams.TF, "true")
- ,"/termVectors=={'doc-0':{'uniqueKey':'0'," +
+ ,"/termVectors=={'0':{'uniqueKey':'0'," +
" 'test_basictv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_offtv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_posofftv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
@@ -136,7 +136,7 @@ public class TermVectorComponentTest ext
"tv.fl", "test_basictv,test_offtv",
TermVectorComponent.COMPONENT_NAME, "true",
TermVectorParams.TF, "true")
- ,"/termVectors=={'doc-0':{'uniqueKey':'0'," +
+ ,"/termVectors=={'0':{'uniqueKey':'0'," +
" 'test_basictv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_offtv':{'anoth':{'tf':1},'titl':{'tf':2}}}," +
" 'uniqueKeyFieldName':'id'}"
@@ -150,7 +150,7 @@ public class TermVectorComponentTest ext
"tv.fl","test_offtv",
TermVectorComponent.COMPONENT_NAME, "true",
TermVectorParams.TF, "true")
- ,"/termVectors=={'doc-0':{'uniqueKey':'0'," +
+ ,"/termVectors=={'0':{'uniqueKey':'0'," +
" 'test_basictv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_offtv':{'anoth':{'tf':1},'titl':{'tf':2}}}," +
" 'uniqueKeyFieldName':'id'}"
@@ -162,7 +162,7 @@ public class TermVectorComponentTest ext
"fl", "*,score",
TermVectorComponent.COMPONENT_NAME, "true",
TermVectorParams.TF, "true")
- ,"/termVectors=={'doc-0':{'uniqueKey':'0'," +
+ ,"/termVectors=={'0':{'uniqueKey':'0'," +
" 'test_basictv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_offtv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_posofftv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
@@ -176,7 +176,7 @@ public class TermVectorComponentTest ext
"fl", "score,test_basictv,[docid],test_postv,val:sum(3,4)",
TermVectorComponent.COMPONENT_NAME, "true",
TermVectorParams.TF, "true")
- ,"/termVectors=={'doc-0':{'uniqueKey':'0'," +
+ ,"/termVectors=={'0':{'uniqueKey':'0'," +
" 'test_basictv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_postv':{'anoth':{'tf':1},'titl':{'tf':2}}}," +
" 'uniqueKeyFieldName':'id'}"
@@ -189,7 +189,7 @@ public class TermVectorComponentTest ext
"fl", "[docid],test_postv,val:sum(3,4)",
TermVectorComponent.COMPONENT_NAME, "true",
TermVectorParams.TF, "true")
- ,"/termVectors=={'doc-0':{'uniqueKey':'0'," +
+ ,"/termVectors=={'0':{'uniqueKey':'0'," +
" 'test_basictv':{'anoth':{'tf':1},'titl':{'tf':2}}," +
" 'test_postv':{'anoth':{'tf':1},'titl':{'tf':2}}}," +
" 'uniqueKeyFieldName':'id'}"
@@ -201,12 +201,12 @@ public class TermVectorComponentTest ext
public void testOptions() throws Exception {
assertJQ(req("json.nl","map", "qt",tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, "true"
, TermVectorParams.TF, "true", TermVectorParams.DF, "true", TermVectorParams.OFFSETS, "true", TermVectorParams.POSITIONS, "true", TermVectorParams.TF_IDF, "true")
- ,"/termVectors/doc-0/test_posofftv/anoth=={'tf':1, 'offsets':{'start':20, 'end':27}, 'positions':{'position':1}, 'df':2, 'tf-idf':0.5}"
+ ,"/termVectors/0/test_posofftv/anoth=={'tf':1, 'offsets':{'start':20, 'end':27}, 'positions':{'position':1}, 'df':2, 'tf-idf':0.5}"
);
assertJQ(req("json.nl","map", "qt",tv, "q", "id:0", TermVectorComponent.COMPONENT_NAME, "true"
, TermVectorParams.ALL, "true")
- ,"/termVectors/doc-0/test_posofftv/anoth=={'tf':1, 'offsets':{'start':20, 'end':27}, 'positions':{'position':1}, 'df':2, 'tf-idf':0.5}"
+ ,"/termVectors/0/test_posofftv/anoth=={'tf':1, 'offsets':{'start':20, 'end':27}, 'positions':{'position':1}, 'df':2, 'tf-idf':0.5}"
);
// test each combination at random
@@ -217,7 +217,7 @@ public class TermVectorComponentTest ext
{ TermVectorParams.POSITIONS, "'positions':{'position':1}" },
{ TermVectorParams.DF, "'df':2" },
{ TermVectorParams.TF_IDF, "'tf-idf':0.5" } };
- StringBuilder expected = new StringBuilder("/termVectors/doc-0/test_posofftv/anoth=={");
+ StringBuilder expected = new StringBuilder("/termVectors/0/test_posofftv/anoth=={");
boolean first = true;
for (int i = 0; i < options.length; i++) {
final boolean use = random().nextBoolean();
@@ -248,59 +248,13 @@ public class TermVectorComponentTest ext
,"f.test_basictv." + TermVectorParams.TF, "false"
,"f.test_basictv." + TermVectorParams.TF_IDF, "false"
)
- ,"/termVectors/doc-0/test_basictv=={'anoth':{},'titl':{}}"
- ,"/termVectors/doc-0/test_postv/anoth=={'tf':1, 'positions':{'position':1}, 'df':2, 'tf-idf':0.5}"
- ,"/termVectors/doc-0/test_offtv/anoth=={'tf':1, 'df':2, 'tf-idf':0.5}"
+ ,"/termVectors/0/test_basictv=={'anoth':{},'titl':{}}"
+ ,"/termVectors/0/test_postv/anoth=={'tf':1, 'positions':{'position':1}, 'df':2, 'tf-idf':0.5}"
+ ,"/termVectors/0/test_offtv/anoth=={'tf':1, 'df':2, 'tf-idf':0.5}"
,"/termVectors/warnings=={ 'noTermVectors':['test_notv'], 'noPositions':['test_basictv', 'test_offtv'], 'noOffsets':['test_basictv', 'test_postv']}"
);
}
-
- // TODO: this test is really fragile since it pokes around in solr's guts and makes many assumptions.
- // it should be rewritten to use the real distributed interface
- @Test
- public void testDistributed() throws Exception {
- SolrCore core = h.getCore();
- TermVectorComponent tvComp = (TermVectorComponent) core.getSearchComponent("tvComponent");
- assertTrue("tvComp is null and it shouldn't be", tvComp != null);
- ModifiableSolrParams params = new ModifiableSolrParams();
- params.add(CommonParams.Q, "id:0");
- params.add(CommonParams.QT, "tvrh");
- params.add(TermVectorParams.TF, "true");
- params.add(TermVectorParams.DF, "true");
- params.add(TermVectorParams.OFFSETS, "true");
- params.add(TermVectorParams.POSITIONS, "true");
- params.add(TermVectorComponent.COMPONENT_NAME, "true");
-
- ResponseBuilder rb = new ResponseBuilder(new LocalSolrQueryRequest(core, params), new SolrQueryResponse(), (List)Arrays.asList(tvComp));
- rb.stage = ResponseBuilder.STAGE_GET_FIELDS;
- rb.shards = new String[]{"localhost:0", "localhost:1", "localhost:2", "localhost:3"};//we don't actually call these, since we are going to invoke distributedProcess directly
- rb.resultIds = new HashMap<Object, ShardDoc>();
-
- rb.outgoing = new ArrayList<ShardRequest>();
- //one doc per shard, but make sure there are enough docs to go around
- for (int i = 0; i < rb.shards.length; i++){
- ShardDoc doc = new ShardDoc();
- doc.id = i; //must be a valid doc that was indexed.
- doc.score = 1 - (i / (float)rb.shards.length);
- doc.positionInResponse = i;
- doc.shard = rb.shards[i];
- doc.orderInShard = 0;
- rb.resultIds.put(doc.id, doc);
- }
-
- int result = tvComp.distributedProcess(rb);
- assertTrue(result + " does not equal: " + ResponseBuilder.STAGE_DONE, result == ResponseBuilder.STAGE_DONE);
- //one outgoing per shard
- assertTrue("rb.outgoing Size: " + rb.outgoing.size() + " is not: " + rb.shards.length, rb.outgoing.size() == rb.shards.length);
- for (ShardRequest request : rb.outgoing) {
- ModifiableSolrParams solrParams = request.params;
- log.info("Shard: " + Arrays.asList(request.shards) + " Params: " + solrParams);
- }
-
- rb.req.close();
- }
-
}