SOLR-14543: Fix or suppress warnings in apache/solr/search

This commit is contained in:
Erick Erickson 2020-06-07 21:20:25 -04:00
parent f404a38fa6
commit 04ba04c29d
43 changed files with 181 additions and 48 deletions

View File

@ -306,6 +306,8 @@ Other Changes
* SOLR-14542: Fix or suppress warnings in solr/handler/dataimport (Erick Erickson)
* SOLR-14543: Fix or suppress warnings in apache/solr/search (Erick Erickson)
================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -56,7 +56,7 @@ public abstract class AbstractReRankQuery extends RankQuery {
return null;
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
public TopDocsCollector getTopDocsCollector(int len, QueryCommand cmd, IndexSearcher searcher) throws IOException {
if(this.boostedPriority == null) {
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();

View File

@ -49,6 +49,7 @@ public class CacheConfig implements MapSerializable{
private String nodeName;
@SuppressWarnings({"rawtypes"})
private Class<? extends SolrCache> clazz;
private Map<String,String> args;
private CacheRegenerator regenerator;
@ -61,6 +62,7 @@ public class CacheConfig implements MapSerializable{
public CacheConfig() {}
@SuppressWarnings({"rawtypes"})
public CacheConfig(Class<? extends SolrCache> clazz, Map<String,String> args, CacheRegenerator regenerator) {
this.clazz = clazz;
this.args = args;
@ -91,6 +93,7 @@ public class CacheConfig implements MapSerializable{
}
@SuppressWarnings({"unchecked"})
public static CacheConfig getConfig(SolrConfig solrConfig, String xpath) {
Node node = solrConfig.getNode(xpath, false);
if(node == null || !"true".equals(DOMUtil.getAttrOrDefault(node, "enabled", "true"))) {
@ -103,9 +106,11 @@ public class CacheConfig implements MapSerializable{
}
@SuppressWarnings({"unchecked"})
public static CacheConfig getConfig(SolrConfig solrConfig, String nodeName, Map<String,String> attrs, String xpath) {
CacheConfig config = new CacheConfig();
config.nodeName = nodeName;
@SuppressWarnings({"rawtypes"})
Map attrsCopy = new LinkedHashMap<>(attrs.size());
for (Map.Entry<String, String> e : attrs.entrySet()) {
attrsCopy.put(e.getKey(), String.valueOf(e.getValue()));
@ -138,6 +143,7 @@ public class CacheConfig implements MapSerializable{
return config;
}
@SuppressWarnings({"rawtypes"})
public SolrCache newInstance() {
try {
SolrCache cache = clazz.getConstructor().newInstance();
@ -152,7 +158,9 @@ public class CacheConfig implements MapSerializable{
}
@Override
@SuppressWarnings({"unchecked"})
public Map<String, Object> toMap(Map<String, Object> map) {
@SuppressWarnings({"rawtypes"})
Map result = Collections.unmodifiableMap(args);
return result;
}

View File

@ -38,5 +38,7 @@ public interface CacheRegenerator {
* @param oldVal the old value of the cache item
* @return true to continue with autowarming, false to stop
*/
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache, Object oldKey, Object oldVal) throws IOException;
public boolean regenerateItem(SolrIndexSearcher newSearcher,
@SuppressWarnings({"rawtypes"})SolrCache newCache,
@SuppressWarnings({"rawtypes"})SolrCache oldCache, Object oldKey, Object oldVal) throws IOException;
}

View File

@ -136,7 +136,9 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements SolrCache<K, V
return persistence;
}
@SuppressWarnings({"unchecked"})
private Cache<K, V> buildCache(Cache<K, V> prev) {
@SuppressWarnings({"rawtypes"})
Caffeine builder = Caffeine.newBuilder()
.initialCapacity(initialSize)
.executor(executor)

View File

@ -366,6 +366,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
}
}
@SuppressWarnings({"unchecked"})
public DelegatingCollector getFilterCollector(IndexSearcher indexSearcher) {
try {
@ -376,6 +377,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
//because the QueryElevationComponent runs after the Queries are constructed.
IntIntHashMap boostDocsMap = null;
@SuppressWarnings({"rawtypes"})
Map context = null;
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
if(info != null) {
@ -1451,8 +1453,9 @@ public class CollapsingQParserPlugin extends QParserPlugin {
* If it is, then "this" will be added to the readerContext
* using the "CSCORE" key, and true will be returned. If not returns false.
*/
@SuppressWarnings({"unchecked"})
public boolean setupIfNeeded(final GroupHeadSelector groupHeadSelector,
final Map readerContext) {
@SuppressWarnings({"rawtypes"})final Map readerContext) {
// HACK, but not really any better options until/unless we can recursively
// ask value sources if they depend on score
if (wantsCScore(groupHeadSelector.selectorText)) {
@ -1832,6 +1835,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
private ValueSource valueSource;
private FunctionValues functionValues;
private IntFloatDynamicMap ordVals;
@SuppressWarnings({"rawtypes"})
private Map rcontext;
private final CollapseScore collapseScore = new CollapseScore();
private boolean needsScores4Collapsing;
@ -2353,6 +2357,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
private ValueSource valueSource;
private FunctionValues functionValues;
@SuppressWarnings({"rawtypes"})
private Map rcontext;
private final CollapseScore collapseScore = new CollapseScore();
private int index=-1;
@ -2632,6 +2637,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
final private int numClauses;
final private SortField[] sorts;
final private int[] reverseMul;
@SuppressWarnings({"rawtypes"})
final private FieldComparator[] fieldComparators;
final private LeafFieldComparator[] leafFieldComparators;
@ -2642,6 +2648,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
* Constructs an instance based on the the (raw, un-rewritten) SortFields to be used,
* and an initial number of expected groups (will grow as needed).
*/
@SuppressWarnings({"rawtypes"})
public SortFieldsCompare(SortField[] sorts, int initNumGroups) {
this.sorts = sorts;
numClauses = sorts.length;
@ -2757,6 +2764,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
* accordance with the SortFields.
* (otherwise returns false)
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private boolean testAndSetGroupValues(Object[] values, int contextDoc) throws IOException {
Object[] stash = new Object[numClauses];
int lastCompare = 0;

View File

@ -39,7 +39,7 @@ public class ComplexPhraseQParserPlugin extends QParserPlugin {
private boolean inOrder = true;
@Override
public void init(NamedList args) {
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
super.init(args);
if (args != null) {
Object val = args.get("inOrder");

View File

@ -172,6 +172,7 @@ public final class CursorMark {
*
* @see #getSerializedTotem
*/
@SuppressWarnings({"unchecked"})
public void parseSerializedTotem(final String serialized) {
if (CURSOR_MARK_START.equals(serialized)) {
values = null;

View File

@ -95,6 +95,7 @@ public class ExportQParserPlugin extends QParserPlugin {
}
}
@SuppressWarnings({"rawtypes"})
public TopDocsCollector getTopDocsCollector(int len,
QueryCommand cmd,
IndexSearcher searcher) throws IOException {
@ -137,10 +138,12 @@ public class ExportQParserPlugin extends QParserPlugin {
}
}
@SuppressWarnings({"rawtypes"})
private static class ExportCollector extends TopDocsCollector {
private FixedBitSet[] sets;
@SuppressWarnings({"unchecked"})
public ExportCollector(FixedBitSet[] sets) {
super(null);
this.sets = sets;
@ -172,6 +175,7 @@ public class ExportQParserPlugin extends QParserPlugin {
return docs;
}
@SuppressWarnings({"unchecked"})
public TopDocs topDocs(int start, int howMany) {
assert(sets != null);
@ -180,6 +184,7 @@ public class ExportQParserPlugin extends QParserPlugin {
SolrQueryRequest req = null;
if(info != null && ((req = info.getReq()) != null)) {
@SuppressWarnings({"rawtypes"})
Map context = req.getContext();
context.put("export", sets);
context.put("totalHits", totalHits);

View File

@ -53,7 +53,8 @@ public class FloatPayloadValueSource extends ValueSource {
}
@Override
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
, LeafReaderContext readerContext) throws IOException {
final Terms terms = readerContext.reader().terms(indexedField);

View File

@ -82,6 +82,7 @@ public class Grouping {
private final SolrIndexSearcher searcher;
private final QueryResult qr;
private final QueryCommand cmd;
@SuppressWarnings({"rawtypes"})
private final List<Command> commands = new ArrayList<>();
private final boolean main;
private final boolean cacheSecondPassSearch;
@ -103,6 +104,7 @@ public class Grouping {
private Query query;
private DocSet filter;
private Filter luceneFilter;
@SuppressWarnings({"rawtypes"})
private NamedList grouped = new SimpleOrderedMap();
private Set<Integer> idSet = new LinkedHashSet<>(); // used for tracking unique docs when we need a doclist
private int maxMatches; // max number of matches from any grouping command
@ -134,7 +136,7 @@ public class Grouping {
this.main = main;
}
public void add(Grouping.Command groupingCommand) {
public void add(@SuppressWarnings({"rawtypes"})Grouping.Command groupingCommand) {
commands.add(groupingCommand);
}
@ -180,6 +182,7 @@ public class Grouping {
public void addFunctionCommand(String groupByStr, SolrQueryRequest request) throws SyntaxError {
QParser parser = QParser.getParser(groupByStr, FunctionQParserPlugin.NAME, request);
Query q = parser.getQuery();
@SuppressWarnings({"rawtypes"})
final Grouping.Command gc;
if (q instanceof FunctionQuery) {
ValueSource valueSource = ((FunctionQuery) q).getValueSource();
@ -288,6 +291,7 @@ public class Grouping {
return this;
}
@SuppressWarnings({"rawtypes"})
public List<Command> getCommands() {
return commands;
}
@ -317,13 +321,13 @@ public class Grouping {
getDocList = (cmd.getFlags() & SolrIndexSearcher.GET_DOCLIST) != 0;
query = QueryUtils.makeQueryable(cmd.getQuery());
for (Command cmd : commands) {
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
cmd.prepare();
}
AllGroupHeadsCollector<?> allGroupHeadsCollector = null;
List<Collector> collectors = new ArrayList<>(commands.size());
for (Command cmd : commands) {
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
Collector collector = cmd.createFirstPassCollector();
if (collector != null) {
collectors.add(collector);
@ -370,7 +374,7 @@ public class Grouping {
}
collectors.clear();
for (Command cmd : commands) {
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
Collector collector = cmd.createSecondPassCollector();
if (collector != null)
collectors.add(collector);
@ -401,7 +405,7 @@ public class Grouping {
}
}
for (Command cmd : commands) {
for (@SuppressWarnings({"rawtypes"})Command cmd : commands) {
cmd.finish();
}
@ -592,6 +596,7 @@ public class Grouping {
}
}
@SuppressWarnings({"unchecked", "rawtypes"})
protected NamedList commonResponse() {
NamedList groupResult = new SimpleOrderedMap();
grouped.add(key, groupResult); // grouped={ key={
@ -606,7 +611,7 @@ public class Grouping {
return groupResult;
}
protected DocList getDocList(GroupDocs groups) {
protected DocList getDocList(@SuppressWarnings({"rawtypes"})GroupDocs groups) {
assert groups.totalHits.relation == TotalHits.Relation.EQUAL_TO;
int max = Math.toIntExact(groups.totalHits.value);
int off = groupOffset;
@ -640,12 +645,15 @@ public class Grouping {
return docs;
}
protected void addDocList(NamedList rsp, GroupDocs groups) {
@SuppressWarnings({"unchecked"})
protected void addDocList(@SuppressWarnings({"rawtypes"})NamedList rsp
, @SuppressWarnings({"rawtypes"})GroupDocs groups) {
rsp.add("doclist", getDocList(groups));
}
// Flatten the groups and get up offset + rows documents
protected DocList createSimpleResponse() {
@SuppressWarnings({"rawtypes"})
GroupDocs[] groups = result != null ? result.groups : new GroupDocs[0];
List<Integer> ids = new ArrayList<>();
@ -655,7 +663,7 @@ public class Grouping {
float maxScore = Float.NaN;
outer:
for (GroupDocs group : groups) {
for (@SuppressWarnings({"rawtypes"})GroupDocs group : groups) {
maxScore = maxAvoidNaN(maxScore, group.maxScore);
for (ScoreDoc scoreDoc : group.scoreDocs) {
@ -768,6 +776,7 @@ public class Grouping {
}
@Override
@SuppressWarnings({"unchecked"})
protected void finish() throws IOException {
if (secondPass != null) {
result = secondPass.getTopGroups(0);
@ -778,6 +787,7 @@ public class Grouping {
return;
}
@SuppressWarnings({"rawtypes"})
NamedList groupResult = commonResponse();
if (format == Format.simple) {
@ -785,6 +795,7 @@ public class Grouping {
return;
}
@SuppressWarnings({"rawtypes"})
List groupList = new ArrayList();
groupResult.add("groups", groupList); // grouped={ key={ groups=[
@ -796,6 +807,7 @@ public class Grouping {
if (numGroups == 0) return;
for (GroupDocs<BytesRef> group : result.groups) {
@SuppressWarnings({"rawtypes"})
NamedList nl = new SimpleOrderedMap();
groupList.add(nl); // grouped={ key={ groups=[ {
@ -844,6 +856,7 @@ public class Grouping {
* A group command for grouping on a query.
*/
//NOTE: doesn't need to be generic. Maybe Command interface --> First / Second pass abstract impl.
@SuppressWarnings({"rawtypes"})
public class CommandQuery extends Command {
public Query query;
@ -911,6 +924,7 @@ public class Grouping {
public class CommandFunc extends Command<MutableValue> {
public ValueSource groupBy;
@SuppressWarnings({"rawtypes"})
Map context;
private ValueSourceGroupSelector newSelector() {
@ -985,6 +999,7 @@ public class Grouping {
}
@Override
@SuppressWarnings({"unchecked"})
protected void finish() throws IOException {
if (secondPass != null) {
result = secondPass.getTopGroups(0);
@ -995,6 +1010,7 @@ public class Grouping {
return;
}
@SuppressWarnings({"rawtypes"})
NamedList groupResult = commonResponse();
if (format == Format.simple) {
@ -1002,6 +1018,7 @@ public class Grouping {
return;
}
@SuppressWarnings({"rawtypes"})
List groupList = new ArrayList();
groupResult.add("groups", groupList); // grouped={ key={ groups=[
@ -1013,6 +1030,7 @@ public class Grouping {
if (numGroups == 0) return;
for (GroupDocs<MutableValue> group : result.groups) {
@SuppressWarnings({"rawtypes"})
NamedList nl = new SimpleOrderedMap();
groupList.add(nl); // grouped={ key={ groups=[ {
nl.add("groupValue", group.groupValue.toObject());

View File

@ -143,8 +143,10 @@ public class IGainTermsQParserPlugin extends QParserPlugin {
@Override
public void finish() throws IOException {
NamedList<Double> analytics = new NamedList<Double>();
@SuppressWarnings({"unchecked", "rawtypes"})
NamedList<Integer> topFreq = new NamedList();
@SuppressWarnings({"unchecked", "rawtypes"})
NamedList<Integer> allFreq = new NamedList();
rb.rsp.add("featuredTerms", analytics);

View File

@ -97,7 +97,7 @@ public abstract class QParserPlugin implements NamedListInitializedPlugin, SolrI
public abstract QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req);
@Override
public void init( NamedList args ) {
public void init( @SuppressWarnings({"rawtypes"})NamedList args ) {
}
@Override

View File

@ -48,6 +48,7 @@ public class QueryContext extends IdentityHashMap implements Closeable {
return context;
}
@SuppressWarnings({"unchecked"})
public QueryContext(IndexSearcher searcher) {
this.searcher = searcher instanceof SolrIndexSearcher ? (SolrIndexSearcher)searcher : null;
indexSearcher = searcher;

View File

@ -251,6 +251,7 @@ public class QueryParsing {
out.append(q.includesUpper() ? ']' : '}');
} else if (query instanceof LegacyNumericRangeQuery) {
@SuppressWarnings({"rawtypes"})
LegacyNumericRangeQuery q = (LegacyNumericRangeQuery) query;
String fname = q.getField();
FieldType ft = writeFieldName(fname, schema, out, flags);

View File

@ -29,6 +29,7 @@ import java.io.IOException;
public abstract class RankQuery extends ExtendedQueryBase {
@SuppressWarnings({"rawtypes"})
public abstract TopDocsCollector getTopDocsCollector(int len, QueryCommand cmd, IndexSearcher searcher) throws IOException;
public abstract MergeStrategy getMergeStrategy();
public abstract RankQuery wrap(Query mainQuery);

View File

@ -42,8 +42,10 @@ import org.apache.solr.handler.component.QueryElevationComponent;
import org.apache.solr.request.SolrRequestInfo;
/* A TopDocsCollector used by reranking queries. */
@SuppressWarnings({"rawtypes"})
public class ReRankCollector extends TopDocsCollector {
@SuppressWarnings({"rawtypes"})
final private TopDocsCollector mainCollector;
final private IndexSearcher searcher;
final private int reRankDocs;
@ -54,6 +56,7 @@ public class ReRankCollector extends TopDocsCollector {
final private Query query;
@SuppressWarnings({"unchecked"})
public ReRankCollector(int reRankDocs,
int length,
Rescorer reRankQueryRescorer,
@ -92,6 +95,7 @@ public class ReRankCollector extends TopDocsCollector {
return sort == null || sort.needsScores() ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES;
}
@SuppressWarnings({"unchecked"})
public TopDocs topDocs(int start, int howMany) {
try {
@ -152,6 +156,7 @@ public class ReRankCollector extends TopDocsCollector {
}
}
@SuppressWarnings({"rawtypes"})
public static class BoostedComp implements Comparator {
IntFloatHashMap boostedMap;

View File

@ -134,12 +134,18 @@ public class SignificantTermsQParserPlugin extends QParserPlugin {
@Override
public void finish() throws IOException {
@SuppressWarnings({"unchecked", "rawtypes"})
List<String> outTerms = new ArrayList();
@SuppressWarnings({"unchecked", "rawtypes"})
List<Integer> outFreq = new ArrayList();
@SuppressWarnings({"unchecked", "rawtypes"})
List<Integer> outQueryFreq = new ArrayList();
@SuppressWarnings({"unchecked", "rawtypes"})
List<Double> scores = new ArrayList();
@SuppressWarnings({"unchecked", "rawtypes"})
NamedList<Integer> allFreq = new NamedList();
@SuppressWarnings({"unchecked", "rawtypes"})
NamedList<Integer> allQueryFreq = new NamedList();
LinkedHashMap<String, Object> response = new LinkedHashMap<>();

View File

@ -64,7 +64,7 @@ public interface SolrCache<K,V> extends SolrInfoBean {
* regenerate an item in the new cache from an entry in the old cache.
*
*/
public Object init(Map args, Object persistence, CacheRegenerator regenerator);
public Object init(@SuppressWarnings({"rawtypes"})Map args, Object persistence, CacheRegenerator regenerator);
// I don't think we need a factory for faster creation given that these
// will be associated with slow-to-create SolrIndexSearchers.
// change to NamedList when other plugins do?

View File

@ -84,6 +84,7 @@ public class SolrConstantScoreQuery extends Query implements ExtendedQuery {
}
protected class ConstantWeight extends ConstantScoreWeight {
@SuppressWarnings({"rawtypes"})
private Map context;
private ScoreMode scoreMode;

View File

@ -52,6 +52,7 @@ public class SolrCoreParser extends CoreParser implements NamedListInitializedPl
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public void init(NamedList initArgs) {
if (initArgs == null || initArgs.size() == 0) {
return;

View File

@ -108,6 +108,7 @@ public class SolrDocumentFetcher {
private Collection<String> storedHighlightFieldNames; // lazy populated; use getter
@SuppressWarnings({"unchecked"})
SolrDocumentFetcher(SolrIndexSearcher searcher, SolrConfig solrConfig, boolean cachingEnabled) {
this.searcher = searcher;
this.enableLazyFieldLoading = solrConfig.enableLazyFieldLoading;

View File

@ -34,9 +34,11 @@ public abstract class SolrFilter extends Filter {
/** Implementations should propagate createWeight to sub-ValueSources which can store weight info in the context.
* The context object will be passed to getDocIdSet() where this info can be retrieved. */
public abstract void createWeight(Map context, IndexSearcher searcher) throws IOException;
public abstract void createWeight(@SuppressWarnings({"rawtypes"})Map context
, IndexSearcher searcher) throws IOException;
public abstract DocIdSet getDocIdSet(Map context, LeafReaderContext readerContext, Bits acceptDocs) throws IOException;
public abstract DocIdSet getDocIdSet(@SuppressWarnings({"rawtypes"})Map context
, LeafReaderContext readerContext, Bits acceptDocs) throws IOException;
@Override
public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {

View File

@ -97,7 +97,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
// These should *only* be used for debugging or monitoring purposes
public static final AtomicLong numOpens = new AtomicLong();
public static final AtomicLong numCloses = new AtomicLong();
@SuppressWarnings({"rawtypes"})
private static final Map<String,SolrCache> NO_GENERIC_CACHES = Collections.emptyMap();
@SuppressWarnings({"rawtypes"})
private static final SolrCache[] NO_CACHES = new SolrCache[0];
private final SolrCore core;
@ -122,9 +124,11 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
private final SolrCache<String,UnInvertedField> fieldValueCache;
// map of generic caches - not synchronized since it's read-only after the constructor.
@SuppressWarnings({"rawtypes"})
private final Map<String,SolrCache> cacheMap;
// list of all caches associated with this searcher.
@SuppressWarnings({"rawtypes"})
private final SolrCache[] cacheList;
private DirectoryFactory directoryFactory;
@ -229,6 +233,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
this.releaseDirectory = true;
}
@SuppressWarnings({"unchecked", "rawtypes"})
public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, String name, DirectoryReader r,
boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory)
throws IOException {
@ -428,12 +433,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
// register self
infoRegistry.put(STATISTICS_KEY, this);
infoRegistry.put(name, this);
for (SolrCache cache : cacheList) {
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
cache.setState(SolrCache.State.LIVE);
infoRegistry.put(cache.name(), cache);
}
this.solrMetricsContext = core.getSolrMetricsContext().getChildContext(this);
for (SolrCache cache : cacheList) {
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
cache.initializeMetrics(solrMetricsContext, SolrMetricManager.mkName(cache.name(), STATISTICS_KEY));
}
initializeMetrics(solrMetricsContext, STATISTICS_KEY);
@ -451,7 +456,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
if (cachingEnabled) {
final StringBuilder sb = new StringBuilder();
sb.append("Closing ").append(name);
for (SolrCache cache : cacheList) {
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
sb.append("\n\t");
sb.append(cache);
}
@ -478,7 +483,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
core.getDeletionPolicy().releaseCommitPoint(cpg);
}
for (SolrCache cache : cacheList) {
for (@SuppressWarnings({"rawtypes"})SolrCache cache : cacheList) {
try {
cache.close();
} catch (Exception e) {
@ -524,7 +529,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
if (solrConfig.fieldValueCacheConfig != null && solrConfig.fieldValueCacheConfig.getRegenerator() == null) {
solrConfig.fieldValueCacheConfig.setRegenerator(new CacheRegenerator() {
@Override
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
public boolean regenerateItem(SolrIndexSearcher newSearcher,
@SuppressWarnings({"rawtypes"})SolrCache newCache,
@SuppressWarnings({"rawtypes"})SolrCache oldCache,
Object oldKey, Object oldVal) throws IOException {
if (oldVal instanceof UnInvertedField) {
UnInvertedField.getUnInvertedField((String) oldKey, newSearcher);
@ -537,7 +544,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
if (solrConfig.filterCacheConfig != null && solrConfig.filterCacheConfig.getRegenerator() == null) {
solrConfig.filterCacheConfig.setRegenerator(new CacheRegenerator() {
@Override
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
@SuppressWarnings({"rawtypes"})public boolean regenerateItem(SolrIndexSearcher newSearcher
, @SuppressWarnings({"rawtypes"})SolrCache newCache
, @SuppressWarnings({"rawtypes"})SolrCache oldCache,
Object oldKey, Object oldVal) throws IOException {
newSearcher.cacheDocSet((Query) oldKey, null, false);
return true;
@ -549,6 +558,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
final int queryResultWindowSize = solrConfig.queryResultWindowSize;
solrConfig.queryResultCacheConfig.setRegenerator(new CacheRegenerator() {
@Override
@SuppressWarnings({"rawtypes"})
public boolean regenerateItem(SolrIndexSearcher newSearcher, SolrCache newCache, SolrCache oldCache,
Object oldKey, Object oldVal) throws IOException {
QueryResultKey key = (QueryResultKey) oldKey;
@ -1484,6 +1494,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
* @param cmd
* The Command whose properties should determine the type of TopDocsCollector to use.
*/
@SuppressWarnings({"rawtypes"})
private TopDocsCollector buildTopDocsCollector(int len, QueryCommand cmd) throws IOException {
int minNumFound = cmd.getMinExactCount();
Query q = cmd.getQuery();
@ -1679,6 +1690,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
// no docs on this page, so cursor doesn't change
qr.setNextCursorMark(cmd.getCursorMark());
} else {
@SuppressWarnings({"rawtypes"})
final TopDocsCollector topCollector = buildTopDocsCollector(len, cmd);
DocSetCollector setCollector = new DocSetCollector(maxDoc);
MaxScoreCollector maxScoreCollector = null;
@ -1999,6 +2011,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
// bit of a hack to tell if a set is sorted - do it better in the future.
boolean inOrder = set instanceof BitDocSet || set instanceof SortedIntDocSet;
@SuppressWarnings({"rawtypes"})
TopDocsCollector topCollector = buildTopDocsCollector(nDocs, cmd);
DocIterator iter = set.iterator();
@ -2121,6 +2134,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
/**
* Warm this searcher based on an old one (primarily for auto-cache warming).
*/
@SuppressWarnings({"unchecked"})
public void warm(SolrIndexSearcher old) {
// Make sure this is first! filters can help queryResults execute!
long warmingStartTime = System.nanoTime();
@ -2165,6 +2179,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
/**
* return the named generic cache
*/
@SuppressWarnings({"rawtypes"})
public SolrCache getCache(String cacheName) {
return cacheMap.get(cacheName);
}
@ -2172,7 +2187,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
/**
* lookup an entry in a generic cache
*/
@SuppressWarnings({"unchecked"})
public Object cacheLookup(String cacheName, Object key) {
@SuppressWarnings({"rawtypes"})
SolrCache cache = cacheMap.get(cacheName);
return cache == null ? null : cache.get(key);
}
@ -2180,7 +2197,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
/**
* insert an entry in a generic cache
*/
@SuppressWarnings({"unchecked"})
public Object cacheInsert(String cacheName, Object key, Object val) {
@SuppressWarnings({"rawtypes"})
SolrCache cache = cacheMap.get(cacheName);
return cache == null ? null : cache.put(key, val);
}

View File

@ -53,7 +53,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
public static final String NAME = "tlogit";
@Override
public void init(NamedList args) {
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
}
@Override
@ -165,6 +165,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
}
@SuppressWarnings({"unchecked"})
public void finish() throws IOException {
Map<Integer, double[]> docVectors = new HashMap<>();
@ -211,6 +212,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
}
}
@SuppressWarnings({"rawtypes"})
NamedList analytics = new NamedList();
rbsp.rsp.add("logit", analytics);

View File

@ -98,7 +98,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
* Initialize the plugin.
*/
@Override
public void init(NamedList args) {}
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {}
/**
* Parse the user input into a ValueSource.
@ -1186,7 +1186,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
static class DateValueSourceParser extends ValueSourceParser {
@Override
public void init(NamedList args) {
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
}
public Date getDate(FunctionQParser fp, String arg) {
@ -1304,7 +1304,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
, LeafReaderContext readerContext) throws IOException {
return new LongDocValues(this) {
@Override
public float floatVal(int doc) {
@ -1409,7 +1410,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
final FunctionValues vals = source.getValues(context, readerContext);
return new DoubleDocValues(this) {
@Override
@ -1456,7 +1457,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
final FunctionValues aVals = a.getValues(context, readerContext);
final FunctionValues bVals = b.getValues(context, readerContext);
return new DoubleDocValues(this) {
@ -1472,7 +1473,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
}
@Override
@ -1512,7 +1513,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context,
LeafReaderContext readerContext) throws IOException {
return new BoolDocValues(this) {
@Override
public boolean boolVal(int doc) {
@ -1572,7 +1574,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
, LeafReaderContext readerContext) throws IOException {
if (context.get(this) == null) {
SolrRequestInfo requestInfo = SolrRequestInfo.getRequestInfo();
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "testfunc: unweighted value source detected. delegate="+source + " request=" + (requestInfo==null ? "null" : requestInfo.getReq()));
@ -1596,7 +1599,8 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
}
@Override
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
@SuppressWarnings({"unchecked"})
public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
context.put(this, this);
}

View File

@ -66,10 +66,11 @@ import org.apache.solr.schema.IndexSchema;
public class XmlQParserPlugin extends QParserPlugin {
public static final String NAME = "xmlparser";
@SuppressWarnings({"rawtypes"})
private NamedList args;
@Override
public void init( NamedList args ) {
public void init( @SuppressWarnings({"rawtypes"})NamedList args ) {
super.init(args);
this.args = args;
}

View File

@ -59,6 +59,7 @@ public class CommandHandler {
public static class Builder {
private QueryCommand queryCommand;
@SuppressWarnings({"rawtypes"})
private List<Command> commands = new ArrayList<>();
private SolrIndexSearcher searcher;
private boolean needDocSet = false;
@ -71,7 +72,7 @@ public class CommandHandler {
return this;
}
public Builder addCommandField(Command commandField) {
public Builder addCommandField(@SuppressWarnings({"rawtypes"})Command commandField) {
commands.add(commandField);
return this;
}
@ -116,6 +117,7 @@ public class CommandHandler {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final QueryCommand queryCommand;
@SuppressWarnings({"rawtypes"})
private final List<Command> commands;
private final SolrIndexSearcher searcher;
private final boolean needDocset;
@ -127,7 +129,7 @@ public class CommandHandler {
private DocSet docSet;
private CommandHandler(QueryCommand queryCommand,
List<Command> commands,
@SuppressWarnings({"rawtypes"})List<Command> commands,
SolrIndexSearcher searcher,
boolean needDocset,
boolean truncateGroups,
@ -144,7 +146,7 @@ public class CommandHandler {
public void execute() throws IOException {
final int nrOfCommands = commands.size();
List<Collector> collectors = new ArrayList<>(nrOfCommands);
for (Command command : commands) {
for (@SuppressWarnings({"rawtypes"})Command command : commands) {
collectors.addAll(command.create());
}
@ -162,17 +164,19 @@ public class CommandHandler {
searchWithTimeLimiter(query, filter, null);
}
for (Command command : commands) {
for (@SuppressWarnings({"rawtypes"})Command command : commands) {
command.postCollect(searcher);
}
}
private DocSet computeGroupedDocSet(Query query, ProcessedFilter filter, List<Collector> collectors) throws IOException {
@SuppressWarnings({"rawtypes"})
Command firstCommand = commands.get(0);
String field = firstCommand.getKey();
SchemaField sf = searcher.getSchema().getField(field);
FieldType fieldType = sf.getType();
@SuppressWarnings({"rawtypes"})
final AllGroupHeadsCollector allGroupHeadsCollector;
if (fieldType.getNumberType() != null) {
ValueSource vs = fieldType.getValueSource(sf, null);
@ -201,7 +205,7 @@ public class CommandHandler {
return DocSetUtil.getDocSet( docSetCollector, searcher );
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
public NamedList processResult(QueryResult queryResult, ShardResultTransformer transformer) throws IOException {
if (docSet != null) {
queryResult.setDocSet(docSet);

View File

@ -133,16 +133,16 @@ class GroupConverter {
return result;
}
@SuppressWarnings({"unchecked", "rawtypes"})
static TopGroups<BytesRef> fromMutable(SchemaField field, TopGroups<MutableValue> values) {
if (values == null) {
return null;
}
FieldType fieldType = field.getType();
@SuppressWarnings("unchecked")
GroupDocs<BytesRef> groupDocs[] = new GroupDocs[values.groups.length];
for (int i = 0; i < values.groups.length; i++) {
GroupDocs<MutableValue> original = values.groups[i];
final BytesRef groupValue;

View File

@ -138,6 +138,7 @@ public class QueryCommand implements Command<QueryCommandResult> {
private final String queryString;
private final Query mainQuery;
@SuppressWarnings({"rawtypes"})
private TopDocsCollector topDocsCollector;
private FilterCollector filterCollector;
private MaxScoreCollector maxScoreCollector;

View File

@ -83,7 +83,9 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
private final int topNGroups;
private final boolean includeGroupCount;
@SuppressWarnings({"rawtypes"})
private FirstPassGroupingCollector firstPassGroupingCollector;
@SuppressWarnings({"rawtypes"})
private AllGroupsCollector allGroupsCollector;
private SearchGroupsFieldCommand(SchemaField field, Sort groupSort, int topNGroups, boolean includeGroupCount) {
@ -121,6 +123,7 @@ public class SearchGroupsFieldCommand implements Command<SearchGroupsFieldComman
}
@Override
@SuppressWarnings({"unchecked"})
public SearchGroupsFieldCommandResult result() throws IOException {
final Collection<SearchGroup<BytesRef>> topGroups;
if (firstPassGroupingCollector != null) {

View File

@ -116,6 +116,7 @@ public class TopGroupsFieldCommand implements Command<TopGroups<BytesRef>> {
private final int maxDocPerGroup;
private final boolean needScores;
private final boolean needMaxScore;
@SuppressWarnings({"rawtypes"})
private TopGroupsCollector secondPassCollector;
private TopGroups<BytesRef> topGroups;
@ -161,6 +162,7 @@ public class TopGroupsFieldCommand implements Command<TopGroups<BytesRef>> {
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public void postCollect(IndexSearcher searcher) throws IOException {
if (firstPhaseGroups.isEmpty()) {
topGroups = new TopGroups<>(groupSort.getSort(), withinGroupSort.getSort(), 0, 0, new GroupDocs[0], Float.NaN);

View File

@ -48,6 +48,7 @@ import org.apache.solr.search.grouping.distributed.shardresultserializer.SearchG
public class SearchGroupShardResponseProcessor implements ShardResponseProcessor {
@Override
@SuppressWarnings({"unchecked"})
public void process(ResponseBuilder rb, ShardRequest shardRequest) {
SortSpec groupSortSpec = rb.getGroupingSpec().getGroupSortSpec();
Sort groupSort = rb.getGroupingSpec().getGroupSortSpec().getSort();
@ -104,7 +105,7 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor
continue; // continue if there was an error and we're tolerant.
}
maxElapsedTime = (int) Math.max(maxElapsedTime, srsp.getSolrResponse().getElapsedTime());
@SuppressWarnings("unchecked")
@SuppressWarnings({"rawtypes"})
NamedList<NamedList> firstPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("firstPhase");
final Map<String, SearchGroupsFieldCommandResult> result = serializer.transformToNative(firstPhaseResult, groupSort, withinGroupSort, srsp.getShard());
for (Map.Entry<String, List<Collection<SearchGroup<BytesRef>>>> entry : commandSearchGroups.entrySet()) {

View File

@ -119,6 +119,7 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
rb.rsp.getResponseHeader().asShallowMap().put(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY, Boolean.TRUE);
continue; // continue if there was an error and we're tolerant.
}
@SuppressWarnings({"rawtypes"})
NamedList<NamedList> secondPhaseResult = (NamedList<NamedList>) srsp.getSolrResponse().getResponse().get("secondPhase");
if(secondPhaseResult == null)
continue;
@ -156,11 +157,12 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
continue;
}
@SuppressWarnings({"rawtypes"})
TopGroups<BytesRef>[] topGroupsArr = new TopGroups[topGroups.size()];
int docsPerGroup = docsPerGroupDefault;
if (docsPerGroup < 0) {
docsPerGroup = 0;
for (TopGroups subTopGroups : topGroups) {
for (@SuppressWarnings({"rawtypes"})TopGroups subTopGroups : topGroups) {
docsPerGroup += subTopGroups.totalGroupedHitCount;
}
}

View File

@ -35,6 +35,7 @@ import java.util.*;
/**
* Implementation for transforming {@link SearchGroup} into a {@link NamedList} structure and visa versa.
*/
@SuppressWarnings({"rawtypes"})
public class SearchGroupsResultTransformer implements ShardResultTransformer<List<Command>, Map<String, SearchGroupsFieldCommandResult>> {
private static final String TOP_GROUPS = "topGroups";
@ -47,6 +48,7 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
}
@Override
@SuppressWarnings({"rawtypes"})
public NamedList transform(List<Command> data) throws IOException {
final NamedList<NamedList> result = new NamedList<>(data.size());
for (Command command : data) {
@ -71,6 +73,7 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
return result;
}
@SuppressWarnings({"rawtypes"})
private SearchGroup<BytesRef> deserializeOneSearchGroup(SchemaField groupField, String groupValue,
SortField[] groupSortField, List<Comparable> rawSearchGroupData) {
SearchGroup<BytesRef> searchGroup = new SearchGroup<>();
@ -93,12 +96,13 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
}
@Override
@SuppressWarnings({"rawtypes"})
public Map<String, SearchGroupsFieldCommandResult> transformToNative(NamedList<NamedList> shardResponse, Sort groupSort, Sort withinGroupSort, String shard) {
final Map<String, SearchGroupsFieldCommandResult> result = new HashMap<>(shardResponse.size());
for (Map.Entry<String, NamedList> command : shardResponse) {
List<SearchGroup<BytesRef>> searchGroups = new ArrayList<>();
NamedList topGroupsAndGroupCount = command.getValue();
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked"})
final NamedList<List<Comparable>> rawSearchGroups = (NamedList<List<Comparable>>) topGroupsAndGroupCount.get(TOP_GROUPS);
if (rawSearchGroups != null) {
final SchemaField groupField = searcher.getSchema().getFieldOrNull(command.getKey());
@ -128,6 +132,7 @@ public class SearchGroupsResultTransformer implements ShardResultTransformer<Lis
return convertedSortValues;
}
@SuppressWarnings({"rawtypes"})
private NamedList serializeSearchGroup(Collection<SearchGroup<BytesRef>> data, SearchGroupsFieldCommand command) {
final NamedList<Object[]> result = new NamedList<>(data.size());

View File

@ -37,6 +37,7 @@ public interface ShardResultTransformer<T, R> {
* @return {@link NamedList} structure
* @throws IOException If I/O related errors occur during transforming
*/
@SuppressWarnings({"rawtypes"})
NamedList transform(T data) throws IOException;
/**
@ -48,6 +49,7 @@ public interface ShardResultTransformer<T, R> {
* @param shard The shard address where the response originated from
* @return native structure of the data
*/
@SuppressWarnings({"rawtypes"})
R transformToNative(NamedList<NamedList> shardResponse, Sort groupSort, Sort withinGroupSort, String shard);
}

View File

@ -54,6 +54,7 @@ import static org.apache.solr.common.params.CommonParams.ID;
* Implementation for transforming {@link TopGroups} and {@link TopDocs} into a {@link NamedList} structure and
* vice versa.
*/
@SuppressWarnings({"rawtypes"})
public class TopGroupsResultTransformer implements ShardResultTransformer<List<Command>, Map<String, ?>> {
private final ResponseBuilder rb;
@ -138,7 +139,7 @@ public class TopGroupsResultTransformer implements ShardResultTransformer<List<C
groupDocs.add(new GroupDocs<>(Float.NaN, maxScore, new TotalHits(totalGroupHits.longValue(), TotalHits.Relation.EQUAL_TO), scoreDocs, groupValueRef, null));
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked"})
GroupDocs<BytesRef>[] groupDocsArr = groupDocs.toArray(new GroupDocs[groupDocs.size()]);
TopGroups<BytesRef> topGroups = new TopGroups<>(
groupSort.getSort(), withinGroupSort.getSort(), totalHitCount, totalGroupedHitCount, groupDocsArr, Float.NaN

View File

@ -68,6 +68,7 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
command.add("ngroups", totalGroupCount);
}
@SuppressWarnings({"rawtypes"})
List<NamedList> groups = new ArrayList<>();
SchemaField groupField = searcher.getSchema().getField(entry.getKey());
FieldType groupFieldType = groupField.getType();

View File

@ -45,11 +45,11 @@ public class XCJFQParserPlugin extends QParserPlugin {
}
@Override
public void init(NamedList args) {
@SuppressWarnings({"unchecked"})
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
routerField = (String) args.get("routerField");
solrUrlWhitelist = new HashSet<>();
if (args.get("solrUrl") != null) {
//noinspection unchecked
for (String s : (List<String>) args.get("solrUrl")) {
if (!StringUtils.isEmpty(s))
solrUrlWhitelist.add(s);

View File

@ -91,6 +91,7 @@ public class CloudMLTQParser extends QParser {
String[] fieldNames;
if (qf != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
ArrayList<String> fields = new ArrayList();
for (String fieldName : qf) {
if (!StringUtils.isEmpty(fieldName)) {
@ -106,6 +107,7 @@ public class CloudMLTQParser extends QParser {
boostFields = SolrPluginUtils.parseFieldBoosts(fields.toArray(new String[0]));
fieldNames = boostFields.keySet().toArray(new String[0]);
} else {
@SuppressWarnings({"unchecked", "rawtypes"})
ArrayList<String> fields = new ArrayList();
for (String field : doc.getFieldNames()) {
// Only use fields that are stored and have an explicit analyzer.
@ -128,6 +130,7 @@ public class CloudMLTQParser extends QParser {
for (String field : fieldNames) {
Collection<Object> fieldValues = doc.getFieldValues(field);
if (fieldValues != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
Collection<Object> values = new ArrayList();
for (Object val : fieldValues) {
if (val instanceof IndexableField) {
@ -187,6 +190,7 @@ public class CloudMLTQParser extends QParser {
};
core.getRequestHandler("/get").handleRequest(request, rsp);
@SuppressWarnings({"rawtypes"})
NamedList response = rsp.getValues();
return (SolrDocument) response.get("doc");

View File

@ -99,6 +99,7 @@ public class SimpleMLTQParser extends QParser {
fieldNames = boostFields.keySet().toArray(new String[0]);
} else {
Map<String, SchemaField> fieldDefinitions = req.getSearcher().getSchema().getFields();
@SuppressWarnings({"unchecked", "rawtypes"})
ArrayList<String> fields = new ArrayList();
for (Map.Entry<String, SchemaField> entry : fieldDefinitions.entrySet()) {
if (entry.getValue().indexed() && entry.getValue().stored())

View File

@ -70,7 +70,9 @@ public class ExactStatsCache extends StatsCache {
@Override
protected StatsSource doGet(SolrQueryRequest req) {
@SuppressWarnings({"unchecked"})
Map<String,CollectionStats> currentGlobalColStats = (Map<String,CollectionStats>) req.getContext().getOrDefault(CURRENT_GLOBAL_COL_STATS, Collections.emptyMap());
@SuppressWarnings({"unchecked"})
Map<String,TermStats> currentGlobalTermStats = (Map<String,TermStats>) req.getContext().getOrDefault(CURRENT_GLOBAL_TERM_STATS, Collections.emptyMap());
if (log.isDebugEnabled()) {
log.debug("Returning StatsSource. Collection stats={}, Term stats size= {}", currentGlobalColStats, currentGlobalTermStats.size());
@ -127,12 +129,15 @@ public class ExactStatsCache extends StatsCache {
}
protected void addToPerShardColStats(SolrQueryRequest req, String shard, Map<String,CollectionStats> colStats) {
@SuppressWarnings({"unchecked"})
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) req.getContext().computeIfAbsent(PER_SHARD_COL_STATS, Utils.NEW_HASHMAP_FUN);
perShardColStats.put(shard, colStats);
}
protected void printStats(SolrQueryRequest req) {
@SuppressWarnings({"unchecked"})
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().getOrDefault(PER_SHARD_TERM_STATS, Collections.emptyMap());
@SuppressWarnings({"unchecked"})
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) req.getContext().getOrDefault(PER_SHARD_COL_STATS, Collections.emptyMap());
log.debug("perShardColStats={}, perShardTermStats={}", perShardColStats, perShardTermStats);
}
@ -140,6 +145,7 @@ public class ExactStatsCache extends StatsCache {
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) {
Map<String,TermStats> termStats = StatsUtil.termStatsMapFromString(termStatsString);
if (termStats != null) {
@SuppressWarnings({"unchecked"})
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().computeIfAbsent(PER_SHARD_TERM_STATS, Utils.NEW_HASHMAP_FUN);
perShardTermStats.put(shard, termStats);
}
@ -275,11 +281,13 @@ public class ExactStatsCache extends StatsCache {
}
protected Map<String,CollectionStats> getPerShardColStats(ResponseBuilder rb, String shard) {
@SuppressWarnings({"unchecked"})
Map<String,Map<String,CollectionStats>> perShardColStats = (Map<String,Map<String,CollectionStats>>) rb.req.getContext().getOrDefault(PER_SHARD_COL_STATS, Collections.emptyMap());
return perShardColStats.get(shard);
}
protected TermStats getPerShardTermStats(SolrQueryRequest req, String t, String shard) {
@SuppressWarnings({"unchecked"})
Map<String,Map<String,TermStats>> perShardTermStats = (Map<String,Map<String,TermStats>>) req.getContext().getOrDefault(PER_SHARD_TERM_STATS, Collections.emptyMap());
Map<String,TermStats> cache = perShardTermStats.get(shard);
return (cache != null) ? cache.get(t) : null; //Term doesn't exist in shard
@ -309,11 +317,13 @@ public class ExactStatsCache extends StatsCache {
protected void addToGlobalColStats(SolrQueryRequest req,
Entry<String,CollectionStats> e) {
@SuppressWarnings({"unchecked"})
Map<String,CollectionStats> currentGlobalColStats = (Map<String,CollectionStats>) req.getContext().computeIfAbsent(CURRENT_GLOBAL_COL_STATS, Utils.NEW_HASHMAP_FUN);
currentGlobalColStats.put(e.getKey(), e.getValue());
}
protected void addToGlobalTermStats(SolrQueryRequest req, Entry<String,TermStats> e) {
@SuppressWarnings({"unchecked"})
Map<String,TermStats> currentGlobalTermStats = (Map<String,TermStats>) req.getContext().computeIfAbsent(CURRENT_GLOBAL_TERM_STATS, Utils.NEW_HASHMAP_FUN);
currentGlobalTermStats.put(e.getKey(), e.getValue());
}

View File

@ -185,7 +185,9 @@ public class LRUStatsCache extends ExactStatsCache {
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) {
Map<String,TermStats> termStats = StatsUtil.termStatsMapFromString(termStatsString);
if (termStats != null) {
@SuppressWarnings({"unchecked"})
SolrCache<String,TermStats> cache = perShardTermStats.computeIfAbsent(shard, s -> {
@SuppressWarnings({"rawtypes"})
CaffeineCache c = new CaffeineCache<>();
Map<String, String> map = new HashMap<>(lruCacheInitArgs);
map.put(CommonParams.NAME, s);