SOLR-2089: fixed tests + exception when facet.offset is beyond queue size

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@989950 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-08-26 22:05:26 +00:00
parent 2936c034f0
commit 44468e02bf
2 changed files with 15 additions and 1 deletions

View File

@ -600,8 +600,10 @@ public class UnInvertedField {
// now select the right page from the results
final int[] tnums = new int[Math.min(queue.size()-off, lim)];
final int[] tnums = new int[Math.min(Math.max(0, queue.size()-off), lim)];
final int[] indirect = counts; // reuse the counts array for the index into the tnums array
assert indirect.length >= tnums.length;
int tnumCount = 0;
for (Long p : queue) {

View File

@ -315,12 +315,24 @@ public class SolrTestCaseJ4 extends LuceneTestCaseJ4 {
try {
String m = (null == message) ? "" : message + " ";
String response = h.query(req);
if (req.getParams().getBool("facet", false)) {
// add a test to ensure that faceting did not throw an exception
// internally, where it would be added to facet_counts/exception
String[] allTests = new String[tests.length+1];
System.arraycopy(tests,0,allTests,1,tests.length);
allTests[0] = "*[count(//lst[@name='facet_counts']/*[@name='exception'])=0]";
tests = allTests;
}
String results = h.validateXPath(response, tests);
if (null != results) {
fail(m + "query failed XPath: " + results +
"\n xml response was: " + response +
"\n request was: " + req.getParamString());
}
} catch (XPathExpressionException e1) {
throw new RuntimeException("XPath is invalid", e1);
} catch (Exception e2) {