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