SOLR-2626, LUCENE-2831: fix offset bug in cutover to AtomicReaderContext

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1140859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2011-06-28 21:39:01 +00:00
parent 4a3b510739
commit e5addc06d3
2 changed files with 16 additions and 3 deletions

View File

@ -76,9 +76,8 @@ public class FileFloatSource extends ValueSource {
@Override
public DocValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
int offset = 0;
final int off = readerContext.docBase;
ReaderContext topLevelContext = ReaderUtil.getTopLevelContext(readerContext);
final int off = offset;
final float[] arr = getCachedFloats(topLevelContext.reader);
return new FloatDocValues(this) {

View File

@ -65,11 +65,25 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
// lrf.args.put("version","2.0");
for (float val : values) {
String s = Float.toString(val);
if (field!=null) assertU(adoc("id", s, field, s));
else assertU(adoc("id", s));
if (random.nextInt(100) < 20) {
if (field!=null) assertU(adoc("id", s, field, s));
else assertU(adoc("id", s));
}
if (random.nextInt(100) < 20) {
assertU(commit());
}
// System.out.println("added doc for " + val);
}
assertU(optimize()); // squeeze out any possible deleted docs
// assertU(optimize()); // squeeze out any possible deleted docs
assertU(commit());
}
// replace \0 with the field name and create a parseable string