SOLR-9592: use correct leaf reader rather than top-level reader in SolrIndexReaderm.decorateDocValues

This commit is contained in:
yonik 2016-10-05 15:10:22 -04:00
parent 001a3ca55b
commit cae6b49a06
26 changed files with 81 additions and 61 deletions

View File

@ -177,6 +177,11 @@ Optimizations
* SOLR-9446: Leader failure after creating a freshly replicated index can send nodes into recovery even if
index was not changed (Pushkar Raste, noble)
* SOLR-9592: retrieving docValues as stored values was sped up by using the proper leaf
reader rather than ask for a global view. In extreme cases, this leads to a 100x speedup.
(Takahiro Ishikawa, yonik)
Other Changes
----------------------

View File

@ -340,7 +340,7 @@ public class LukeRequestHandler extends RequestHandlerBase
fields = new TreeSet<>(Arrays.asList(fl.split( "[,\\s]+" )));
}
LeafReader reader = searcher.getLeafReader();
LeafReader reader = searcher.getSlowAtomicReader();
IndexSchema schema = searcher.getSchema();
// Don't be tempted to put this in the loop below, the whole point here is to alphabetize the fields!

View File

@ -208,7 +208,7 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
}
SolrIndexSearcher searcher = req.getSearcher();
LeafReader reader = searcher.getLeafReader();
LeafReader reader = searcher.getSlowAtomicReader();
FieldType fieldType = searcher.getSchema().getField(field).getType();
@ -220,7 +220,7 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
if(CollapsingQParserPlugin.HINT_TOP_FC.equals(hint)) {
Map<String, UninvertingReader.Type> mapping = new HashMap();
mapping.put(field, UninvertingReader.Type.SORTED);
UninvertingReader uninvertingReader = new UninvertingReader(new ReaderWrapper(searcher.getLeafReader(), field), mapping);
UninvertingReader uninvertingReader = new UninvertingReader(new ReaderWrapper(searcher.getSlowAtomicReader(), field), mapping);
values = uninvertingReader.getSortedDocValues(field);
} else {
values = DocValues.getSorted(reader, field);
@ -380,7 +380,7 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia
if(CollapsingQParserPlugin.HINT_TOP_FC.equals(hint)) {
Map<String, UninvertingReader.Type> mapping = new HashMap();
mapping.put(field, UninvertingReader.Type.SORTED);
UninvertingReader uninvertingReader = new UninvertingReader(new ReaderWrapper(searcher.getLeafReader(), field), mapping);
UninvertingReader uninvertingReader = new UninvertingReader(new ReaderWrapper(searcher.getSlowAtomicReader(), field), mapping);
values = uninvertingReader.getSortedDocValues(field);
} else {
values = DocValues.getSorted(reader, field);

View File

@ -64,7 +64,7 @@ public class FieldFacetStats {
this.facet_sf = facet_sf;
this.name = facet_sf.getName();
topLevelReader = searcher.getLeafReader();
topLevelReader = searcher.getSlowAtomicReader();
valueSource = facet_sf.getType().getValueSource(facet_sf, null);
facetStatsValues = new HashMap<>();

View File

@ -136,7 +136,7 @@ public class TermsComponent extends SearchComponent {
boolean raw = params.getBool(TermsParams.TERMS_RAW, false);
final LeafReader indexReader = rb.req.getSearcher().getLeafReader();
final LeafReader indexReader = rb.req.getSearcher().getSlowAtomicReader();
Fields lfields = indexReader.fields();
for (String field : fields) {

View File

@ -220,7 +220,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
try {
// It'd be nice to know if payloads are on the tokenStream but the presence of the attribute isn't a good
// indicator.
final Terms terms = request.getSearcher().getLeafReader().fields().terms(fieldName);
final Terms terms = request.getSearcher().getSlowAtomicReader().fields().terms(fieldName);
if (terms != null) {
defaultPayloads = terms.hasPayloads();
}
@ -391,7 +391,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
FvhContainer fvhContainer = new FvhContainer(null, null); // Lazy container for fvh and fieldQuery
IndexReader reader = new TermVectorReusingLeafReader(req.getSearcher().getLeafReader()); // SOLR-5855
IndexReader reader = new TermVectorReusingLeafReader(req.getSearcher().getSlowAtomicReader()); // SOLR-5855
// Highlight each document
NamedList fragments = new SimpleOrderedMap();

View File

@ -69,12 +69,12 @@ public class DocValuesFacets {
final SortedSetDocValues si; // for term lookups only
OrdinalMap ordinalMap = null; // for mapping per-segment ords to global ones
if (multiValued) {
si = searcher.getLeafReader().getSortedSetDocValues(fieldName);
si = searcher.getSlowAtomicReader().getSortedSetDocValues(fieldName);
if (si instanceof MultiDocValues.MultiSortedSetDocValues) {
ordinalMap = ((MultiSortedSetDocValues)si).mapping;
}
} else {
SortedDocValues single = searcher.getLeafReader().getSortedDocValues(fieldName);
SortedDocValues single = searcher.getSlowAtomicReader().getSortedDocValues(fieldName);
si = single == null ? null : DocValues.singleton(single);
if (single instanceof MultiDocValues.MultiSortedDocValues) {
ordinalMap = ((MultiDocValues.MultiSortedDocValues)single).mapping;

View File

@ -83,13 +83,13 @@ public class DocValuesStats {
SortedSetDocValues si; // for term lookups only
OrdinalMap ordinalMap = null; // for mapping per-segment ords to global ones
if (multiValued) {
si = searcher.getLeafReader().getSortedSetDocValues(fieldName);
si = searcher.getSlowAtomicReader().getSortedSetDocValues(fieldName);
if (si instanceof MultiSortedSetDocValues) {
ordinalMap = ((MultiDocValues.MultiSortedSetDocValues)si).mapping;
}
} else {
SortedDocValues single = searcher.getLeafReader().getSortedDocValues(fieldName);
SortedDocValues single = searcher.getSlowAtomicReader().getSortedDocValues(fieldName);
si = single == null ? null : DocValues.singleton(single);
if (single instanceof MultiDocValues.MultiSortedDocValues) {
ordinalMap = ((MultiDocValues.MultiSortedDocValues)single).mapping;

View File

@ -266,7 +266,7 @@ final class NumericFacets {
for (int i = 0; i < result.size(); ++i) {
alreadySeen.add(result.getName(i));
}
final Terms terms = searcher.getLeafReader().terms(fieldName);
final Terms terms = searcher.getSlowAtomicReader().terms(fieldName);
if (terms != null) {
final String prefixStr = TrieField.getMainValuePrefix(ft);
final BytesRef prefix;
@ -319,7 +319,7 @@ final class NumericFacets {
final FunctionValues values = vs.getValues(Collections.emptyMap(), leaves.get(readerIdx));
counts.put(values.strVal(entry.docID - leaves.get(readerIdx).docBase), entry.count);
}
final Terms terms = searcher.getLeafReader().terms(fieldName);
final Terms terms = searcher.getSlowAtomicReader().terms(fieldName);
if (terms != null) {
final String prefixStr = TrieField.getMainValuePrefix(ft);
final BytesRef prefix;

View File

@ -859,7 +859,7 @@ public class SimpleFacets {
IndexSchema schema = searcher.getSchema();
LeafReader r = searcher.getLeafReader();
LeafReader r = searcher.getSlowAtomicReader();
FieldType ft = schema.getFieldType(field);
boolean sortByCount = sort.equals("count") || sort.equals("true");

View File

@ -381,7 +381,7 @@ public class SortingResponseWriter implements QueryResponseWriter {
sortValues[i] = new LongValue(field, new LongAsc());
}
} else if(ft instanceof StrField) {
LeafReader reader = searcher.getLeafReader();
LeafReader reader = searcher.getSlowAtomicReader();
SortedDocValues vals = reader.getSortedDocValues(field);
if(reverse) {
sortValues[i] = new StringValue(vals, field, new IntDesc());
@ -398,7 +398,7 @@ public class SortingResponseWriter implements QueryResponseWriter {
// This is a bit of a hack, but since the boolean field stores ByteRefs, just like Strings
// _and_ since "F" happens to sort before "T" (thus false sorts "less" than true)
// we can just use the existing StringValue here.
LeafReader reader = searcher.getLeafReader();
LeafReader reader = searcher.getSlowAtomicReader();
SortedDocValues vals = reader.getSortedDocValues(field);
if(reverse) {
sortValues[i] = new StringValue(vals, field, new IntDesc());

View File

@ -1274,7 +1274,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
Map<String, UninvertingReader.Type> mapping = new HashMap();
mapping.put(collapseField, UninvertingReader.Type.SORTED);
UninvertingReader uninvertingReader = new UninvertingReader(new ReaderWrapper(searcher.getLeafReader(), collapseField), mapping);
UninvertingReader uninvertingReader = new UninvertingReader(new ReaderWrapper(searcher.getSlowAtomicReader(), collapseField), mapping);
docValuesProducer = new EmptyDocValuesProducer() {
@Override
public SortedDocValues getSorted(FieldInfo ignored) throws IOException {
@ -1285,7 +1285,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
docValuesProducer = new EmptyDocValuesProducer() {
@Override
public SortedDocValues getSorted(FieldInfo ignored) throws IOException {
return DocValues.getSorted(searcher.getLeafReader(), collapseField);
return DocValues.getSorted(searcher.getSlowAtomicReader(), collapseField);
}
};
}

View File

@ -299,8 +299,8 @@ class JoinQuery extends Query {
fastForRandomSet = new HashDocSet(sset.getDocs(), 0, sset.size());
}
Fields fromFields = fromSearcher.getLeafReader().fields();
Fields toFields = fromSearcher==toSearcher ? fromFields : toSearcher.getLeafReader().fields();
Fields fromFields = fromSearcher.getSlowAtomicReader().fields();
Fields toFields = fromSearcher==toSearcher ? fromFields : toSearcher.getSlowAtomicReader().fields();
if (fromFields == null) return DocSet.EMPTY;
Terms terms = fromFields.terms(fromField);
Terms toTerms = toFields.terms(toField);
@ -322,8 +322,8 @@ class JoinQuery extends Query {
}
}
Bits fromLiveDocs = fromSearcher.getLeafReader().getLiveDocs();
Bits toLiveDocs = fromSearcher == toSearcher ? fromLiveDocs : toSearcher.getLeafReader().getLiveDocs();
Bits fromLiveDocs = fromSearcher.getSlowAtomicReader().getLiveDocs();
Bits toLiveDocs = fromSearcher == toSearcher ? fromLiveDocs : toSearcher.getSlowAtomicReader().getLiveDocs();
fromDeState = new SolrIndexSearcher.DocsEnumState();
fromDeState.fieldName = fromField;

View File

@ -406,7 +406,11 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
return reader.docFreq(term);
}
public final LeafReader getLeafReader() {
/**
* Not recommended to call this method unless there is some particular reason due to internally calling {@link SlowCompositeReaderWrapper}.
* Use {@link IndexSearcher#leafContexts} to get the sub readers instead of using this method.
*/
public final LeafReader getSlowAtomicReader() {
return leafReader;
}
@ -759,7 +763,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
*/
public void decorateDocValueFields(@SuppressWarnings("rawtypes") SolrDocumentBase doc, int docid, Set<String> fields)
throws IOException {
final LeafReader reader = getLeafReader();
final int subIndex = ReaderUtil.subIndex(docid, leafContexts);
final int localId = docid - leafContexts.get(subIndex).docBase;
final LeafReader leafReader = leafContexts.get(subIndex).reader();
for (String fieldName : fields) {
final SchemaField schemaField = schema.getFieldOrNull(fieldName);
if (schemaField == null || !schemaField.hasDocValues() || doc.containsKey(fieldName)) {
@ -768,9 +774,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
}
if (schemaField.multiValued()) {
final SortedSetDocValues values = reader.getSortedSetDocValues(fieldName);
final SortedSetDocValues values = leafReader.getSortedSetDocValues(fieldName);
if (values != null && values.getValueCount() > 0) {
if (values.advance(docid) == docid) {
if (values.advance(localId) == localId) {
final List<Object> outValues = new LinkedList<Object>();
for (long ord = values.nextOrd(); ord != SortedSetDocValues.NO_MORE_ORDS; ord = values.nextOrd()) {
final BytesRef value = values.lookupOrd(ord);
@ -785,8 +791,11 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
switch (dvType) {
case NUMERIC:
final NumericDocValues ndv = leafReader.getNumericDocValues(fieldName);
if (ndv == null) {
continue;
}
Long val;
if (ndv.advance(docid) == docid) {
if (ndv.advance(localId) == localId) {
val = ndv.longValue();
} else {
continue;
@ -807,8 +816,11 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
break;
case BINARY:
BinaryDocValues bdv = leafReader.getBinaryDocValues(fieldName);
if (bdv == null) {
continue;
}
BytesRef value;
if (bdv.advance(docid) == docid) {
if (bdv.advance(localId) == localId) {
value = BytesRef.deepCopyOf(bdv.binaryValue());
} else {
continue;
@ -817,7 +829,10 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
break;
case SORTED:
SortedDocValues sdv = leafReader.getSortedDocValues(fieldName);
if (sdv.advance(docid) == docid) {
if (sdv == null) {
continue;
}
if (sdv.advance(localId) == localId) {
final BytesRef bRef = sdv.binaryValue();
// Special handling for Boolean fields since they're stored as 'T' and 'F'.
if (schemaField.getType() instanceof BoolField) {

View File

@ -37,7 +37,7 @@ class FacetFieldProcessorByArrayUIF extends FacetFieldProcessorByArray {
@Override
protected void findStartAndEndOrds() throws IOException {
uif = UnInvertedField.getUnInvertedField(freq.field, fcontext.searcher);
te = uif.getOrdTermsEnum( fcontext.searcher.getLeafReader() ); // "te" can be null
te = uif.getOrdTermsEnum( fcontext.searcher.getSlowAtomicReader() ); // "te" can be null
startTermIndex = 0;
endTermIndex = uif.numTerms(); // one past the end

View File

@ -156,7 +156,7 @@ class FacetFieldProcessorByEnumTermsStream extends FacetFieldProcessor implement
}
}
Fields fields = fcontext.searcher.getLeafReader().fields();
Fields fields = fcontext.searcher.getSlowAtomicReader().fields();
Terms terms = fields == null ? null : fields.terms(sf.getName());
termsEnum = null;
@ -224,7 +224,7 @@ class FacetFieldProcessorByEnumTermsStream extends FacetFieldProcessor implement
if (deState == null) {
deState = new SolrIndexSearcher.DocsEnumState();
deState.fieldName = sf.getName();
deState.liveDocs = fcontext.searcher.getLeafReader().getLiveDocs();
deState.liveDocs = fcontext.searcher.getSlowAtomicReader().getLiveDocs();
deState.termsEnum = termsEnum;
deState.postingsEnum = postingsEnum;
deState.minSetSizeCached = minDfFilterCache;

View File

@ -197,7 +197,7 @@ class FacetFieldProcessorByHashDV extends FacetFieldProcessor {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
getClass()+" doesn't support prefix"); // yet, but it could
}
FieldInfo fieldInfo = fcontext.searcher.getLeafReader().getFieldInfos().fieldInfo(sf.getName());
FieldInfo fieldInfo = fcontext.searcher.getSlowAtomicReader().getFieldInfos().fieldInfo(sf.getName());
if (fieldInfo != null &&
fieldInfo.getDocValuesType() != DocValuesType.NUMERIC &&
fieldInfo.getDocValuesType() != DocValuesType.SORTED) {

View File

@ -40,7 +40,7 @@ public class FieldUtil {
public static SortedDocValues getSortedDocValues(QueryContext context, SchemaField field, QParser qparser) throws IOException {
SortedDocValues si = context.searcher().getLeafReader().getSortedDocValues( field.getName() );
SortedDocValues si = context.searcher().getSlowAtomicReader().getSortedDocValues( field.getName() );
// if (!field.hasDocValues() && (field.getType() instanceof StrField || field.getType() instanceof TextField)) {
// }
@ -48,7 +48,7 @@ public class FieldUtil {
}
public static SortedSetDocValues getSortedSetDocValues(QueryContext context, SchemaField field, QParser qparser) throws IOException {
SortedSetDocValues si = context.searcher().getLeafReader().getSortedSetDocValues(field.getName());
SortedSetDocValues si = context.searcher().getSlowAtomicReader().getSortedSetDocValues(field.getName());
return si == null ? DocValues.emptySortedSet() : si;
}

View File

@ -136,7 +136,7 @@ public class UnInvertedField extends DocTermOrds {
if (deState == null) {
deState = new SolrIndexSearcher.DocsEnumState();
deState.fieldName = field;
deState.liveDocs = searcher.getLeafReader().getLiveDocs();
deState.liveDocs = searcher.getSlowAtomicReader().getLiveDocs();
deState.termsEnum = te; // TODO: check for MultiTermsEnum in SolrIndexSearcher could now fail?
deState.postingsEnum = postingsEnum;
deState.minSetSizeCached = maxTermDocFreq;
@ -239,7 +239,7 @@ public class UnInvertedField extends DocTermOrds {
public TermsEnum getTermsEnum() throws IOException {
if (te == null) {
te = getOrdTermsEnum(searcher.getLeafReader());
te = getOrdTermsEnum(searcher.getSlowAtomicReader());
}
return te;
}

View File

@ -88,7 +88,7 @@ public class OrdFieldSource extends ValueSource {
r = SlowCompositeReaderWrapper.wrap(new MultiReader(insaneLeaves));
} else {
// reuse ordinalmap
r = ((SolrIndexSearcher)o).getLeafReader();
r = ((SolrIndexSearcher)o).getSlowAtomicReader();
}
} else {
IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader();

View File

@ -88,7 +88,7 @@ public class ReverseOrdFieldSource extends ValueSource {
r = SlowCompositeReaderWrapper.wrap(new MultiReader(insaneLeaves));
} else {
// reuse ordinalmap
r = ((SolrIndexSearcher)o).getLeafReader();
r = ((SolrIndexSearcher)o).getSlowAtomicReader();
}
} else {
IndexReader topReader = ReaderUtil.getTopLevelContext(readerContext).reader();

View File

@ -60,12 +60,12 @@ class BlockJoinFieldFacetAccumulator {
fieldType = schemaField.getType();
ordinalMap = null;
if (schemaField.multiValued()) {
topSSDV = searcher.getLeafReader().getSortedSetDocValues(fieldName);
topSSDV = searcher.getSlowAtomicReader().getSortedSetDocValues(fieldName);
if (topSSDV instanceof MultiDocValues.MultiSortedSetDocValues) {
ordinalMap = ((MultiDocValues.MultiSortedSetDocValues) topSSDV).mapping;
}
} else {
SortedDocValues single = searcher.getLeafReader().getSortedDocValues(fieldName);
SortedDocValues single = searcher.getSlowAtomicReader().getSortedDocValues(fieldName);
if (single instanceof MultiDocValues.MultiSortedDocValues) {
ordinalMap = ((MultiDocValues.MultiSortedDocValues) single).mapping;
}

View File

@ -82,7 +82,7 @@ public class TestFaceting extends SolrTestCaseJ4 {
createIndex(size);
req = lrf.makeRequest("q","*:*");
SortedSetDocValues dv = DocValues.getSortedSet(req.getSearcher().getLeafReader(), proto.field());
SortedSetDocValues dv = DocValues.getSortedSet(req.getSearcher().getSlowAtomicReader(), proto.field());
assertEquals(size, dv.getValueCount());
@ -712,16 +712,16 @@ public class TestFaceting extends SolrTestCaseJ4 {
RefCounted<SolrIndexSearcher> currentSearcherRef = h.getCore().getSearcher();
try {
SolrIndexSearcher currentSearcher = currentSearcherRef.get();
SortedSetDocValues ui0 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f0_ws");
SortedSetDocValues ui1 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f1_ws");
SortedSetDocValues ui2 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f2_ws");
SortedSetDocValues ui3 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f3_ws");
SortedSetDocValues ui4 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f4_ws");
SortedSetDocValues ui5 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f5_ws");
SortedSetDocValues ui6 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f6_ws");
SortedSetDocValues ui7 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f7_ws");
SortedSetDocValues ui8 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f8_ws");
SortedSetDocValues ui9 = DocValues.getSortedSet(currentSearcher.getLeafReader(), "f9_ws");
SortedSetDocValues ui0 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f0_ws");
SortedSetDocValues ui1 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f1_ws");
SortedSetDocValues ui2 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f2_ws");
SortedSetDocValues ui3 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f3_ws");
SortedSetDocValues ui4 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f4_ws");
SortedSetDocValues ui5 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f5_ws");
SortedSetDocValues ui6 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f6_ws");
SortedSetDocValues ui7 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f7_ws");
SortedSetDocValues ui8 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f8_ws");
SortedSetDocValues ui9 = DocValues.getSortedSet(currentSearcher.getSlowAtomicReader(), "f9_ws");
assertQ("check threading, more threads than fields",
req(methodParam

View File

@ -63,7 +63,7 @@ public class DocValuesMultiTest extends SolrTestCaseJ4 {
final RefCounted<SolrIndexSearcher> searcherRef = core.openNewSearcher(true, true);
final SolrIndexSearcher searcher = searcherRef.get();
try {
final LeafReader reader = searcher.getLeafReader();
final LeafReader reader = searcher.getSlowAtomicReader();
assertEquals(1, reader.numDocs());
final FieldInfos infos = reader.getFieldInfos();
assertEquals(DocValuesType.SORTED_SET, infos.fieldInfo("stringdv").getDocValuesType());

View File

@ -76,7 +76,7 @@ public class DocValuesTest extends SolrTestCaseJ4 {
final RefCounted<SolrIndexSearcher> searcherRef = core.openNewSearcher(true, true);
final SolrIndexSearcher searcher = searcherRef.get();
try {
final LeafReader reader = searcher.getLeafReader();
final LeafReader reader = searcher.getSlowAtomicReader();
assertEquals(1, reader.numDocs());
final FieldInfos infos = reader.getFieldInfos();
assertEquals(DocValuesType.NUMERIC, infos.fieldInfo("floatdv").getDocValuesType());
@ -112,20 +112,20 @@ public class DocValuesTest extends SolrTestCaseJ4 {
final SchemaField longDv = schema.getField("longdv");
final SchemaField boolDv = schema.getField("booldv");
FunctionValues values = floatDv.getType().getValueSource(floatDv, null).getValues(null, searcher.getLeafReader().leaves().get(0));
FunctionValues values = floatDv.getType().getValueSource(floatDv, null).getValues(null, searcher.getSlowAtomicReader().leaves().get(0));
assertEquals(1f, values.floatVal(0), 0f);
assertEquals(1f, values.objectVal(0));
values = intDv.getType().getValueSource(intDv, null).getValues(null, searcher.getLeafReader().leaves().get(0));
values = intDv.getType().getValueSource(intDv, null).getValues(null, searcher.getSlowAtomicReader().leaves().get(0));
assertEquals(2, values.intVal(0));
assertEquals(2, values.objectVal(0));
values = doubleDv.getType().getValueSource(doubleDv, null).getValues(null, searcher.getLeafReader().leaves().get(0));
values = doubleDv.getType().getValueSource(doubleDv, null).getValues(null, searcher.getSlowAtomicReader().leaves().get(0));
assertEquals(3d, values.doubleVal(0), 0d);
assertEquals(3d, values.objectVal(0));
values = longDv.getType().getValueSource(longDv, null).getValues(null, searcher.getLeafReader().leaves().get(0));
values = longDv.getType().getValueSource(longDv, null).getValues(null, searcher.getSlowAtomicReader().leaves().get(0));
assertEquals(4L, values.longVal(0));
assertEquals(4L, values.objectVal(0));
values = boolDv.getType().getValueSource(boolDv, null).getValues(null, searcher.getLeafReader().leaves().get(0));
values = boolDv.getType().getValueSource(boolDv, null).getValues(null, searcher.getSlowAtomicReader().leaves().get(0));
assertEquals("true", values.strVal(0));
assertEquals(true, values.objectVal(0));

View File

@ -187,7 +187,7 @@ public class TestScoreJoinQPScore extends SolrTestCaseJ4 {
final SolrQueryRequest req = req("q", "{!join from=movieId_s to=id score=" + score + " b=200}title:movie", "fl", "id,score", "omitHeader", "true");
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, new SolrQueryResponse()));
final Query luceneQ = QParser.getParser(req.getParams().get("q"), req).getQuery().rewrite(req.getSearcher().getLeafReader());
final Query luceneQ = QParser.getParser(req.getParams().get("q"), req).getQuery().rewrite(req.getSearcher().getSlowAtomicReader());
assertTrue(luceneQ instanceof BoostQuery);
float boost = ((BoostQuery) luceneQ).getBoost();
assertEquals("" + luceneQ, Float.floatToIntBits(200), Float.floatToIntBits(boost));