mirror of https://github.com/apache/lucene.git
SOLR-14495: Fix or suppress warnings in solr/search/function
This commit is contained in:
parent
78f4a5b8ff
commit
675956c004
|
@ -253,6 +253,12 @@ Other Changes
|
|||
|
||||
* SOLR-14482: Fix or suppress warnings in solr/search/facet (Erick Erickson)
|
||||
|
||||
|
||||
* SOLR-14485: Fix or suppress 11 resource leak warnings in apache/solr/cloud (Andras Salaman via
|
||||
Erick Erickson)
|
||||
|
||||
* SOLR-14495: Fix or suppress warnings in solr/search/function (Erick Erickson)
|
||||
|
||||
================== 8.5.1 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -41,17 +41,20 @@ public class FunctionRangeQuery extends SolrConstantScoreQuery implements PostFi
|
|||
|
||||
@Override
|
||||
public DelegatingCollector getFilterCollector(IndexSearcher searcher) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map fcontext = ValueSource.newContext(searcher);
|
||||
Weight weight = rangeFilt.createWeight(searcher, ScoreMode.COMPLETE, 1);
|
||||
return new FunctionRangeCollector(fcontext, weight);
|
||||
}
|
||||
|
||||
class FunctionRangeCollector extends DelegatingCollector {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
final Map fcontext;
|
||||
final Weight weight;
|
||||
ValueSourceScorer scorer;
|
||||
int maxdoc;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionRangeCollector(Map fcontext, Weight weight) {
|
||||
this.fcontext = fcontext;
|
||||
this.weight = weight;
|
||||
|
|
|
@ -41,6 +41,7 @@ public class CollapseScoreFunction extends ValueSource {
|
|||
return 1213241257;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
return new CollapseScoreFunctionValues(context);
|
||||
}
|
||||
|
@ -49,6 +50,7 @@ public class CollapseScoreFunction extends ValueSource {
|
|||
|
||||
private CollapseScore cscore;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public CollapseScoreFunctionValues(Map context) {
|
||||
this.cscore = (CollapseScore) context.get("CSCORE");
|
||||
assert null != this.cscore;
|
||||
|
|
|
@ -39,6 +39,7 @@ public class FieldNameValueSource extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
throw new UnsupportedOperationException("FieldNameValueSource should not be directly used: " + this);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,8 @@ public class FileFloatSource extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final int off = readerContext.docBase;
|
||||
IndexReaderContext topLevelContext = ReaderUtil.getTopLevelContext(readerContext);
|
||||
|
@ -165,29 +167,34 @@ public class FileFloatSource extends ValueSource {
|
|||
|
||||
/** Internal cache. (from lucene FieldCache) */
|
||||
abstract static class Cache {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private final Map readerCache = new WeakHashMap();
|
||||
|
||||
protected abstract Object createValue(IndexReader reader, Object key);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public void refresh(IndexReader reader, Object key) {
|
||||
Object refreshedValues = createValue(reader, key);
|
||||
synchronized (readerCache) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map innerCache = (Map) readerCache.get(reader);
|
||||
if (innerCache == null) {
|
||||
innerCache = new HashMap();
|
||||
innerCache = new HashMap<>();
|
||||
readerCache.put(reader, innerCache);
|
||||
}
|
||||
innerCache.put(key, refreshedValues);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Object get(IndexReader reader, Object key) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map innerCache;
|
||||
Object value;
|
||||
synchronized (readerCache) {
|
||||
innerCache = (Map) readerCache.get(reader);
|
||||
if (innerCache == null) {
|
||||
innerCache = new HashMap();
|
||||
innerCache = new HashMap<>();
|
||||
readerCache.put(reader, innerCache);
|
||||
value = null;
|
||||
} else {
|
||||
|
|
|
@ -60,6 +60,7 @@ public abstract class MultiStringFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final FunctionValues[] valsArr = new FunctionValues[sources.length];
|
||||
for (int i=0; i<sources.length; i++) {
|
||||
|
|
|
@ -71,6 +71,7 @@ public class OrdFieldSource extends ValueSource {
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final int off = readerContext.docBase;
|
||||
final LeafReader r;
|
||||
|
|
|
@ -71,6 +71,7 @@ public class ReverseOrdFieldSource extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final int off = readerContext.docBase;
|
||||
final LeafReader r;
|
||||
|
|
|
@ -78,6 +78,7 @@ public class ValueSourceRangeFilter extends SolrFilter {
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public DocIdSet getDocIdSet(final Map context, final LeafReaderContext readerContext, Bits acceptDocs) throws IOException {
|
||||
// NB the IndexSearcher parameter here can be null because Filter Weights don't
|
||||
// actually use it.
|
||||
|
@ -101,6 +102,7 @@ public class ValueSourceRangeFilter extends SolrFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
||||
valueSource.createWeight(context, searcher);
|
||||
}
|
||||
|
|
|
@ -193,6 +193,7 @@ public class GeoDistValueSourceParser extends ValueSourceParser {
|
|||
SchemaField sf = fp.getReq().getSchema().getField(sfield);
|
||||
FieldType type = sf.getType();
|
||||
if (type instanceof AbstractSpatialFieldType) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
AbstractSpatialFieldType asft = (AbstractSpatialFieldType) type;
|
||||
return new SpatialStrategyMultiValueSource(asft.getStrategy(sfield), asft.getDistanceUnits());
|
||||
}
|
||||
|
@ -209,7 +210,7 @@ public class GeoDistValueSourceParser extends ValueSourceParser {
|
|||
|
||||
final SpatialStrategy strategy;
|
||||
final DistanceUnits distanceUnits;
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public SpatialStrategyMultiValueSource(SpatialStrategy strategy, DistanceUnits distanceUnits) {
|
||||
super(Collections.EMPTY_LIST);
|
||||
this.strategy = strategy;
|
||||
|
|
|
@ -45,6 +45,7 @@ public class GeohashFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final FunctionValues latDV = lat.getValues(context, readerContext);
|
||||
final FunctionValues lonDV = lon.getValues(context, readerContext);
|
||||
|
|
|
@ -59,6 +59,7 @@ public class GeohashHaversineFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final FunctionValues gh1DV = geoHash1.getValues(context, readerContext);
|
||||
final FunctionValues gh2DV = geoHash2.getValues(context, readerContext);
|
||||
|
@ -96,6 +97,7 @@ public class GeohashHaversineFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
||||
geoHash1.createWeight(context, searcher);
|
||||
geoHash2.createWeight(context, searcher);
|
||||
|
|
|
@ -56,6 +56,7 @@ public class HaversineConstFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final FunctionValues latVals = latSource.getValues(context, readerContext);
|
||||
final FunctionValues lonVals = lonSource.getValues(context, readerContext);
|
||||
|
@ -84,6 +85,7 @@ public class HaversineConstFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
||||
latSource.createWeight(context, searcher);
|
||||
lonSource.createWeight(context, searcher);
|
||||
|
|
|
@ -93,6 +93,7 @@ public class HaversineFunction extends ValueSource {
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final FunctionValues vals1 = p1.getValues(context, readerContext);
|
||||
|
||||
|
@ -114,6 +115,7 @@ public class HaversineFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
||||
p1.createWeight(context, searcher);
|
||||
p2.createWeight(context, searcher);
|
||||
|
|
|
@ -43,6 +43,7 @@ public class StringDistanceFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
final FunctionValues str1DV = str1.getValues(context, readerContext);
|
||||
final FunctionValues str2DV = str2.getValues(context, readerContext);
|
||||
|
|
|
@ -149,6 +149,7 @@ public class VectorDistanceFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
|
||||
|
||||
final FunctionValues vals1 = source1.getValues(context, readerContext);
|
||||
|
@ -177,6 +178,7 @@ public class VectorDistanceFunction extends ValueSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
|
||||
source1.createWeight(context, searcher);
|
||||
source2.createWeight(context, searcher);
|
||||
|
|
Loading…
Reference in New Issue