org.apache.solr.update.SplitIndexCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solr-core Show documentation
Show all versions of solr-core Show documentation
Apache Solr (module: core)
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.update;
import java.util.List;
import java.util.Map;
import org.apache.solr.common.cloud.DocRouter;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
/**
* A split index command encapsulated in an object.
*
* @since solr 1.4
*/
public class SplitIndexCommand extends UpdateCommand {
public final SolrQueryResponse rsp;
public final List paths;
public final List cores; // either paths or cores should be specified
public final List ranges;
public final DocRouter router;
public final String routeFieldName;
public final String splitKey;
public final SolrIndexSplitter.SplitMethod splitMethod;
/**
* User provided commit data. Can be let to null if there is none. This commit data is used when
* the split command commits.
*/
public Map commitData;
public SplitIndexCommand(
SolrQueryRequest req,
SolrQueryResponse rsp,
List paths,
List cores,
List ranges,
DocRouter router,
String routeFieldName,
String splitKey,
SolrIndexSplitter.SplitMethod splitMethod) {
super(req);
this.rsp = rsp;
this.paths = paths;
this.cores = cores;
this.ranges = ranges;
this.router = router;
this.routeFieldName = routeFieldName;
this.splitKey = splitKey;
this.splitMethod = splitMethod;
}
@Override
public String name() {
return "split";
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(super.toString());
sb.append(",paths=").append(paths);
sb.append(",cores=").append(cores);
sb.append(",ranges=").append(ranges);
sb.append(",router=").append(router);
if (routeFieldName != null) {
sb.append(",routeFieldName=").append(routeFieldName);
}
if (splitKey != null) {
sb.append(",split.key=").append(splitKey);
}
sb.append(",method=").append(splitMethod.toLower());
if (commitData != null) {
sb.append(",commitData=").append(commitData);
}
sb.append('}');
return sb.toString();
}
}