mirror of https://github.com/apache/lucene.git
LUCENE-8741: Fix ClassCastException in ValueSource.fromDoubleValuesSource()
This commit is contained in:
parent
3a63c58db3
commit
1c46dd1f9b
|
@ -58,6 +58,10 @@ Bug fixes
|
|||
matching. This behaviour can be disabled if users are more interested
|
||||
in speed rather than accuracy of matching. (Alan Woodward, Jim Ferenczi)
|
||||
|
||||
* LUCENE-8741: ValueSource.fromDoubleValuesSource() was casting to
|
||||
Scorer instead of Scorable, leading to ClassCastExceptions (Markus Jelsma,
|
||||
Alan Woodward)
|
||||
|
||||
Improvements
|
||||
|
||||
* LUCENE-8673: Use radix partitioning when merging dimensional points instead
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.lucene.search.IndexSearcher;
|
|||
import org.apache.lucene.search.LongValues;
|
||||
import org.apache.lucene.search.LongValuesSource;
|
||||
import org.apache.lucene.search.Scorable;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.SimpleFieldComparator;
|
||||
import org.apache.lucene.search.SortField;
|
||||
|
||||
|
@ -285,7 +284,7 @@ public abstract class ValueSource {
|
|||
|
||||
@Override
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
Scorer scorer = (Scorer) context.get("scorer");
|
||||
Scorable scorer = (Scorable) context.get("scorer");
|
||||
DoubleValues scores = scorer == null ? null : DoubleValuesSource.fromScorer(scorer);
|
||||
|
||||
IndexSearcher searcher = (IndexSearcher) context.get("searcher");
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.lucene.index.Term;
|
|||
import org.apache.lucene.queries.function.docvalues.FloatDocValues;
|
||||
import org.apache.lucene.queries.function.valuesource.*;
|
||||
import org.apache.lucene.search.CheckHits;
|
||||
import org.apache.lucene.search.DoubleValuesSource;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.ScoreDoc;
|
||||
|
@ -580,6 +581,11 @@ public class TestValueSources extends LuceneTestCase {
|
|||
assertNull(source2.searcher);
|
||||
|
||||
}
|
||||
|
||||
public void testBuildingFromDoubleValues() throws Exception {
|
||||
DoubleValuesSource dvs = ValueSource.fromDoubleValuesSource(DoubleValuesSource.fromDoubleField("double")).asDoubleValuesSource();
|
||||
assertHits(new FunctionQuery(ValueSource.fromDoubleValuesSource(dvs)), new float[] { 3.63f, 5.65f });
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that for every doc, the {@link FunctionValues#exists} value
|
||||
|
|
Loading…
Reference in New Issue