mirror of https://github.com/apache/lucene.git
tests: fix test of unordered namedlist, skip explain comparisons
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1369984 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15ab29fc95
commit
0834c89f92
|
@ -310,7 +310,8 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
unIgnoreException("isShard is only acceptable");
|
||||
|
||||
// test debugging
|
||||
handle.put("explain", UNORDERED);
|
||||
// handle.put("explain", UNORDERED);
|
||||
handle.put("explain", SKIPVAL); // internal docids differ, idf differs w/o global idf
|
||||
handle.put("debug", UNORDERED);
|
||||
handle.put("time", SKIPVAL);
|
||||
query("q","now their fox sat had put","fl","*,score",CommonParams.DEBUG_QUERY, "true");
|
||||
|
|
|
@ -281,7 +281,7 @@ public class BasicDistributedZkTest extends AbstractDistributedZkTestCase {
|
|||
}
|
||||
|
||||
// test debugging
|
||||
handle.put("explain", UNORDERED);
|
||||
handle.put("explain", SKIPVAL);
|
||||
handle.put("debug", UNORDERED);
|
||||
handle.put("time", SKIPVAL);
|
||||
query("q","now their fox sat had put","fl","*,score",CommonParams.DEBUG_QUERY, "true");
|
||||
|
|
|
@ -845,7 +845,7 @@ public class FullSolrCloudTest extends AbstractDistributedZkTestCase {
|
|||
}
|
||||
|
||||
private void testDebugQueries() throws Exception {
|
||||
handle.put("explain", UNORDERED);
|
||||
handle.put("explain", SKIPVAL);
|
||||
handle.put("debug", UNORDERED);
|
||||
handle.put("time", SKIPVAL);
|
||||
query("q", "now their fox sat had put", "fl", "*,score",
|
||||
|
|
|
@ -450,11 +450,25 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
// System.out.println("resp b:" + b);
|
||||
boolean ordered = (flags & UNORDERED) == 0;
|
||||
|
||||
if (!ordered) {
|
||||
Map mapA = new HashMap(a.size());
|
||||
for (int i=0; i<a.size(); i++) {
|
||||
Object prev = mapA.put(a.getName(i), a.getVal(i));
|
||||
}
|
||||
|
||||
Map mapB = new HashMap(b.size());
|
||||
for (int i=0; i<b.size(); i++) {
|
||||
Object prev = mapB.put(b.getName(i), b.getVal(i));
|
||||
}
|
||||
|
||||
return compare(mapA, mapB, flags, handle);
|
||||
}
|
||||
|
||||
int posa = 0, posb = 0;
|
||||
int aSkipped = 0, bSkipped = 0;
|
||||
|
||||
for (; ;) {
|
||||
if (posa >= a.size() || posb >= b.size()) {
|
||||
if (posa >= a.size() && posb >= b.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -468,29 +482,27 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
posa++;
|
||||
flagsa = flags(handle, namea);
|
||||
if ((flagsa & SKIP) != 0) {
|
||||
namea = null; vala = null;
|
||||
aSkipped++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ordered) posb = 0; // reset if not ordered
|
||||
|
||||
while (posb < b.size()) {
|
||||
nameb = b.getName(posb);
|
||||
valb = b.getVal(posb);
|
||||
posb++;
|
||||
flagsb = flags(handle, nameb);
|
||||
if ((flagsb & SKIP) != 0) {
|
||||
nameb = null; valb = null;
|
||||
bSkipped++;
|
||||
continue;
|
||||
}
|
||||
if (eq(namea, nameb)) {
|
||||
break;
|
||||
}
|
||||
if (ordered) {
|
||||
return "." + namea + "!=" + nameb + " (unordered or missing)";
|
||||
}
|
||||
return "." + namea + "!=" + nameb + " (unordered or missing)";
|
||||
// if unordered, continue until we find the right field.
|
||||
}
|
||||
|
||||
|
@ -503,7 +515,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
|
|||
|
||||
|
||||
if (a.size() - aSkipped != b.size() - bSkipped) {
|
||||
return ".size()==" + a.size() + "," + b.size() + "skipped=" + aSkipped + "," + bSkipped;
|
||||
return ".size()==" + a.size() + "," + b.size() + " skipped=" + aSkipped + "," + bSkipped;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue