mirror of https://github.com/apache/lucene.git
SOLR-14545: Fix or suppress warnings in apache/solr/update
This commit is contained in:
parent
8663a425a8
commit
4dcdd750f2
|
@ -312,6 +312,8 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-14543: Fix or suppress warnings in apache/solr/search (Erick Erickson)
|
* SOLR-14543: Fix or suppress warnings in apache/solr/search (Erick Erickson)
|
||||||
|
|
||||||
|
* SOLR-14545: Fix or suppress warnings in apache/solr/update (Erick Erickson)
|
||||||
|
|
||||||
================== 8.5.2 ==================
|
================== 8.5.2 ==================
|
||||||
|
|
||||||
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.
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class OpenNLPLangDetectUpdateProcessorFactory extends UpdateRequestProces
|
||||||
private SolrResourceLoader solrResourceLoader;
|
private SolrResourceLoader solrResourceLoader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init( NamedList args )
|
public void init( @SuppressWarnings({"rawtypes"})NamedList args )
|
||||||
{
|
{
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
Object o;
|
Object o;
|
||||||
|
|
|
@ -255,6 +255,7 @@ public class AddUpdateCommand extends UpdateCommand {
|
||||||
flattenLabelled(unwrappedDocs, ((SolrInputDocument) val));
|
flattenLabelled(unwrappedDocs, ((SolrInputDocument) val));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<SolrInputDocument> childrenList = ((Collection) val);
|
Collection<SolrInputDocument> childrenList = ((Collection) val);
|
||||||
for (SolrInputDocument child : childrenList) {
|
for (SolrInputDocument child : childrenList) {
|
||||||
flattenLabelled(unwrappedDocs, child);
|
flattenLabelled(unwrappedDocs, child);
|
||||||
|
|
|
@ -202,6 +202,7 @@ public class CdcrUpdateLog extends UpdateLog {
|
||||||
* Creates a new {@link org.apache.solr.update.CdcrUpdateLog.CdcrLogReader}
|
* Creates a new {@link org.apache.solr.update.CdcrUpdateLog.CdcrLogReader}
|
||||||
* initialised with the current list of tlogs.
|
* initialised with the current list of tlogs.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public CdcrLogReader newLogReader() {
|
public CdcrLogReader newLogReader() {
|
||||||
return new CdcrLogReader(new ArrayList(logs), tlog);
|
return new CdcrLogReader(new ArrayList(logs), tlog);
|
||||||
}
|
}
|
||||||
|
@ -362,6 +363,7 @@ public class CdcrUpdateLog extends UpdateLog {
|
||||||
// populate recent deleteByQuery commands
|
// populate recent deleteByQuery commands
|
||||||
for (int i=startingUpdates.deleteByQueryList.size()-1; i>=0; i--) {
|
for (int i=startingUpdates.deleteByQueryList.size()-1; i>=0; i--) {
|
||||||
Update update = startingUpdates.deleteByQueryList.get(i);
|
Update update = startingUpdates.deleteByQueryList.get(i);
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> dbq = (List<Object>) update.log.lookup(update.pointer);
|
List<Object> dbq = (List<Object>) update.log.lookup(update.pointer);
|
||||||
long version = (Long) dbq.get(1);
|
long version = (Long) dbq.get(1);
|
||||||
String q = (String) dbq.get(2);
|
String q = (String) dbq.get(2);
|
||||||
|
@ -402,6 +404,7 @@ public class CdcrUpdateLog extends UpdateLog {
|
||||||
Object o = tlogReader.next();
|
Object o = tlogReader.next();
|
||||||
if (o == null) break; // we reached the end of the tlog
|
if (o == null) break; // we reached the end of the tlog
|
||||||
// should currently be a List<Oper,Ver,Doc/Id>
|
// should currently be a List<Oper,Ver,Doc/Id>
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List) o;
|
List entry = (List) o;
|
||||||
operationAndFlags = (Integer) entry.get(0);
|
operationAndFlags = (Integer) entry.get(0);
|
||||||
int oper = operationAndFlags & OPERATION_MASK;
|
int oper = operationAndFlags & OPERATION_MASK;
|
||||||
|
@ -729,6 +732,7 @@ public class CdcrUpdateLog extends UpdateLog {
|
||||||
* Extracts the version number and converts it to its absolute form.
|
* Extracts the version number and converts it to its absolute form.
|
||||||
*/
|
*/
|
||||||
private long getVersion(Object o) {
|
private long getVersion(Object o) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List) o;
|
List entry = (List) o;
|
||||||
// version is negative for delete, ensure that we are manipulating absolute version numbers
|
// version is negative for delete, ensure that we are manipulating absolute version numbers
|
||||||
return Math.abs((Long) entry.get(1));
|
return Math.abs((Long) entry.get(1));
|
||||||
|
|
|
@ -63,6 +63,7 @@ public final class CommitTracker implements Runnable {
|
||||||
// Not a big deal but it means we must take care of MDC logging here.
|
// Not a big deal but it means we must take care of MDC logging here.
|
||||||
private final ScheduledExecutorService scheduler =
|
private final ScheduledExecutorService scheduler =
|
||||||
Executors.newScheduledThreadPool(1, new SolrNamedThreadFactory("commitScheduler"));
|
Executors.newScheduledThreadPool(1, new SolrNamedThreadFactory("commitScheduler"));
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private ScheduledFuture pending;
|
private ScheduledFuture pending;
|
||||||
|
|
||||||
// state
|
// state
|
||||||
|
|
|
@ -84,6 +84,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
|
||||||
|
|
||||||
private volatile Future<Boolean> cdcrBootstrapFuture;
|
private volatile Future<Boolean> cdcrBootstrapFuture;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private volatile Callable cdcrBootstrapCallable;
|
private volatile Callable cdcrBootstrapCallable;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -448,12 +449,13 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public Callable getCdcrBootstrapCallable() {
|
public Callable getCdcrBootstrapCallable() {
|
||||||
return cdcrBootstrapCallable;
|
return cdcrBootstrapCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCdcrBootstrapCallable(Callable cdcrBootstrapCallable) {
|
public void setCdcrBootstrapCallable(@SuppressWarnings({"rawtypes"})Callable cdcrBootstrapCallable) {
|
||||||
this.cdcrBootstrapCallable = cdcrBootstrapCallable;
|
this.cdcrBootstrapCallable = cdcrBootstrapCallable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,6 +623,7 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
|
||||||
if (cmd.expungeDeletes) expungeDeleteCommands.mark();
|
if (cmd.expungeDeletes) expungeDeleteCommands.mark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Future[] waitSearcher = null;
|
Future[] waitSearcher = null;
|
||||||
if (cmd.waitSearcher) {
|
if (cmd.waitSearcher) {
|
||||||
waitSearcher = new Future[1];
|
waitSearcher = new Future[1];
|
||||||
|
|
|
@ -159,6 +159,7 @@ public class DocumentBuilder {
|
||||||
// load each field value
|
// load each field value
|
||||||
boolean hasField = false;
|
boolean hasField = false;
|
||||||
try {
|
try {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Iterator it = field.iterator();
|
Iterator it = field.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Object v = it.next();
|
Object v = it.next();
|
||||||
|
|
|
@ -164,6 +164,7 @@ public class HdfsTransactionLog extends TransactionLog {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private void readHeader(FastInputStream fis) throws IOException {
|
private void readHeader(FastInputStream fis) throws IOException {
|
||||||
// read existing header
|
// read existing header
|
||||||
boolean closeFis = false;
|
boolean closeFis = false;
|
||||||
|
@ -488,6 +489,7 @@ public class HdfsTransactionLog extends TransactionLog {
|
||||||
|
|
||||||
long lastVersion = Long.MIN_VALUE;
|
long lastVersion = Long.MIN_VALUE;
|
||||||
while ( (o = super.next()) != null) {
|
while ( (o = super.next()) != null) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List) o;
|
List entry = (List) o;
|
||||||
long version = (Long) entry.get(UpdateLog.VERSION_IDX);
|
long version = (Long) entry.get(UpdateLog.VERSION_IDX);
|
||||||
version = Math.abs(version);
|
version = Math.abs(version);
|
||||||
|
|
|
@ -231,6 +231,7 @@ public class HdfsUpdateLog extends UpdateLog {
|
||||||
// populate recent deleteByQuery commands
|
// populate recent deleteByQuery commands
|
||||||
for (int i = startingUpdates.deleteByQueryList.size() - 1; i >= 0; i--) {
|
for (int i = startingUpdates.deleteByQueryList.size() - 1; i >= 0; i--) {
|
||||||
Update update = startingUpdates.deleteByQueryList.get(i);
|
Update update = startingUpdates.deleteByQueryList.get(i);
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> dbq = (List<Object>) update.log.lookup(update.pointer);
|
List<Object> dbq = (List<Object>) update.log.lookup(update.pointer);
|
||||||
long version = (Long) dbq.get(1);
|
long version = (Long) dbq.get(1);
|
||||||
String q = (String) dbq.get(2);
|
String q = (String) dbq.get(2);
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class IndexFingerprint implements MapSerializable {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SchemaField versionField = VersionInfo.getAndCheckVersionField(searcher.getSchema());
|
SchemaField versionField = VersionInfo.getAndCheckVersionField(searcher.getSchema());
|
||||||
ValueSource vs = versionField.getType().getValueSource(versionField, null);
|
ValueSource vs = versionField.getType().getValueSource(versionField, null);
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map funcContext = ValueSource.newContext(searcher);
|
Map funcContext = ValueSource.newContext(searcher);
|
||||||
vs.createWeight(funcContext, searcher);
|
vs.createWeight(funcContext, searcher);
|
||||||
|
|
||||||
|
@ -184,7 +185,7 @@ public class IndexFingerprint implements MapSerializable {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long getLong(Map m, String key, long def) {
|
private static long getLong(@SuppressWarnings({"rawtypes"})Map m, String key, long def) {
|
||||||
Object oval = m.get(key);
|
Object oval = m.get(key);
|
||||||
return oval != null ? ((Number)oval).longValue() : def;
|
return oval != null ? ((Number)oval).longValue() : def;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +195,7 @@ public class IndexFingerprint implements MapSerializable {
|
||||||
*/
|
*/
|
||||||
public static IndexFingerprint fromObject(Object o) {
|
public static IndexFingerprint fromObject(Object o) {
|
||||||
if (o instanceof IndexFingerprint) return (IndexFingerprint) o;
|
if (o instanceof IndexFingerprint) return (IndexFingerprint) o;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map map = null;
|
Map map = null;
|
||||||
if (o instanceof Map) {
|
if (o instanceof Map) {
|
||||||
map = (Map) o;
|
map = (Map) o;
|
||||||
|
|
|
@ -216,6 +216,7 @@ public class PeerSync implements SolrMetricProducer {
|
||||||
ShardResponse srsp = shardHandler.takeCompletedOrError();
|
ShardResponse srsp = shardHandler.takeCompletedOrError();
|
||||||
if (srsp == null) break;
|
if (srsp == null) break;
|
||||||
if (srsp.getException() == null) {
|
if (srsp.getException() == null) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Long> otherVersions = (List<Long>)srsp.getSolrResponse().getResponse().get("versions");
|
List<Long> otherVersions = (List<Long>)srsp.getSolrResponse().getResponse().get("versions");
|
||||||
if (otherVersions != null && !otherVersions.isEmpty()) {
|
if (otherVersions != null && !otherVersions.isEmpty()) {
|
||||||
syncErrors.inc();
|
syncErrors.inc();
|
||||||
|
@ -432,6 +433,7 @@ public class PeerSync implements SolrMetricProducer {
|
||||||
|
|
||||||
private boolean handleVersions(ShardResponse srsp) {
|
private boolean handleVersions(ShardResponse srsp) {
|
||||||
// we retrieved the last N updates from the replica
|
// we retrieved the last N updates from the replica
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Long> otherVersions = (List<Long>)srsp.getSolrResponse().getResponse().get("versions");
|
List<Long> otherVersions = (List<Long>)srsp.getSolrResponse().getResponse().get("versions");
|
||||||
// TODO: how to handle short lists?
|
// TODO: how to handle short lists?
|
||||||
|
|
||||||
|
@ -516,6 +518,7 @@ public class PeerSync implements SolrMetricProducer {
|
||||||
|
|
||||||
private boolean handleUpdates(ShardResponse srsp) {
|
private boolean handleUpdates(ShardResponse srsp) {
|
||||||
// we retrieved the last N updates from the replica
|
// we retrieved the last N updates from the replica
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> updates = (List<Object>)srsp.getSolrResponse().getResponse().get("updates");
|
List<Object> updates = (List<Object>)srsp.getSolrResponse().getResponse().get("updates");
|
||||||
|
|
||||||
SyncShardRequest sreq = (SyncShardRequest) srsp.getShardRequest();
|
SyncShardRequest sreq = (SyncShardRequest) srsp.getShardRequest();
|
||||||
|
@ -580,7 +583,9 @@ public class PeerSync implements SolrMetricProducer {
|
||||||
if (!(o1 instanceof List)) return 1;
|
if (!(o1 instanceof List)) return 1;
|
||||||
if (!(o2 instanceof List)) return -1;
|
if (!(o2 instanceof List)) return -1;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List lst1 = (List) o1;
|
List lst1 = (List) o1;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List lst2 = (List) o2;
|
List lst2 = (List) o2;
|
||||||
|
|
||||||
long l1 = Math.abs((Long) lst1.get(1));
|
long l1 = Math.abs((Long) lst1.get(1));
|
||||||
|
@ -616,6 +621,7 @@ public class PeerSync implements SolrMetricProducer {
|
||||||
for (Object obj : updates) {
|
for (Object obj : updates) {
|
||||||
// should currently be a List<Oper,Ver,Doc/Id>
|
// should currently be a List<Oper,Ver,Doc/Id>
|
||||||
o = obj;
|
o = obj;
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> entry = (List<Object>)o;
|
List<Object> entry = (List<Object>)o;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
|
|
@ -228,6 +228,7 @@ public class PeerSyncWithLeader implements SolrMetricProducer {
|
||||||
|
|
||||||
private MissedUpdatesRequest buildMissedUpdatesRequest(NamedList<Object> rsp) {
|
private MissedUpdatesRequest buildMissedUpdatesRequest(NamedList<Object> rsp) {
|
||||||
// we retrieved the last N updates from the replica
|
// we retrieved the last N updates from the replica
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Long> otherVersions = (List<Long>)rsp.get("versions");
|
List<Long> otherVersions = (List<Long>)rsp.get("versions");
|
||||||
if (log.isInfoEnabled()) {
|
if (log.isInfoEnabled()) {
|
||||||
log.info("{} Received {} versions from {}", msg(), otherVersions.size(), leaderUrl);
|
log.info("{} Received {} versions from {}", msg(), otherVersions.size(), leaderUrl);
|
||||||
|
@ -264,6 +265,7 @@ public class PeerSyncWithLeader implements SolrMetricProducer {
|
||||||
|
|
||||||
private boolean handleUpdates(NamedList<Object> rsp, long numRequestedUpdates, IndexFingerprint leaderFingerprint) {
|
private boolean handleUpdates(NamedList<Object> rsp, long numRequestedUpdates, IndexFingerprint leaderFingerprint) {
|
||||||
// missed updates from leader, it does not contains updates from bufferedUpdates
|
// missed updates from leader, it does not contains updates from bufferedUpdates
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> updates = (List<Object>)rsp.get("updates");
|
List<Object> updates = (List<Object>)rsp.get("updates");
|
||||||
|
|
||||||
if (updates.size() < numRequestedUpdates) {
|
if (updates.size() < numRequestedUpdates) {
|
||||||
|
@ -285,6 +287,7 @@ public class PeerSyncWithLeader implements SolrMetricProducer {
|
||||||
// TODO leader should do fingerprint and retrieve recent updates version in atomic
|
// TODO leader should do fingerprint and retrieve recent updates version in atomic
|
||||||
if (leaderFingerprint != null) {
|
if (leaderFingerprint != null) {
|
||||||
boolean existDBIOrDBQInTheGap = updates.stream().anyMatch(e -> {
|
boolean existDBIOrDBQInTheGap = updates.stream().anyMatch(e -> {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> u = (List<Object>) e;
|
List<Object> u = (List<Object>) e;
|
||||||
long version = (Long) u.get(1);
|
long version = (Long) u.get(1);
|
||||||
int oper = (Integer)u.get(0) & UpdateLog.OPERATION_MASK;
|
int oper = (Integer)u.get(0) & UpdateLog.OPERATION_MASK;
|
||||||
|
@ -294,6 +297,7 @@ public class PeerSyncWithLeader implements SolrMetricProducer {
|
||||||
if (!existDBIOrDBQInTheGap) {
|
if (!existDBIOrDBQInTheGap) {
|
||||||
// it is safe to use leaderFingerprint.maxVersionEncountered as cut point now.
|
// it is safe to use leaderFingerprint.maxVersionEncountered as cut point now.
|
||||||
updates.removeIf(e -> {
|
updates.removeIf(e -> {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> u = (List<Object>) e;
|
List<Object> u = (List<Object>) e;
|
||||||
long version = (Long) u.get(1);
|
long version = (Long) u.get(1);
|
||||||
return version > leaderFingerprint.getMaxVersionEncountered();
|
return version > leaderFingerprint.getMaxVersionEncountered();
|
||||||
|
|
|
@ -428,6 +428,7 @@ public class SolrCmdDistributor implements Closeable {
|
||||||
NamedList<Object> nl = brp.processResponse(inputStream, null);
|
NamedList<Object> nl = brp.processResponse(inputStream, null);
|
||||||
Object hdr = nl.get("responseHeader");
|
Object hdr = nl.get("responseHeader");
|
||||||
if (hdr != null && hdr instanceof NamedList) {
|
if (hdr != null && hdr instanceof NamedList) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
NamedList<Object> hdrList = (NamedList<Object>) hdr;
|
NamedList<Object> hdrList = (NamedList<Object>) hdr;
|
||||||
Object rfObj = hdrList.get(UpdateRequest.REPFACT);
|
Object rfObj = hdrList.get(UpdateRequest.REPFACT);
|
||||||
if (rfObj != null && rfObj instanceof Integer) {
|
if (rfObj != null && rfObj instanceof Integer) {
|
||||||
|
|
|
@ -247,6 +247,7 @@ public class SolrIndexConfig implements MapSerializable {
|
||||||
|
|
||||||
if (mergedSegmentWarmerInfo != null) {
|
if (mergedSegmentWarmerInfo != null) {
|
||||||
// TODO: add infostream -> normal logging system (there is an issue somewhere)
|
// TODO: add infostream -> normal logging system (there is an issue somewhere)
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
IndexReaderWarmer warmer = core.getResourceLoader().newInstance(mergedSegmentWarmerInfo.className,
|
IndexReaderWarmer warmer = core.getResourceLoader().newInstance(mergedSegmentWarmerInfo.className,
|
||||||
IndexReaderWarmer.class,
|
IndexReaderWarmer.class,
|
||||||
null,
|
null,
|
||||||
|
@ -262,7 +263,7 @@ public class SolrIndexConfig implements MapSerializable {
|
||||||
* Builds a MergePolicy using the configured MergePolicyFactory
|
* Builds a MergePolicy using the configured MergePolicyFactory
|
||||||
* or if no factory is configured uses the configured mergePolicy PluginInfo.
|
* or if no factory is configured uses the configured mergePolicy PluginInfo.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private MergePolicy buildMergePolicy(SolrResourceLoader resourceLoader, IndexSchema schema) {
|
private MergePolicy buildMergePolicy(SolrResourceLoader resourceLoader, IndexSchema schema) {
|
||||||
|
|
||||||
final String mpfClassName;
|
final String mpfClassName;
|
||||||
|
@ -285,6 +286,7 @@ public class SolrIndexConfig implements MapSerializable {
|
||||||
return mpf.getMergePolicy();
|
return mpf.getMergePolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
private MergeScheduler buildMergeScheduler(SolrResourceLoader resourceLoader) {
|
private MergeScheduler buildMergeScheduler(SolrResourceLoader resourceLoader) {
|
||||||
String msClassName = mergeSchedulerInfo == null ? SolrIndexConfig.DEFAULT_MERGE_SCHEDULER_CLASSNAME : mergeSchedulerInfo.className;
|
String msClassName = mergeSchedulerInfo == null ? SolrIndexConfig.DEFAULT_MERGE_SCHEDULER_CLASSNAME : mergeSchedulerInfo.className;
|
||||||
MergeScheduler scheduler = resourceLoader.newInstance(msClassName, MergeScheduler.class);
|
MergeScheduler scheduler = resourceLoader.newInstance(msClassName, MergeScheduler.class);
|
||||||
|
@ -293,6 +295,7 @@ public class SolrIndexConfig implements MapSerializable {
|
||||||
// LUCENE-5080: these two setters are removed, so we have to invoke setMaxMergesAndThreads
|
// LUCENE-5080: these two setters are removed, so we have to invoke setMaxMergesAndThreads
|
||||||
// if someone has them configured.
|
// if someone has them configured.
|
||||||
if (scheduler instanceof ConcurrentMergeScheduler) {
|
if (scheduler instanceof ConcurrentMergeScheduler) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList args = mergeSchedulerInfo.initArgs.clone();
|
NamedList args = mergeSchedulerInfo.initArgs.clone();
|
||||||
Integer maxMergeCount = (Integer) args.remove("maxMergeCount");
|
Integer maxMergeCount = (Integer) args.remove("maxMergeCount");
|
||||||
if (maxMergeCount == null) {
|
if (maxMergeCount == null) {
|
||||||
|
|
|
@ -430,6 +430,7 @@ public class SolrIndexSplitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openNewSearcher(SolrCore core) throws Exception {
|
private void openNewSearcher(SolrCore core) throws Exception {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Future[] waitSearcher = new Future[1];
|
Future[] waitSearcher = new Future[1];
|
||||||
core.getSearcher(true, false, waitSearcher, true);
|
core.getSearcher(true, false, waitSearcher, true);
|
||||||
if (waitSearcher[0] != null) {
|
if (waitSearcher[0] != null) {
|
||||||
|
|
|
@ -266,10 +266,12 @@ public class TransactionLog implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
private void readHeader(FastInputStream fis) throws IOException {
|
private void readHeader(FastInputStream fis) throws IOException {
|
||||||
// read existing header
|
// read existing header
|
||||||
fis = fis != null ? fis : new ChannelFastInputStream(channel, 0);
|
fis = fis != null ? fis : new ChannelFastInputStream(channel, 0);
|
||||||
@SuppressWarnings("resource") final LogCodec codec = new LogCodec(resolver);
|
@SuppressWarnings("resource") final LogCodec codec = new LogCodec(resolver);
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map header = (Map) codec.unmarshal(fis);
|
Map header = (Map) codec.unmarshal(fis);
|
||||||
|
|
||||||
fis.readInt(); // skip size
|
fis.readInt(); // skip size
|
||||||
|
@ -306,10 +308,12 @@ public class TransactionLog implements Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
protected void writeLogHeader(LogCodec codec) throws IOException {
|
protected void writeLogHeader(LogCodec codec) throws IOException {
|
||||||
long pos = fos.size();
|
long pos = fos.size();
|
||||||
assert pos == 0;
|
assert pos == 0;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map header = new LinkedHashMap<String, Object>();
|
Map header = new LinkedHashMap<String, Object>();
|
||||||
header.put("SOLR_TLOG", 1); // a magic string + version number
|
header.put("SOLR_TLOG", 1); // a magic string + version number
|
||||||
header.put("strings", globalStringList);
|
header.put("strings", globalStringList);
|
||||||
|
@ -747,6 +751,7 @@ public class TransactionLog implements Closeable {
|
||||||
|
|
||||||
long lastVersion = Long.MIN_VALUE;
|
long lastVersion = Long.MIN_VALUE;
|
||||||
while ((o = super.next()) != null) {
|
while ((o = super.next()) != null) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List) o;
|
List entry = (List) o;
|
||||||
long version = (Long) entry.get(UpdateLog.VERSION_IDX);
|
long version = (Long) entry.get(UpdateLog.VERSION_IDX);
|
||||||
version = Math.abs(version);
|
version = Math.abs(version);
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
// keep track of deletes only... this is not updated on an add
|
// keep track of deletes only... this is not updated on an add
|
||||||
protected LinkedHashMap<BytesRef, LogPtr> oldDeletes = new LinkedHashMap<BytesRef, LogPtr>(numDeletesToKeep) {
|
protected LinkedHashMap<BytesRef, LogPtr> oldDeletes = new LinkedHashMap<BytesRef, LogPtr>(numDeletesToKeep) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean removeEldestEntry(Map.Entry eldest) {
|
protected boolean removeEldestEntry(@SuppressWarnings({"rawtypes"})Map.Entry eldest) {
|
||||||
return size() > numDeletesToKeep;
|
return size() > numDeletesToKeep;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -420,6 +420,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
// populate recent deleteByQuery commands
|
// populate recent deleteByQuery commands
|
||||||
for (int i = startingUpdates.deleteByQueryList.size() - 1; i >= 0; i--) {
|
for (int i = startingUpdates.deleteByQueryList.size() - 1; i >= 0; i--) {
|
||||||
Update update = startingUpdates.deleteByQueryList.get(i);
|
Update update = startingUpdates.deleteByQueryList.get(i);
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> dbq = (List<Object>) update.log.lookup(update.pointer);
|
List<Object> dbq = (List<Object>) update.log.lookup(update.pointer);
|
||||||
long version = (Long) dbq.get(1);
|
long version = (Long) dbq.get(1);
|
||||||
String q = (String) dbq.get(2);
|
String q = (String) dbq.get(2);
|
||||||
|
@ -894,14 +895,16 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
* @return Returns 0 if a full document was found in the log, -1 if no full document was found. If full document was supposed
|
* @return Returns 0 if a full document was found in the log, -1 if no full document was found. If full document was supposed
|
||||||
* to be found in the tlogs, but couldn't be found (because the logs were rotated) then the prevPointer is returned.
|
* to be found in the tlogs, but couldn't be found (because the logs were rotated) then the prevPointer is returned.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
synchronized public long applyPartialUpdates(BytesRef id, long prevPointer, long prevVersion,
|
synchronized public long applyPartialUpdates(BytesRef id, long prevPointer, long prevVersion,
|
||||||
Set<String> onlyTheseFields, SolrDocumentBase latestPartialDoc) {
|
Set<String> onlyTheseFields, @SuppressWarnings({"rawtypes"})SolrDocumentBase latestPartialDoc) {
|
||||||
|
|
||||||
SolrInputDocument partialUpdateDoc = null;
|
SolrInputDocument partialUpdateDoc = null;
|
||||||
|
|
||||||
List<TransactionLog> lookupLogs = Arrays.asList(tlog, prevMapLog, prevMapLog2);
|
List<TransactionLog> lookupLogs = Arrays.asList(tlog, prevMapLog, prevMapLog2);
|
||||||
while (prevPointer >= 0) {
|
while (prevPointer >= 0) {
|
||||||
//go through each partial update and apply it on the incoming doc one after another
|
//go through each partial update and apply it on the incoming doc one after another
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry;
|
List entry;
|
||||||
entry = getEntryFromTLog(prevPointer, prevVersion, lookupLogs);
|
entry = getEntryFromTLog(prevPointer, prevVersion, lookupLogs);
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
|
@ -942,7 +945,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
/**
|
/**
|
||||||
* Add all fields from olderDoc into newerDoc if not already present in newerDoc
|
* Add all fields from olderDoc into newerDoc if not already present in newerDoc
|
||||||
*/
|
*/
|
||||||
private void applyOlderUpdates(SolrDocumentBase newerDoc, SolrInputDocument olderDoc, Set<String> mergeFields) {
|
private void applyOlderUpdates(@SuppressWarnings({"rawtypes"})SolrDocumentBase newerDoc, SolrInputDocument olderDoc, Set<String> mergeFields) {
|
||||||
for (String fieldName : olderDoc.getFieldNames()) {
|
for (String fieldName : olderDoc.getFieldNames()) {
|
||||||
// if the newerDoc has this field, then this field from olderDoc can be ignored
|
// if the newerDoc has this field, then this field from olderDoc can be ignored
|
||||||
if (!newerDoc.containsKey(fieldName) && (mergeFields == null || mergeFields.contains(fieldName))) {
|
if (!newerDoc.containsKey(fieldName) && (mergeFields == null || mergeFields.contains(fieldName))) {
|
||||||
|
@ -959,6 +962,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
*
|
*
|
||||||
* @return The entry if found, otherwise null
|
* @return The entry if found, otherwise null
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private synchronized List getEntryFromTLog(long lookupPointer, long lookupVersion, List<TransactionLog> lookupLogs) {
|
private synchronized List getEntryFromTLog(long lookupPointer, long lookupVersion, List<TransactionLog> lookupLogs) {
|
||||||
for (TransactionLog lookupLog : lookupLogs) {
|
for (TransactionLog lookupLog : lookupLogs) {
|
||||||
if (lookupLog != null && lookupLog.getLogSize() > lookupPointer) {
|
if (lookupLog != null && lookupLog.getLogSize() > lookupPointer) {
|
||||||
|
@ -1255,6 +1259,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
try {
|
try {
|
||||||
while ( (o = logReader.next()) != null ) {
|
while ( (o = logReader.next()) != null ) {
|
||||||
try {
|
try {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List)o;
|
List entry = (List)o;
|
||||||
int operationAndFlags = (Integer) entry.get(0);
|
int operationAndFlags = (Integer) entry.get(0);
|
||||||
int oper = operationAndFlags & OPERATION_MASK;
|
int oper = operationAndFlags & OPERATION_MASK;
|
||||||
|
@ -1491,6 +1496,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
if (o==null) break;
|
if (o==null) break;
|
||||||
|
|
||||||
// should currently be a List<Oper,Ver,Doc/Id>
|
// should currently be a List<Oper,Ver,Doc/Id>
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List)o;
|
List entry = (List)o;
|
||||||
|
|
||||||
// TODO: refactor this out so we get common error handling
|
// TODO: refactor this out so we get common error handling
|
||||||
|
@ -1875,6 +1881,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// should currently be a List<Oper,Ver,Doc/Id>
|
// should currently be a List<Oper,Ver,Doc/Id>
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List entry = (List) o;
|
List entry = (List) o;
|
||||||
operationAndFlags = (Integer) entry.get(UpdateLog.FLAGS_IDX);
|
operationAndFlags = (Integer) entry.get(UpdateLog.FLAGS_IDX);
|
||||||
int oper = operationAndFlags & OPERATION_MASK;
|
int oper = operationAndFlags & OPERATION_MASK;
|
||||||
|
@ -2082,7 +2089,8 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
|
||||||
* if it is UPDATE_INPLACE then the previous version will also be read from the entry
|
* if it is UPDATE_INPLACE then the previous version will also be read from the entry
|
||||||
* @param version Version already obtained from the entry.
|
* @param version Version already obtained from the entry.
|
||||||
*/
|
*/
|
||||||
public static AddUpdateCommand convertTlogEntryToAddUpdateCommand(SolrQueryRequest req, List entry,
|
public static AddUpdateCommand convertTlogEntryToAddUpdateCommand(SolrQueryRequest req,
|
||||||
|
@SuppressWarnings({"rawtypes"})List entry,
|
||||||
int operation, long version) {
|
int operation, long version) {
|
||||||
assert operation == UpdateLog.ADD || operation == UpdateLog.UPDATE_INPLACE;
|
assert operation == UpdateLog.ADD || operation == UpdateLog.UPDATE_INPLACE;
|
||||||
SolrInputDocument sdoc = (SolrInputDocument) entry.get(entry.size()-1);
|
SolrInputDocument sdoc = (SolrInputDocument) entry.get(entry.size()-1);
|
||||||
|
|
|
@ -219,6 +219,7 @@ public class VersionInfo {
|
||||||
if (lookup < 0) return null; // this means the doc doesn't exist in the index yet
|
if (lookup < 0) return null; // this means the doc doesn't exist in the index yet
|
||||||
|
|
||||||
ValueSource vs = versionField.getType().getValueSource(versionField, null);
|
ValueSource vs = versionField.getType().getValueSource(versionField, null);
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map context = ValueSource.newContext(searcher);
|
Map context = ValueSource.newContext(searcher);
|
||||||
vs.createWeight(context, searcher);
|
vs.createWeight(context, searcher);
|
||||||
FunctionValues fv = vs.getValues(context, searcher.getTopReaderContext().leaves().get((int) (lookup >> 32)));
|
FunctionValues fv = vs.getValues(context, searcher.getTopReaderContext().leaves().get((int) (lookup >> 32)));
|
||||||
|
@ -254,6 +255,7 @@ public class VersionInfo {
|
||||||
|
|
||||||
long maxVersionInIndex = 0L;
|
long maxVersionInIndex = 0L;
|
||||||
ValueSource vs = versionField.getType().getValueSource(versionField, null);
|
ValueSource vs = versionField.getType().getValueSource(versionField, null);
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map funcContext = ValueSource.newContext(searcher);
|
Map funcContext = ValueSource.newContext(searcher);
|
||||||
vs.createWeight(funcContext, searcher);
|
vs.createWeight(funcContext, searcher);
|
||||||
// TODO: multi-thread this
|
// TODO: multi-thread this
|
||||||
|
|
|
@ -46,7 +46,7 @@ public abstract class AbstractDefaultValueUpdateProcessorFactory
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
Object obj = args.remove("fieldName");
|
Object obj = args.remove("fieldName");
|
||||||
if (null == obj && null == fieldName) {
|
if (null == obj && null == fieldName) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
inclusions = FieldMutatingUpdateProcessorFactory.parseSelectorParams(args);
|
inclusions = FieldMutatingUpdateProcessorFactory.parseSelectorParams(args);
|
||||||
validateSelectorParams(inclusions);
|
validateSelectorParams(inclusions);
|
||||||
inclusions.fieldNameMatchesSchemaField = false; // Explicitly (non-configurably) require unknown field names
|
inclusions.fieldNameMatchesSchemaField = false; // Explicitly (non-configurably) require unknown field names
|
||||||
|
@ -192,8 +192,9 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<TypeMapping> parseTypeMappings(NamedList args) {
|
private static List<TypeMapping> parseTypeMappings(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
List<TypeMapping> typeMappings = new ArrayList<>();
|
List<TypeMapping> typeMappings = new ArrayList<>();
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> typeMappingsParams = args.getAll(TYPE_MAPPING_PARAM);
|
List<Object> typeMappingsParams = args.getAll(TYPE_MAPPING_PARAM);
|
||||||
for (Object typeMappingObj : typeMappingsParams) {
|
for (Object typeMappingObj : typeMappingsParams) {
|
||||||
if (null == typeMappingObj) {
|
if (null == typeMappingObj) {
|
||||||
|
@ -202,6 +203,7 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
if ( ! (typeMappingObj instanceof NamedList) ) {
|
if ( ! (typeMappingObj instanceof NamedList) ) {
|
||||||
throw new SolrException(SERVER_ERROR, "'" + TYPE_MAPPING_PARAM + "' init param must be a <lst>");
|
throw new SolrException(SERVER_ERROR, "'" + TYPE_MAPPING_PARAM + "' init param must be a <lst>");
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList typeMappingNamedList = (NamedList)typeMappingObj;
|
NamedList typeMappingNamedList = (NamedList)typeMappingObj;
|
||||||
|
|
||||||
Object fieldTypeObj = typeMappingNamedList.remove(FIELD_TYPE_PARAM);
|
Object fieldTypeObj = typeMappingNamedList.remove(FIELD_TYPE_PARAM);
|
||||||
|
@ -218,6 +220,7 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
}
|
}
|
||||||
String fieldType = fieldTypeObj.toString();
|
String fieldType = fieldTypeObj.toString();
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<String> valueClasses
|
Collection<String> valueClasses
|
||||||
= typeMappingNamedList.removeConfigArgs(VALUE_CLASS_PARAM);
|
= typeMappingNamedList.removeConfigArgs(VALUE_CLASS_PARAM);
|
||||||
if (valueClasses.isEmpty()) {
|
if (valueClasses.isEmpty()) {
|
||||||
|
@ -245,6 +248,7 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
if ( ! (copyFieldObj instanceof NamedList)) {
|
if ( ! (copyFieldObj instanceof NamedList)) {
|
||||||
throw new SolrException(SERVER_ERROR, "'" + COPY_FIELD_PARAM + "' init param must be a <lst>");
|
throw new SolrException(SERVER_ERROR, "'" + COPY_FIELD_PARAM + "' init param must be a <lst>");
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList copyFieldNamedList = (NamedList)copyFieldObj;
|
NamedList copyFieldNamedList = (NamedList)copyFieldObj;
|
||||||
// dest
|
// dest
|
||||||
Object destObj = copyFieldNamedList.remove(DEST_PARAM);
|
Object destObj = copyFieldNamedList.remove(DEST_PARAM);
|
||||||
|
@ -556,6 +560,7 @@ public class AddSchemaFieldsUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isImmutableConfigSet(SolrCore core) {
|
private boolean isImmutableConfigSet(SolrCore core) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList args = core.getConfigSetProperties();
|
NamedList args = core.getConfigSetProperties();
|
||||||
Object immutable = args != null ? args.get(IMMUTABLE_CONFIGSET_ARG) : null;
|
Object immutable = args != null ? args.get(IMMUTABLE_CONFIGSET_ARG) : null;
|
||||||
return immutable != null ? Boolean.parseBoolean(immutable.toString()) : false;
|
return immutable != null ? Boolean.parseBoolean(immutable.toString()) : false;
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class AtomicUpdateDocumentMerger {
|
||||||
* @param toDoc the final SolrInputDocument that will be mutated with the values from the fromDoc atomic commands
|
* @param toDoc the final SolrInputDocument that will be mutated with the values from the fromDoc atomic commands
|
||||||
* @return toDoc with mutated values
|
* @return toDoc with mutated values
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public SolrInputDocument merge(final SolrInputDocument fromDoc, SolrInputDocument toDoc) {
|
public SolrInputDocument merge(final SolrInputDocument fromDoc, SolrInputDocument toDoc) {
|
||||||
for (SolrInputField sif : fromDoc.values()) {
|
for (SolrInputField sif : fromDoc.values()) {
|
||||||
Object val = sif.getValue();
|
Object val = sif.getValue();
|
||||||
|
@ -164,6 +165,7 @@ public class AtomicUpdateDocumentMerger {
|
||||||
*
|
*
|
||||||
* @return Return a set of fields that can be in-place updated.
|
* @return Return a set of fields that can be in-place updated.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public static Set<String> computeInPlaceUpdatableFields(AddUpdateCommand cmd) throws IOException {
|
public static Set<String> computeInPlaceUpdatableFields(AddUpdateCommand cmd) throws IOException {
|
||||||
SolrInputDocument sdoc = cmd.getSolrInputDocument();
|
SolrInputDocument sdoc = cmd.getSolrInputDocument();
|
||||||
IndexSchema schema = cmd.getReq().getSchema();
|
IndexSchema schema = cmd.getReq().getSchema();
|
||||||
|
@ -415,7 +417,9 @@ public class AtomicUpdateDocumentMerger {
|
||||||
* @param updateDoc the document that was sent as part of the Add Update Command
|
* @param updateDoc the document that was sent as part of the Add Update Command
|
||||||
* @return updated SolrInputDocument
|
* @return updated SolrInputDocument
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
public SolrInputDocument updateDocInSif(SolrInputField updateSif, SolrInputDocument cmdDocWChildren, SolrInputDocument updateDoc) {
|
public SolrInputDocument updateDocInSif(SolrInputField updateSif, SolrInputDocument cmdDocWChildren, SolrInputDocument updateDoc) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List sifToReplaceValues = (List) updateSif.getValues();
|
List sifToReplaceValues = (List) updateSif.getValues();
|
||||||
final boolean wasList = updateSif.getValue() instanceof Collection;
|
final boolean wasList = updateSif.getValue() instanceof Collection;
|
||||||
int index = getDocIndexFromCollection(cmdDocWChildren, sifToReplaceValues);
|
int index = getDocIndexFromCollection(cmdDocWChildren, sifToReplaceValues);
|
||||||
|
@ -511,6 +515,7 @@ public class AtomicUpdateDocumentMerger {
|
||||||
final String name = sif.getName();
|
final String name = sif.getName();
|
||||||
SolrInputField existingField = toDoc.get(name);
|
SolrInputField existingField = toDoc.get(name);
|
||||||
if (existingField == null) return;
|
if (existingField == null) return;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final Collection original = existingField.getValues();
|
final Collection original = existingField.getValues();
|
||||||
if (fieldVal instanceof Collection) {
|
if (fieldVal instanceof Collection) {
|
||||||
for (Object object : (Collection) fieldVal) {
|
for (Object object : (Collection) fieldVal) {
|
||||||
|
@ -546,6 +551,7 @@ public class AtomicUpdateDocumentMerger {
|
||||||
private Collection<Pattern> preparePatterns(Object fieldVal) {
|
private Collection<Pattern> preparePatterns(Object fieldVal) {
|
||||||
final Collection<Pattern> patterns = new LinkedHashSet<>(1);
|
final Collection<Pattern> patterns = new LinkedHashSet<>(1);
|
||||||
if (fieldVal instanceof Collection) {
|
if (fieldVal instanceof Collection) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<Object> patternVals = (Collection<Object>) fieldVal;
|
Collection<Object> patternVals = (Collection<Object>) fieldVal;
|
||||||
for (Object patternVal : patternVals) {
|
for (Object patternVal : patternVals) {
|
||||||
patterns.add(Pattern.compile(patternVal.toString()));
|
patterns.add(Pattern.compile(patternVal.toString()));
|
||||||
|
@ -568,6 +574,7 @@ public class AtomicUpdateDocumentMerger {
|
||||||
if(!(obj instanceof Collection)) {
|
if(!(obj instanceof Collection)) {
|
||||||
return obj instanceof SolrDocumentBase;
|
return obj instanceof SolrDocumentBase;
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Collection objValues = (Collection) obj;
|
Collection objValues = (Collection) obj;
|
||||||
if(objValues.size() == 0) {
|
if(objValues.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -575,7 +582,7 @@ public class AtomicUpdateDocumentMerger {
|
||||||
return objValues.iterator().next() instanceof SolrDocumentBase;
|
return objValues.iterator().next() instanceof SolrDocumentBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeObj(Collection original, Object toRemove, String fieldName) {
|
private void removeObj(@SuppressWarnings({"rawtypes"})Collection original, Object toRemove, String fieldName) {
|
||||||
if(isChildDoc(toRemove)) {
|
if(isChildDoc(toRemove)) {
|
||||||
removeChildDoc(original, (SolrInputDocument) toRemove);
|
removeChildDoc(original, (SolrInputDocument) toRemove);
|
||||||
} else {
|
} else {
|
||||||
|
@ -583,7 +590,8 @@ public class AtomicUpdateDocumentMerger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removeChildDoc(Collection original, SolrInputDocument docToRemove) {
|
@SuppressWarnings({"unchecked"})
|
||||||
|
private static void removeChildDoc(@SuppressWarnings({"rawtypes"})Collection original, SolrInputDocument docToRemove) {
|
||||||
for(SolrInputDocument doc: (Collection<SolrInputDocument>) original) {
|
for(SolrInputDocument doc: (Collection<SolrInputDocument>) original) {
|
||||||
if(isDerivedFromDoc(doc, docToRemove)) {
|
if(isDerivedFromDoc(doc, docToRemove)) {
|
||||||
original.remove(doc);
|
original.remove(doc);
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class CdcrUpdateProcessorFactory
|
||||||
implements DistributingUpdateProcessorFactory {
|
implements DistributingUpdateProcessorFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ClassificationUpdateProcessorFactory extends UpdateRequestProcessor
|
||||||
private ClassificationUpdateProcessorParams classificationParams;
|
private ClassificationUpdateProcessorParams classificationParams;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})final NamedList args) {
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
params = args.toSolrParams();
|
params = args.toSolrParams();
|
||||||
classificationParams = new ClassificationUpdateProcessorParams();
|
classificationParams = new ClassificationUpdateProcessorParams();
|
||||||
|
|
|
@ -198,7 +198,7 @@ public class CloneFieldUpdateProcessorFactory
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
// high level (loose) check for which type of config we have.
|
// high level (loose) check for which type of config we have.
|
||||||
//
|
//
|
||||||
|
@ -283,7 +283,7 @@ public class CloneFieldUpdateProcessorFactory
|
||||||
* "source" and "dest" init params <em>do</em> exist.
|
* "source" and "dest" init params <em>do</em> exist.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void initSourceSelectorSyntax(NamedList args) {
|
private void initSourceSelectorSyntax(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
// Full and complete syntax where source and dest are mandatory.
|
// Full and complete syntax where source and dest are mandatory.
|
||||||
//
|
//
|
||||||
// source may be a single string or a selector.
|
// source may be a single string or a selector.
|
||||||
|
@ -307,6 +307,7 @@ public class CloneFieldUpdateProcessorFactory
|
||||||
if (1 == sources.size()) {
|
if (1 == sources.size()) {
|
||||||
if (sources.get(0) instanceof NamedList) {
|
if (sources.get(0) instanceof NamedList) {
|
||||||
// nested set of selector options
|
// nested set of selector options
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList selectorConfig = (NamedList) args.remove(SOURCE_PARAM);
|
NamedList selectorConfig = (NamedList) args.remove(SOURCE_PARAM);
|
||||||
|
|
||||||
srcInclusions = parseSelectorParams(selectorConfig);
|
srcInclusions = parseSelectorParams(selectorConfig);
|
||||||
|
@ -322,6 +323,7 @@ public class CloneFieldUpdateProcessorFactory
|
||||||
throw new SolrException(SERVER_ERROR, "Init param '" + SOURCE_PARAM +
|
throw new SolrException(SERVER_ERROR, "Init param '" + SOURCE_PARAM +
|
||||||
"' child 'exclude' must be <lst/>");
|
"' child 'exclude' must be <lst/>");
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList exc = (NamedList) excObj;
|
NamedList exc = (NamedList) excObj;
|
||||||
srcExclusions.add(parseSelectorParams(exc));
|
srcExclusions.add(parseSelectorParams(exc));
|
||||||
if (0 < exc.size()) {
|
if (0 < exc.size()) {
|
||||||
|
@ -353,6 +355,7 @@ public class CloneFieldUpdateProcessorFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d instanceof NamedList) {
|
if (d instanceof NamedList) {
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList destList = (NamedList) d;
|
NamedList destList = (NamedList) d;
|
||||||
|
|
||||||
Object patt = destList.remove(PATTERN_PARAM);
|
Object patt = destList.remove(PATTERN_PARAM);
|
||||||
|
@ -469,7 +472,7 @@ public class CloneFieldUpdateProcessorFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
/** macro */
|
/** macro */
|
||||||
private static SelectorParams parseSelectorParams(NamedList args) {
|
private static SelectorParams parseSelectorParams(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
return FieldMutatingUpdateProcessorFactory.parseSelectorParams(args);
|
return FieldMutatingUpdateProcessorFactory.parseSelectorParams(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public final class ConcatFieldUpdateProcessorFactory extends FieldMutatingUpdate
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
Object d = args.remove("delimiter");
|
Object d = args.remove("delimiter");
|
||||||
if (null != d) delimiter = d.toString();
|
if (null != d) delimiter = d.toString();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class DefaultValueUpdateProcessorFactory
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
Object obj = args.remove("value");
|
Object obj = args.remove("value");
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
|
|
|
@ -325,7 +325,9 @@ public class DocBasedVersionConstraintsProcessor extends UpdateRequestProcessor
|
||||||
* @param userVersionFieldName Field name of the user versions being compared
|
* @param userVersionFieldName Field name of the user versions being compared
|
||||||
* @return True if acceptable, false if not.
|
* @return True if acceptable, false if not.
|
||||||
*/
|
*/
|
||||||
protected boolean newUpdateComparePasses(Comparable newUserVersion, Comparable oldUserVersion, String userVersionFieldName) {
|
@SuppressWarnings({"unchecked"})
|
||||||
|
protected boolean newUpdateComparePasses(@SuppressWarnings({"rawtypes"})Comparable newUserVersion,
|
||||||
|
@SuppressWarnings({"rawtypes"})Comparable oldUserVersion, String userVersionFieldName) {
|
||||||
return oldUserVersion.compareTo(newUserVersion) < 0;
|
return oldUserVersion.compareTo(newUserVersion) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,6 +357,7 @@ public class DocBasedVersionConstraintsProcessor extends UpdateRequestProcessor
|
||||||
SchemaField field,
|
SchemaField field,
|
||||||
SolrIndexSearcher searcher) throws IOException {
|
SolrIndexSearcher searcher) throws IOException {
|
||||||
ValueSource vs = field.getType().getValueSource(field, null);
|
ValueSource vs = field.getType().getValueSource(field, null);
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
Map context = ValueSource.newContext(searcher);
|
Map context = ValueSource.newContext(searcher);
|
||||||
vs.createWeight(context, searcher);
|
vs.createWeight(context, searcher);
|
||||||
return vs.getValues(context, segmentContext);
|
return vs.getValues(context, segmentContext);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class DocBasedVersionConstraintsProcessorFactory extends UpdateRequestPro
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init( NamedList args ) {
|
public void init( @SuppressWarnings({"rawtypes"})NamedList args ) {
|
||||||
|
|
||||||
Object tmp = args.remove("versionField");
|
Object tmp = args.remove("versionField");
|
||||||
if (null == tmp) {
|
if (null == tmp) {
|
||||||
|
|
|
@ -195,7 +195,8 @@ public final class DocExpirationUpdateProcessorFactory
|
||||||
private SolrException confErr(final String msg, SolrException root) {
|
private SolrException confErr(final String msg, SolrException root) {
|
||||||
return new SolrException(SERVER_ERROR, this.getClass().getSimpleName()+": "+msg, root);
|
return new SolrException(SERVER_ERROR, this.getClass().getSimpleName()+": "+msg, root);
|
||||||
}
|
}
|
||||||
private String removeArgStr(final NamedList args, final String arg, final String def,
|
private String removeArgStr(@SuppressWarnings({"rawtypes"})final NamedList args,
|
||||||
|
final String arg, final String def,
|
||||||
final String errMsg) {
|
final String errMsg) {
|
||||||
|
|
||||||
if (args.indexOf(arg,0) < 0) return def;
|
if (args.indexOf(arg,0) < 0) return def;
|
||||||
|
@ -210,7 +211,7 @@ public final class DocExpirationUpdateProcessorFactory
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
deleteChainName = removeArgStr(args, DEL_CHAIN_NAME_CONF, null,
|
deleteChainName = removeArgStr(args, DEL_CHAIN_NAME_CONF, null,
|
||||||
"must be a <str> or <null/> for default chain");
|
"must be a <str> or <null/> for default chain");
|
||||||
|
|
|
@ -53,7 +53,7 @@ public final class FieldLengthUpdateProcessorFactory extends FieldMutatingUpdate
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
// no length specific init args
|
// no length specific init args
|
||||||
super.init(args);
|
super.init(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,12 +209,14 @@ public abstract class FieldMutatingUpdateProcessor
|
||||||
private static final class ConfigurableFieldNameSelectorHelper {
|
private static final class ConfigurableFieldNameSelectorHelper {
|
||||||
|
|
||||||
final SelectorParams params;
|
final SelectorParams params;
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final Collection<Class> classes;
|
final Collection<Class> classes;
|
||||||
|
|
||||||
private ConfigurableFieldNameSelectorHelper(final SolrResourceLoader loader,
|
private ConfigurableFieldNameSelectorHelper(final SolrResourceLoader loader,
|
||||||
final SelectorParams params) {
|
final SelectorParams params) {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
final Collection<Class> classes = new ArrayList<>(params.typeClass.size());
|
final Collection<Class> classes = new ArrayList<>(params.typeClass.size());
|
||||||
|
|
||||||
for (String t : params.typeClass) {
|
for (String t : params.typeClass) {
|
||||||
|
@ -267,8 +269,9 @@ public abstract class FieldMutatingUpdateProcessor
|
||||||
* returns true if the Object 'o' is an instance of any class in
|
* returns true if the Object 'o' is an instance of any class in
|
||||||
* the Collection
|
* the Collection
|
||||||
*/
|
*/
|
||||||
private static boolean instanceOfAny(Object o, Collection<Class> classes) {
|
private static boolean instanceOfAny(Object o,
|
||||||
for (Class c : classes) {
|
@SuppressWarnings({"rawtypes"})Collection<Class> classes) {
|
||||||
|
for (@SuppressWarnings({"rawtypes"})Class c : classes) {
|
||||||
if ( c.isInstance(o) ) return true;
|
if ( c.isInstance(o) ) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -138,7 +138,9 @@ public abstract class FieldMutatingUpdateProcessorFactory
|
||||||
"selector was never initialized, inform(SolrCore) never called???");
|
"selector was never initialized, inform(SolrCore) never called???");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SelectorParams parseSelectorParams(NamedList args) {
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
public static SelectorParams parseSelectorParams(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
SelectorParams params = new SelectorParams();
|
SelectorParams params = new SelectorParams();
|
||||||
|
|
||||||
params.fieldName = new HashSet<>(args.removeConfigArgs("fieldName"));
|
params.fieldName = new HashSet<>(args.removeConfigArgs("fieldName"));
|
||||||
|
@ -168,8 +170,10 @@ public abstract class FieldMutatingUpdateProcessorFactory
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<SelectorParams> parseSelectorExclusionParams(NamedList args) {
|
public static Collection<SelectorParams> parseSelectorExclusionParams(
|
||||||
|
@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
Collection<SelectorParams> exclusions = new ArrayList<>();
|
Collection<SelectorParams> exclusions = new ArrayList<>();
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<Object> excList = args.getAll("exclude");
|
List<Object> excList = args.getAll("exclude");
|
||||||
for (Object excObj : excList) {
|
for (Object excObj : excList) {
|
||||||
if (null == excObj) {
|
if (null == excObj) {
|
||||||
|
@ -180,6 +184,7 @@ public abstract class FieldMutatingUpdateProcessorFactory
|
||||||
throw new SolrException (SolrException.ErrorCode.SERVER_ERROR,
|
throw new SolrException (SolrException.ErrorCode.SERVER_ERROR,
|
||||||
"'exclude' init param must be <lst/>");
|
"'exclude' init param must be <lst/>");
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
NamedList exc = (NamedList) excObj;
|
NamedList exc = (NamedList) excObj;
|
||||||
exclusions.add(parseSelectorParams(exc));
|
exclusions.add(parseSelectorParams(exc));
|
||||||
if (0 < exc.size()) {
|
if (0 < exc.size()) {
|
||||||
|
@ -203,7 +208,7 @@ public abstract class FieldMutatingUpdateProcessorFactory
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
inclusions = parseSelectorParams(args);
|
inclusions = parseSelectorParams(args);
|
||||||
exclusions = parseSelectorExclusionParams(args);
|
exclusions = parseSelectorExclusionParams(args);
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class FieldNameMutatingUpdateProcessorFactory extends UpdateRequestProce
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
sourcePattern = (String) args.get("pattern");
|
sourcePattern = (String) args.get("pattern");
|
||||||
replacement = (String) args.get("replacement");
|
replacement = (String) args.get("replacement");
|
||||||
if(sourcePattern ==null || replacement == null) {
|
if(sourcePattern ==null || replacement == null) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class IgnoreCommitOptimizeUpdateProcessorFactory extends UpdateRequestPro
|
||||||
protected boolean ignoreOptimizeOnly = false; // default behavior is to ignore commits and optimize
|
protected boolean ignoreOptimizeOnly = false; // default behavior is to ignore commits and optimize
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})final NamedList args) {
|
||||||
SolrParams params = (args != null) ? args.toSolrParams() : null;
|
SolrParams params = (args != null) ? args.toSolrParams() : null;
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
errorCode = ErrorCode.FORBIDDEN; // default is 403 error
|
errorCode = ErrorCode.FORBIDDEN; // default is 403 error
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class IgnoreLargeDocumentProcessorFactory extends UpdateRequestProcessorF
|
||||||
private long maxDocumentSize = 1024 * 1024;
|
private long maxDocumentSize = 1024 * 1024;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
maxDocumentSize = args.toSolrParams().required().getLong(LIMIT_SIZE_PARAM);
|
maxDocumentSize = args.toSolrParams().required().getLong(LIMIT_SIZE_PARAM);
|
||||||
args.remove(LIMIT_SIZE_PARAM);
|
args.remove(LIMIT_SIZE_PARAM);
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ public class IgnoreLargeDocumentProcessorFactory extends UpdateRequestProcessorF
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
static long estimate(Object obj) {
|
static long estimate(Object obj) {
|
||||||
if (obj instanceof SolrInputDocument) {
|
if (obj instanceof SolrInputDocument) {
|
||||||
return estimate((SolrInputDocument) obj);
|
return estimate((SolrInputDocument) obj);
|
||||||
|
@ -162,7 +163,7 @@ public class IgnoreLargeDocumentProcessorFactory extends UpdateRequestProcessorF
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long estimate(Collection collection) {
|
private static long estimate(@SuppressWarnings({"rawtypes"})Collection collection) {
|
||||||
if (collection.isEmpty()) return 0;
|
if (collection.isEmpty()) return 0;
|
||||||
long size = 0;
|
long size = 0;
|
||||||
for (Object obj : collection) {
|
for (Object obj : collection) {
|
||||||
|
|
|
@ -59,6 +59,7 @@ public final class LastFieldValueUpdateProcessorFactory extends FieldValueSubset
|
||||||
|
|
||||||
if (values instanceof List) {
|
if (values instanceof List) {
|
||||||
// optimize index lookup
|
// optimize index lookup
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
List l = (List)values;
|
List l = (List)values;
|
||||||
result = l.get(l.size()-1);
|
result = l.get(l.size()-1);
|
||||||
} else if (values instanceof SortedSet) {
|
} else if (values instanceof SortedSet) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class LogUpdateProcessorFactory extends UpdateRequestProcessorFactory imp
|
||||||
int maxNumToLog = 10;
|
int maxNumToLog = 10;
|
||||||
int slowUpdateThresholdMillis = -1;
|
int slowUpdateThresholdMillis = -1;
|
||||||
@Override
|
@Override
|
||||||
public void init( final NamedList args ) {
|
public void init( @SuppressWarnings({"rawtypes"})final NamedList args ) {
|
||||||
if( args != null ) {
|
if( args != null ) {
|
||||||
SolrParams params = args.toSolrParams();
|
SolrParams params = args.toSolrParams();
|
||||||
maxNumToLog = params.getInt( "maxNumToLog", maxNumToLog );
|
maxNumToLog = params.getInt( "maxNumToLog", maxNumToLog );
|
||||||
|
|
|
@ -55,7 +55,7 @@ import static org.apache.solr.update.processor.FieldMutatingUpdateProcessor.SELE
|
||||||
public final class MaxFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
|
public final class MaxFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public Collection pickSubset(Collection values) {
|
public Collection pickSubset(Collection values) {
|
||||||
Collection result = values;
|
Collection result = values;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -55,7 +55,7 @@ import static org.apache.solr.update.processor.FieldMutatingUpdateProcessor.SELE
|
||||||
public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
|
public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public Collection pickSubset(Collection values) {
|
public Collection pickSubset(Collection values) {
|
||||||
Collection result = values;
|
Collection result = values;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class ParseBooleanFieldUpdateProcessorFactory extends FieldMutatingUpdate
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
Object caseSensitiveParam = args.remove(CASE_SENSITIVE_PARAM);
|
Object caseSensitiveParam = args.remove(CASE_SENSITIVE_PARAM);
|
||||||
if (null != caseSensitiveParam) {
|
if (null != caseSensitiveParam) {
|
||||||
if (caseSensitiveParam instanceof Boolean) {
|
if (caseSensitiveParam instanceof Boolean) {
|
||||||
|
@ -113,6 +113,7 @@ public class ParseBooleanFieldUpdateProcessorFactory extends FieldMutatingUpdate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<String> trueValuesParam = args.removeConfigArgs(TRUE_VALUES_PARAM);
|
Collection<String> trueValuesParam = args.removeConfigArgs(TRUE_VALUES_PARAM);
|
||||||
if ( ! trueValuesParam.isEmpty()) {
|
if ( ! trueValuesParam.isEmpty()) {
|
||||||
trueValues.clear();
|
trueValues.clear();
|
||||||
|
@ -121,6 +122,7 @@ public class ParseBooleanFieldUpdateProcessorFactory extends FieldMutatingUpdate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<String> falseValuesParam = args.removeConfigArgs(FALSE_VALUES_PARAM);
|
Collection<String> falseValuesParam = args.removeConfigArgs(FALSE_VALUES_PARAM);
|
||||||
if ( ! falseValuesParam.isEmpty()) {
|
if ( ! falseValuesParam.isEmpty()) {
|
||||||
falseValues.clear();
|
falseValues.clear();
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class ParseDateFieldUpdateProcessorFactory extends FieldMutatingUpdatePro
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
Locale locale;
|
Locale locale;
|
||||||
String localeParam = (String)args.remove(LOCALE_PARAM);
|
String localeParam = (String)args.remove(LOCALE_PARAM);
|
||||||
|
@ -182,6 +182,7 @@ public class ParseDateFieldUpdateProcessorFactory extends FieldMutatingUpdatePro
|
||||||
defaultTimeZone = ZoneId.of(defaultTimeZoneParam.toString());
|
defaultTimeZone = ZoneId.of(defaultTimeZoneParam.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<String> formatsParam = args.removeConfigArgs(FORMATS_PARAM);
|
Collection<String> formatsParam = args.removeConfigArgs(FORMATS_PARAM);
|
||||||
if (null != formatsParam) {
|
if (null != formatsParam) {
|
||||||
for (String value : formatsParam) {
|
for (String value : formatsParam) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public abstract class ParseNumericFieldUpdateProcessorFactory extends FieldMutat
|
||||||
protected Locale locale = Locale.ROOT;
|
protected Locale locale = Locale.ROOT;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
String localeParam = (String)args.remove(LOCALE_PARAM);
|
String localeParam = (String)args.remove(LOCALE_PARAM);
|
||||||
if (null != localeParam) {
|
if (null != localeParam) {
|
||||||
locale = LocaleUtils.toLocale(localeParam);
|
locale = LocaleUtils.toLocale(localeParam);
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class PreAnalyzedUpdateProcessorFactory extends FieldMutatingUpdateProces
|
||||||
private String parserImpl;
|
private String parserImpl;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})final NamedList args) {
|
||||||
parserImpl = (String)args.get("parser");
|
parserImpl = (String)args.get("parser");
|
||||||
args.remove("parser");
|
args.remove("parser");
|
||||||
// initialize inclusion / exclusion patterns
|
// initialize inclusion / exclusion patterns
|
||||||
|
|
|
@ -79,7 +79,7 @@ public final class RegexReplaceProcessorFactory extends FieldMutatingUpdateProce
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
Object patternParam = args.remove(PATTERN_PARAM);
|
Object patternParam = args.remove(PATTERN_PARAM);
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ public class RegexpBoostProcessor extends UpdateRequestProcessor {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
synchronized (sharedObjectCache) {
|
synchronized (sharedObjectCache) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
List<BoostEntry> cachedBoostEntries =
|
List<BoostEntry> cachedBoostEntries =
|
||||||
(List<BoostEntry>) sharedObjectCache.get(BOOST_ENTRIES_CACHE_KEY);
|
(List<BoostEntry>) sharedObjectCache.get(BOOST_ENTRIES_CACHE_KEY);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public final class RemoveBlankFieldUpdateProcessorFactory extends FieldMutatingU
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
// no trim specific init args
|
// no trim specific init args
|
||||||
super.init(args);
|
super.init(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class SignatureUpdateProcessorFactory
|
||||||
private SolrParams params;
|
private SolrParams params;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})final NamedList args) {
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
SolrParams params = args.toSolrParams();
|
SolrParams params = args.toSolrParams();
|
||||||
boolean enabled = params.getBool("enabled", true);
|
boolean enabled = params.getBool("enabled", true);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.solr.update.AddUpdateCommand;
|
||||||
*/
|
*/
|
||||||
public abstract class SimpleUpdateProcessorFactory extends UpdateRequestProcessorFactory {
|
public abstract class SimpleUpdateProcessorFactory extends UpdateRequestProcessorFactory {
|
||||||
private String myName; // if classname==XyzUpdateProcessorFactory myName=Xyz
|
private String myName; // if classname==XyzUpdateProcessorFactory myName=Xyz
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
protected NamedList initArgs = new NamedList();
|
protected NamedList initArgs = new NamedList();
|
||||||
private static ThreadLocal<SolrQueryRequest> REQ = new ThreadLocal<>();
|
private static ThreadLocal<SolrQueryRequest> REQ = new ThreadLocal<>();
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public abstract class SimpleUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
super.init(args);
|
super.init(args);
|
||||||
this.initArgs = args;
|
this.initArgs = args;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class SkipExistingDocumentsProcessorFactory extends UpdateRequestProcesso
|
||||||
private boolean skipUpdateIfMissing = true;
|
private boolean skipUpdateIfMissing = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
Object tmp = args.remove(PARAM_SKIP_INSERT_IF_EXISTS);
|
Object tmp = args.remove(PARAM_SKIP_INSERT_IF_EXISTS);
|
||||||
if (null != tmp) {
|
if (null != tmp) {
|
||||||
if (! (tmp instanceof Boolean) ) {
|
if (! (tmp instanceof Boolean) ) {
|
||||||
|
|
|
@ -177,7 +177,8 @@ public class StatelessScriptUpdateProcessorFactory extends UpdateRequestProcesso
|
||||||
private ScriptEngineCustomizer scriptEngineCustomizer;
|
private ScriptEngineCustomizer scriptEngineCustomizer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Collection<String> scripts =
|
Collection<String> scripts =
|
||||||
args.removeConfigArgs(SCRIPT_ARG);
|
args.removeConfigArgs(SCRIPT_ARG);
|
||||||
if (scripts.isEmpty()) {
|
if (scripts.isEmpty()) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class TrimFieldUpdateProcessorFactory extends FieldMutatingUpdatePr
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
// no trim specific init args
|
// no trim specific init args
|
||||||
super.init(args);
|
super.init(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public final class TruncateFieldUpdateProcessorFactory
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
Object lengthParam = args.remove(MAX_LENGTH_PARAM);
|
Object lengthParam = args.remove(MAX_LENGTH_PARAM);
|
||||||
if (null == lengthParam) {
|
if (null == lengthParam) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class UUIDUpdateProcessorFactory extends UpdateRequestProcessorFactory {
|
||||||
protected String fieldName = null;
|
protected String fieldName = null;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void init(NamedList args) {
|
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||||
|
|
||||||
Object obj = args.remove(FIELD_PARAM);
|
Object obj = args.remove(FIELD_PARAM);
|
||||||
if (null != obj) {
|
if (null != obj) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class UniqFieldsUpdateProcessorFactory extends FieldValueSubsetUpdateProc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public Collection pickSubset(Collection values) {
|
public Collection pickSubset(Collection values) {
|
||||||
Set<Object> uniqs = new HashSet<>();
|
Set<Object> uniqs = new HashSet<>();
|
||||||
List<Object> result = new ArrayList<>(values.size());
|
List<Object> result = new ArrayList<>(values.size());
|
||||||
|
|
|
@ -121,6 +121,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
* @see DistributedUpdateProcessorFactory
|
* @see DistributedUpdateProcessorFactory
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
public void init(PluginInfo info) {
|
public void init(PluginInfo info) {
|
||||||
final String infomsg = "updateRequestProcessorChain \"" +
|
final String infomsg = "updateRequestProcessorChain \"" +
|
||||||
(null != info.name ? info.name : "") + "\"" +
|
(null != info.name ? info.name : "") + "\"" +
|
||||||
|
@ -173,6 +174,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
private List<UpdateRequestProcessorFactory> createProcessors(PluginInfo info) {
|
private List<UpdateRequestProcessorFactory> createProcessors(PluginInfo info) {
|
||||||
List<PluginInfo> processors = info.getChildren("processor");
|
List<PluginInfo> processors = info.getChildren("processor");
|
||||||
return processors.stream().map(it -> {
|
return processors.stream().map(it -> {
|
||||||
|
@ -275,7 +277,8 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void insertBefore(LinkedList<UpdateRequestProcessorFactory> urps, List<UpdateRequestProcessorFactory> newFactories, Class klas, int idx) {
|
private static void insertBefore(LinkedList<UpdateRequestProcessorFactory> urps, List<UpdateRequestProcessorFactory> newFactories,
|
||||||
|
@SuppressWarnings({"rawtypes"})Class klas, int idx) {
|
||||||
if (newFactories.isEmpty()) return;
|
if (newFactories.isEmpty()) return;
|
||||||
for (int i = 0; i < urps.size(); i++) {
|
for (int i = 0; i < urps.size(); i++) {
|
||||||
if (klas.isInstance(urps.get(i))) {
|
if (klas.isInstance(urps.get(i))) {
|
||||||
|
@ -306,6 +309,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
p = core.getUpdateProcessors().get(s);
|
p = core.getUpdateProcessors().get(s);
|
||||||
}
|
}
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
Class<UpdateRequestProcessorFactory> factoryClass = implicits.get(s);
|
Class<UpdateRequestProcessorFactory> factoryClass = implicits.get(s);
|
||||||
if(factoryClass != null) {
|
if(factoryClass != null) {
|
||||||
PluginInfo pluginInfo = new PluginInfo("updateProcessor",
|
PluginInfo pluginInfo = new PluginInfo("updateProcessor",
|
||||||
|
@ -356,7 +360,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
public static class LazyUpdateProcessorFactoryHolder extends PluginBag.PluginHolder<UpdateRequestProcessorFactory> {
|
public static class LazyUpdateProcessorFactoryHolder extends PluginBag.PluginHolder<UpdateRequestProcessorFactory> {
|
||||||
private volatile UpdateRequestProcessorFactory lazyFactory;
|
private volatile UpdateRequestProcessorFactory lazyFactory;
|
||||||
|
|
||||||
public LazyUpdateProcessorFactoryHolder(final PluginBag.PluginHolder holder) {
|
public LazyUpdateProcessorFactoryHolder(@SuppressWarnings({"rawtypes"})final PluginBag.PluginHolder holder) {
|
||||||
super(holder.getPluginInfo());
|
super(holder.getPluginInfo());
|
||||||
lazyFactory = new LazyUpdateRequestProcessorFactory(holder);
|
lazyFactory = new LazyUpdateRequestProcessorFactory(holder);
|
||||||
}
|
}
|
||||||
|
@ -370,6 +374,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
public static class LazyUpdateRequestProcessorFactory extends UpdateRequestProcessorFactory {
|
public static class LazyUpdateRequestProcessorFactory extends UpdateRequestProcessorFactory {
|
||||||
private final PluginBag.PluginHolder<UpdateRequestProcessorFactory> holder;
|
private final PluginBag.PluginHolder<UpdateRequestProcessorFactory> holder;
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public LazyUpdateRequestProcessorFactory(PluginBag.PluginHolder holder) {
|
public LazyUpdateRequestProcessorFactory(PluginBag.PluginHolder holder) {
|
||||||
this.holder = holder;
|
this.holder = holder;
|
||||||
}
|
}
|
||||||
|
@ -384,6 +389,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public static final Map<String, Class> implicits = new ImmutableMap.Builder()
|
public static final Map<String, Class> implicits = new ImmutableMap.Builder()
|
||||||
.put(TemplateUpdateProcessorFactory.NAME, TemplateUpdateProcessorFactory.class)
|
.put(TemplateUpdateProcessorFactory.NAME, TemplateUpdateProcessorFactory.class)
|
||||||
.put(AtomicUpdateProcessorFactory.NAME, AtomicUpdateProcessorFactory.class)
|
.put(AtomicUpdateProcessorFactory.NAME, AtomicUpdateProcessorFactory.class)
|
||||||
|
|
|
@ -41,7 +41,7 @@ public abstract class UpdateRequestProcessorFactory implements NamedListInitiali
|
||||||
public interface RunAlways {}
|
public interface RunAlways {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init( NamedList args )
|
public void init( @SuppressWarnings({"rawtypes"})NamedList args )
|
||||||
{
|
{
|
||||||
// could process the Node
|
// could process the Node
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue