mirror of https://github.com/apache/lucene.git
SOLR-10755: delete/refactor many solrj deprecations
This commit is contained in:
parent
1d2acdbea7
commit
bc973ecdcf
|
@ -196,6 +196,8 @@ Other Changes
|
|||
|
||||
* SOLR-10710: Fix LTR failing tests. (Diego Ceccarelli via Tomás Fernández Löbbe)
|
||||
|
||||
* SOLR-10755: delete/refactor many solrj deprecations (hossman)
|
||||
|
||||
================== 6.7.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -84,6 +84,12 @@ import org.slf4j.LoggerFactory;
|
|||
public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInfoInitialized
|
||||
{
|
||||
|
||||
/**
|
||||
* This constant was formerly part of HighlightParams. After deprecation it was removed so clients
|
||||
* would no longer use it, but we still support it server side.
|
||||
*/
|
||||
private static final String USE_FVH = HighlightParams.HIGHLIGHT + ".useFastVectorHighlighter";
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
protected final SolrCore solrCore;
|
||||
|
@ -492,7 +498,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
|
|||
boolean methodFvh =
|
||||
HighlightComponent.HighlightMethod.FAST_VECTOR.getMethodName().equals(
|
||||
params.getFieldParam(schemaField.getName(), HighlightParams.METHOD))
|
||||
|| params.getFieldBool(schemaField.getName(), HighlightParams.USE_FVH, false);
|
||||
|| params.getFieldBool(schemaField.getName(), USE_FVH, false);
|
||||
if (!methodFvh) return false;
|
||||
boolean termPosOff = schemaField.storeTermPositions() && schemaField.storeTermOffsets();
|
||||
if (!termPosOff) {
|
||||
|
|
|
@ -373,7 +373,7 @@ public class IndexSchema {
|
|||
void persist(Writer writer) throws IOException {
|
||||
final SolrQueryResponse response = new SolrQueryResponse();
|
||||
response.add(IndexSchema.SCHEMA, getNamedPropertyValues());
|
||||
final NamedList args = new NamedList(Arrays.<Object>asList("indent", "on"));
|
||||
final SolrParams args = (new ModifiableSolrParams()).set("indent", "on");
|
||||
final LocalSolrQueryRequest req = new LocalSolrQueryRequest(null, args);
|
||||
final SchemaXmlWriter schemaXmlWriter = new SchemaXmlWriter(writer, req, response);
|
||||
schemaXmlWriter.setEmitManagedSchemaDoNotEditWarning(true);
|
||||
|
|
|
@ -279,8 +279,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {
|
|||
|
||||
@Test
|
||||
public void testUploadErrors() throws Exception {
|
||||
final SolrClient solrClient = new HttpSolrClient(
|
||||
solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString());
|
||||
final SolrClient solrClient = getHttpSolrClient(solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString());
|
||||
|
||||
ByteBuffer emptyData = ByteBuffer.allocate(0);
|
||||
|
||||
|
@ -504,7 +503,7 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 {
|
|||
|
||||
private void xsltRequest(String collection) throws SolrServerException, IOException {
|
||||
String baseUrl = solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString();
|
||||
try (HttpSolrClient client = new HttpSolrClient(baseUrl + "/" + collection)) {
|
||||
try (HttpSolrClient client = getHttpSolrClient(baseUrl + "/" + collection)) {
|
||||
String xml =
|
||||
"<random>" +
|
||||
" <document>" +
|
||||
|
|
|
@ -332,7 +332,7 @@ public class TestMiniSolrCloudClusterSSL extends SolrTestCaseJ4 {
|
|||
// that "optimize" the test client construction in a way that would prevent us from finding bugs with
|
||||
// regular HttpSolrClient instantiation.
|
||||
if (random().nextBoolean()) {
|
||||
return new HttpSolrClient(url);
|
||||
return (new HttpSolrClient.Builder(url)).build();
|
||||
} // else...
|
||||
return getHttpSolrClient(url);
|
||||
}
|
||||
|
|
|
@ -394,7 +394,7 @@ public class TestSolrCloudWithDelegationTokens extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
ss = new HttpSolrClient.Builder(solrClientPrimary.getBaseURL().toString())
|
||||
.withDelegationToken(token)
|
||||
.withKerberosDelegationToken(token)
|
||||
.withResponseParser(solrClientPrimary.getParser())
|
||||
.build();
|
||||
try {
|
||||
|
|
|
@ -380,7 +380,7 @@ public class TestDelegationWithHadoopAuth extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
ss = new HttpSolrClient.Builder(primarySolrClient.getBaseURL().toString())
|
||||
.withDelegationToken(token)
|
||||
.withKerberosDelegationToken(token)
|
||||
.withResponseParser(primarySolrClient.getParser())
|
||||
.build();
|
||||
try {
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
|||
import java.lang.invoke.MethodHandles;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -234,168 +233,6 @@ public class CloudSolrClient extends SolrClient {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new client object that connects to Zookeeper and is always aware
|
||||
* of the SolrCloud state. If there is a fully redundant Zookeeper quorum and
|
||||
* SolrCloud has enough replicas for every shard in a collection, there is no
|
||||
* single point of failure. Updates will be sent to shard leaders by default.
|
||||
*
|
||||
* @param zkHost
|
||||
* The client endpoint of the zookeeper quorum containing the cloud
|
||||
* state. The full specification for this string is one or more comma
|
||||
* separated HOST:PORT values, followed by an optional chroot value
|
||||
* that starts with a forward slash. Using a chroot allows multiple
|
||||
* applications to coexist in one ensemble. For full details, see the
|
||||
* Zookeeper documentation. Some examples:
|
||||
* <p>
|
||||
* "host1:2181"
|
||||
* <p>
|
||||
* "host1:2181,host2:2181,host3:2181/mysolrchroot"
|
||||
* <p>
|
||||
* "zoo1.example.com:2181,zoo2.example.com:2181,zoo3.example.com:2181"
|
||||
*
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(String zkHost) {
|
||||
this.stateProvider = new ZkClientClusterStateProvider(zkHost);
|
||||
this.clientIsInternal = true;
|
||||
this.myClient = HttpClientUtil.createClient(null);
|
||||
this.lbClient = new LBHttpSolrClient.Builder()
|
||||
.withHttpClient(myClient)
|
||||
.build();
|
||||
this.lbClient.setRequestWriter(new BinaryRequestWriter());
|
||||
this.lbClient.setParser(new BinaryResponseParser());
|
||||
this.updatesToLeaders = true;
|
||||
this.directUpdatesToLeadersOnly = false;
|
||||
shutdownLBHttpSolrServer = true;
|
||||
lbClient.addQueryParams(STATE_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new client object that connects to Zookeeper and is always aware
|
||||
* of the SolrCloud state. If there is a fully redundant Zookeeper quorum and
|
||||
* SolrCloud has enough replicas for every shard in a collection, there is no
|
||||
* single point of failure. Updates will be sent to shard leaders by default.
|
||||
*
|
||||
* @param zkHost
|
||||
* The client endpoint of the zookeeper quorum containing the cloud
|
||||
* state. The full specification for this string is one or more comma
|
||||
* separated HOST:PORT values, followed by an optional chroot value
|
||||
* that starts with a forward slash. Using a chroot allows multiple
|
||||
* applications to coexist in one ensemble. For full details, see the
|
||||
* Zookeeper documentation. Some examples:
|
||||
* <p>
|
||||
* "host1:2181"
|
||||
* <p>
|
||||
* "host1:2181,host2:2181,host3:2181/mysolrchroot"
|
||||
* <p>
|
||||
* "zoo1.example.com:2181,zoo2.example.com:2181,zoo3.example.com:2181"
|
||||
* @param httpClient
|
||||
* the {@link HttpClient} instance to be used for all requests. The
|
||||
* provided httpClient should use a multi-threaded connection manager.
|
||||
*
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(String zkHost, HttpClient httpClient) {
|
||||
this.stateProvider = new ZkClientClusterStateProvider(zkHost);
|
||||
this.clientIsInternal = httpClient == null;
|
||||
this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient;
|
||||
this.lbClient = createLBHttpSolrClient(myClient);
|
||||
this.updatesToLeaders = true;
|
||||
this.directUpdatesToLeadersOnly = false;
|
||||
shutdownLBHttpSolrServer = true;
|
||||
lbClient.addQueryParams(STATE_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new client object using multiple string values in a Collection
|
||||
* instead of a standard zkHost connection string. Note that this method will
|
||||
* not be used if there is only one String argument - that will use
|
||||
* {@link #CloudSolrClient(String)} instead.
|
||||
*
|
||||
* @param zkHosts
|
||||
* A Java Collection (List, Set, etc) of HOST:PORT strings, one for
|
||||
* each host in the zookeeper ensemble. Note that with certain
|
||||
* Collection types like HashSet, the order of hosts in the final
|
||||
* connect string may not be in the same order you added them.
|
||||
* @param chroot
|
||||
* A chroot value for zookeeper, starting with a forward slash. If no
|
||||
* chroot is required, use null.
|
||||
* @throws IllegalArgumentException
|
||||
* if the chroot value does not start with a forward slash.
|
||||
* @see #CloudSolrClient(String)
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(Collection<String> zkHosts, String chroot) {
|
||||
this(zkHosts, chroot, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new client object using multiple string values in a Collection
|
||||
* instead of a standard zkHost connection string. Note that this method will
|
||||
* not be used if there is only one String argument - that will use
|
||||
* {@link #CloudSolrClient(String)} instead.
|
||||
*
|
||||
* @param zkHosts
|
||||
* A Java Collection (List, Set, etc) of HOST:PORT strings, one for
|
||||
* each host in the zookeeper ensemble. Note that with certain
|
||||
* Collection types like HashSet, the order of hosts in the final
|
||||
* connect string may not be in the same order you added them.
|
||||
* @param chroot
|
||||
* A chroot value for zookeeper, starting with a forward slash. If no
|
||||
* chroot is required, use null.
|
||||
* @param httpClient
|
||||
* the {@link HttpClient} instance to be used for all requests. The provided httpClient should use a
|
||||
* multi-threaded connection manager.
|
||||
* @throws IllegalArgumentException
|
||||
* if the chroot value does not start with a forward slash.
|
||||
* @see #CloudSolrClient(String)
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(Collection<String> zkHosts, String chroot, HttpClient httpClient) {
|
||||
this.stateProvider = new ZkClientClusterStateProvider(zkHosts, chroot);
|
||||
this.clientIsInternal = httpClient == null;
|
||||
this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient;
|
||||
this.lbClient = createLBHttpSolrClient(myClient);
|
||||
this.updatesToLeaders = true;
|
||||
this.directUpdatesToLeadersOnly = false;
|
||||
shutdownLBHttpSolrServer = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new client object that connects to Zookeeper and is always aware
|
||||
* of the SolrCloud state. If there is a fully redundant Zookeeper quorum and
|
||||
* SolrCloud has enough replicas for every shard in a collection, there is no
|
||||
* single point of failure. Updates will be sent to shard leaders by default.
|
||||
*
|
||||
* @param zkHosts
|
||||
* A Java Collection (List, Set, etc) of HOST:PORT strings, one for
|
||||
* each host in the zookeeper ensemble. Note that with certain
|
||||
* Collection types like HashSet, the order of hosts in the final
|
||||
* connect string may not be in the same order you added them.
|
||||
* @param chroot
|
||||
* A chroot value for zookeeper, starting with a forward slash. If no
|
||||
* chroot is required, use null.
|
||||
* @param httpClient
|
||||
* the {@link HttpClient} instance to be used for all requests. The provided httpClient should use a
|
||||
* multi-threaded connection manager. If null, a default HttpClient will be used.
|
||||
* @param lbSolrClient
|
||||
* LBHttpSolrClient instance for requests. If null, a default LBHttpSolrClient will be used.
|
||||
* @param updatesToLeaders
|
||||
* If true, sends updates to shard leaders.
|
||||
*
|
||||
* @deprecated use {@link Builder} instead. This will soon be a protected method, and will only
|
||||
* be available for use in implementing subclasses.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(Collection<String> zkHosts, String chroot, HttpClient httpClient, LBHttpSolrClient lbSolrClient, boolean updatesToLeaders) {
|
||||
this(zkHosts, chroot, null, httpClient, lbSolrClient, null, updatesToLeaders, false, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new client object that connects to Zookeeper and is always aware
|
||||
* of the SolrCloud state. If there is a fully redundant Zookeeper quorum and
|
||||
|
@ -467,46 +304,6 @@ public class CloudSolrClient extends SolrClient {
|
|||
this.updatesToLeaders = updatesToLeaders;
|
||||
this.directUpdatesToLeadersOnly = directUpdatesToLeadersOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zkHost
|
||||
* A zookeeper client endpoint.
|
||||
* @param updatesToLeaders
|
||||
* If true, sends updates only to shard leaders.
|
||||
* @see #CloudSolrClient(String) for full description and details on zkHost
|
||||
* @deprecated use {@link CloudSolrClient.Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(String zkHost, boolean updatesToLeaders) {
|
||||
this(zkHost, updatesToLeaders, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zkHost
|
||||
* A zookeeper client endpoint.
|
||||
* @param updatesToLeaders
|
||||
* If true, sends updates only to shard leaders.
|
||||
* @param httpClient
|
||||
* the {@link HttpClient} instance to be used for all requests. The provided httpClient should use a
|
||||
* multi-threaded connection manager.
|
||||
* @see #CloudSolrClient(String) for full description and details on zkHost
|
||||
* @deprecated use {@link CloudSolrClient.Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(String zkHost, boolean updatesToLeaders, HttpClient httpClient) {
|
||||
this.stateProvider = new ZkClientClusterStateProvider(zkHost);
|
||||
this.clientIsInternal = httpClient == null;
|
||||
this.myClient = httpClient == null ? HttpClientUtil.createClient(null) : httpClient;
|
||||
this.lbClient = new LBHttpSolrClient.Builder()
|
||||
.withHttpClient(myClient)
|
||||
.build();
|
||||
this.lbClient.setRequestWriter(new BinaryRequestWriter());
|
||||
this.lbClient.setParser(new BinaryResponseParser());
|
||||
this.updatesToLeaders = updatesToLeaders;
|
||||
this.directUpdatesToLeadersOnly = false;
|
||||
shutdownLBHttpSolrServer = true;
|
||||
lbClient.addQueryParams(STATE_VERSION);
|
||||
}
|
||||
|
||||
/**Sets the cache ttl for DocCollection Objects cached . This is only applicable for collections which are persisted outside of clusterstate.json
|
||||
* @param seconds ttl value in seconds
|
||||
|
@ -515,40 +312,6 @@ public class CloudSolrClient extends SolrClient {
|
|||
assert seconds > 0;
|
||||
this.collectionStateCache.timeToLive = seconds * 1000L;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zkHost
|
||||
* A zookeeper client endpoint.
|
||||
* @param lbClient
|
||||
* LBHttpSolrServer instance for requests.
|
||||
* @see #CloudSolrClient(String) for full description and details on zkHost
|
||||
* @deprecated use {@link CloudSolrClient.Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(String zkHost, LBHttpSolrClient lbClient) {
|
||||
this(zkHost, lbClient, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zkHost
|
||||
* A zookeeper client endpoint.
|
||||
* @param lbClient
|
||||
* LBHttpSolrServer instance for requests.
|
||||
* @param updatesToLeaders
|
||||
* If true, sends updates only to shard leaders.
|
||||
* @see #CloudSolrClient(String) for full description and details on zkHost
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public CloudSolrClient(String zkHost, LBHttpSolrClient lbClient, boolean updatesToLeaders) {
|
||||
this.lbClient = lbClient;
|
||||
this.stateProvider = new ZkClientClusterStateProvider(zkHost);
|
||||
this.updatesToLeaders = updatesToLeaders;
|
||||
this.directUpdatesToLeadersOnly = false;
|
||||
shutdownLBHttpSolrServer = false;
|
||||
this.clientIsInternal = false;
|
||||
lbClient.addQueryParams(STATE_VERSION);
|
||||
}
|
||||
|
||||
public ResponseParser getParser() {
|
||||
return lbClient.getParser();
|
||||
|
@ -660,25 +423,6 @@ public class CloudSolrClient extends SolrClient {
|
|||
this.parallelUpdates = parallelUpdates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a set of config files to Zookeeper and give it a name
|
||||
*
|
||||
* NOTE: You should only allow trusted users to upload configs. If you
|
||||
* are allowing client access to zookeeper, you should protect the
|
||||
* /configs node against unauthorised write access.
|
||||
*
|
||||
* @deprecated Please use {@link ZkClientClusterStateProvider#uploadConfig(Path, String)} instead
|
||||
*
|
||||
* @param configPath {@link java.nio.file.Path} to the config files
|
||||
* @param configName the name of the config
|
||||
* @throws IOException if an IO error occurs
|
||||
*/
|
||||
@Deprecated
|
||||
public void uploadConfig(Path configPath, String configName) throws IOException {
|
||||
stateProvider.connect();
|
||||
assertZKStateProvider().uploadConfig(configPath, configName);
|
||||
}
|
||||
|
||||
private ZkClientClusterStateProvider assertZKStateProvider() {
|
||||
if (stateProvider instanceof ZkClientClusterStateProvider) {
|
||||
return (ZkClientClusterStateProvider) stateProvider;
|
||||
|
@ -686,20 +430,7 @@ public class CloudSolrClient extends SolrClient {
|
|||
throw new IllegalArgumentException("This client does not use ZK");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a named config from Zookeeper to a location on the filesystem
|
||||
*
|
||||
* @deprecated Please use {@link ZkClientClusterStateProvider#downloadConfig(String, Path)} instead
|
||||
* @param configName the name of the config
|
||||
* @param downloadPath the path to write config files to
|
||||
* @throws IOException if an I/O exception occurs
|
||||
*/
|
||||
@Deprecated
|
||||
public void downloadConfig(String configName, Path downloadPath) throws IOException {
|
||||
assertZKStateProvider().downloadConfig(configName, downloadPath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Block until a collection state matches a predicate, or a timeout
|
||||
*
|
||||
|
|
|
@ -95,57 +95,12 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
|
|||
AtomicInteger blockLoops;
|
||||
AtomicInteger emptyQueueLoops;
|
||||
|
||||
/**
|
||||
* Uses an internally managed HttpClient instance.
|
||||
*
|
||||
* @param solrServerUrl
|
||||
* The Solr server URL
|
||||
* @param queueSize
|
||||
* The buffer size before the documents are sent to the server
|
||||
* @param threadCount
|
||||
* The number of background threads used to empty the queue
|
||||
*
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ConcurrentUpdateSolrClient(String solrServerUrl, int queueSize,
|
||||
int threadCount) {
|
||||
this(solrServerUrl, null, queueSize, threadCount);
|
||||
shutdownExecutor = true;
|
||||
internalHttpClient = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ConcurrentUpdateSolrClient(String solrServerUrl,
|
||||
HttpClient client, int queueSize, int threadCount) {
|
||||
this(solrServerUrl, client, queueSize, threadCount, ExecutorUtil.newMDCAwareCachedThreadPool(
|
||||
new SolrjNamedThreadFactory("concurrentUpdateScheduler")));
|
||||
shutdownExecutor = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the supplied HttpClient to send documents to the Solr server.
|
||||
*
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ConcurrentUpdateSolrClient(String solrServerUrl,
|
||||
HttpClient client, int queueSize, int threadCount, ExecutorService es) {
|
||||
this(solrServerUrl, client, queueSize, threadCount, es, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the supplied HttpClient to send documents to the Solr server.
|
||||
*
|
||||
* @deprecated use {@link Builder} instead. This will soon be a
|
||||
* protected method, and will only be available for use in implementing subclasses.
|
||||
*/
|
||||
@Deprecated
|
||||
public ConcurrentUpdateSolrClient(String solrServerUrl,
|
||||
HttpClient client, int queueSize, int threadCount, ExecutorService es, boolean streamDeletes) {
|
||||
protected ConcurrentUpdateSolrClient(String solrServerUrl,
|
||||
HttpClient client, int queueSize, int threadCount,
|
||||
ExecutorService es, boolean streamDeletes) {
|
||||
this.internalHttpClient = (client == null);
|
||||
this.client = new HttpSolrClient.Builder(solrServerUrl)
|
||||
.withHttpClient(client)
|
||||
|
|
|
@ -35,21 +35,15 @@ public class DelegationTokenHttpSolrClient extends HttpSolrClient {
|
|||
public final static String DELEGATION_TOKEN_PARAM = "delegation";
|
||||
|
||||
/**
|
||||
* This constructor is deprecated in favor of passing delegation token via
|
||||
* {@linkplain org.apache.solr.client.solrj.impl.HttpSolrClient.Builder#withInvariantParams(ModifiableSolrParams)}.
|
||||
*
|
||||
* @param baseURL The base url to communicate with the Solr server
|
||||
* @param client Http client instance to use for communication
|
||||
* @param parser Response parser instance to use to decode response from Solr server
|
||||
* @param allowCompression Should compression be allowed ?
|
||||
* @param delegationToken The delegation token string.
|
||||
* Package protected constructor for use by
|
||||
* {@linkplain org.apache.solr.client.solrj.impl.HttpSolrClient.Builder}.
|
||||
* @lucene.internal
|
||||
*/
|
||||
@Deprecated
|
||||
public DelegationTokenHttpSolrClient(String baseURL,
|
||||
HttpClient client,
|
||||
ResponseParser parser,
|
||||
boolean allowCompression,
|
||||
String delegationToken) {
|
||||
DelegationTokenHttpSolrClient(String baseURL,
|
||||
HttpClient client,
|
||||
ResponseParser parser,
|
||||
boolean allowCompression,
|
||||
String delegationToken) {
|
||||
super(baseURL, client, parser, allowCompression);
|
||||
if (delegationToken == null) {
|
||||
throw new IllegalArgumentException("Delegation token cannot be null");
|
||||
|
@ -100,4 +94,4 @@ public class DelegationTokenHttpSolrClient extends HttpSolrClient {
|
|||
}
|
||||
super.setQueryParams(queryParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,40 +158,7 @@ public class HttpSolrClient extends SolrClient {
|
|||
private volatile Integer connectionTimeout;
|
||||
private volatile Integer soTimeout;
|
||||
|
||||
/**
|
||||
* @param baseURL
|
||||
* The URL of the Solr server. For example, "
|
||||
* <code>http://localhost:8983/solr/</code>" if you are using the
|
||||
* standard distribution Solr webapp on your local machine.
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpSolrClient(String baseURL) {
|
||||
this(baseURL, null, new BinaryResponseParser());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpSolrClient(String baseURL, HttpClient client) {
|
||||
this(baseURL, client, new BinaryResponseParser());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpSolrClient(String baseURL, HttpClient client, ResponseParser parser) {
|
||||
this(baseURL, client, parser, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Builder} instead. This will soon be a 'protected'
|
||||
* method, and will only be available for use in implementing subclasses.
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpSolrClient(String baseURL, HttpClient client, ResponseParser parser, boolean allowCompression) {
|
||||
protected HttpSolrClient(String baseURL, HttpClient client, ResponseParser parser, boolean allowCompression) {
|
||||
this.baseUrl = baseURL;
|
||||
if (baseUrl.endsWith("/")) {
|
||||
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
|
||||
|
@ -840,14 +807,6 @@ public class HttpSolrClient extends SolrClient {
|
|||
* Use a delegation token for authenticating via the KerberosPlugin
|
||||
*/
|
||||
public Builder withKerberosDelegationToken(String delegationToken) {
|
||||
return withDelegationToken(delegationToken);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated use {@link withKerberosDelegationToken(String)} instead
|
||||
*/
|
||||
public Builder withDelegationToken(String delegationToken) {
|
||||
if (this.invariantParams.get(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM) != null) {
|
||||
throw new IllegalStateException(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM + " is already defined!");
|
||||
}
|
||||
|
|
|
@ -236,29 +236,10 @@ public class LBHttpSolrClient extends SolrClient {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public LBHttpSolrClient(String... solrServerUrls) throws MalformedURLException {
|
||||
this(null, solrServerUrls);
|
||||
}
|
||||
|
||||
/**
|
||||
* The provided httpClient should use a multi-threaded connection manager
|
||||
* @deprecated use {@link Builder} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public LBHttpSolrClient(HttpClient httpClient, String... solrServerUrl) {
|
||||
this(httpClient, new BinaryResponseParser(), solrServerUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* The provided httpClient should use a multi-threaded connection manager
|
||||
* @deprecated use {@link Builder} instead. This will soon be a protected
|
||||
* method and will only be available for use in implementing subclasses.
|
||||
*/
|
||||
public LBHttpSolrClient(HttpSolrClient.Builder httpSolrClientBuilder,
|
||||
protected LBHttpSolrClient(HttpSolrClient.Builder httpSolrClientBuilder,
|
||||
HttpClient httpClient, String... solrServerUrl) {
|
||||
clientIsInternal = httpClient == null;
|
||||
this.httpSolrClientBuilder = httpSolrClientBuilder;
|
||||
|
@ -275,11 +256,8 @@ public class LBHttpSolrClient extends SolrClient {
|
|||
|
||||
/**
|
||||
* The provided httpClient should use a multi-threaded connection manager
|
||||
* @deprecated use {@link Builder} instead. This will soon be a protected
|
||||
* method and will only be available for use in implementing subclasses.
|
||||
*/
|
||||
@Deprecated
|
||||
public LBHttpSolrClient(HttpClient httpClient, ResponseParser parser, String... solrServerUrl) {
|
||||
protected LBHttpSolrClient(HttpClient httpClient, ResponseParser parser, String... solrServerUrl) {
|
||||
clientIsInternal = (httpClient == null);
|
||||
this.httpClient = httpClient == null ? constructClient(solrServerUrl) : httpClient;
|
||||
this.parser = parser;
|
||||
|
|
|
@ -77,14 +77,6 @@ public class SolrHttpClientContextBuilder {
|
|||
return credentialsProviderProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #createContext(Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpClientContext createContext() {
|
||||
return createContext(null);
|
||||
}
|
||||
|
||||
public HttpClientContext createContext(Object userToken) {
|
||||
HttpClientContext context = new HttpClientContext();
|
||||
if (getCredentialsProviderProvider() != null) {
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParameter;
|
|||
import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionValue;
|
||||
import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
|
||||
import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.ExecutorUtil;
|
||||
|
@ -72,30 +71,6 @@ public class ShortestPathStream extends TupleStream implements Expressible {
|
|||
private int threads;
|
||||
private SolrParams queryParams;
|
||||
|
||||
@Deprecated
|
||||
public ShortestPathStream(String zkHost,
|
||||
String collection,
|
||||
String fromNode,
|
||||
String toNode,
|
||||
String fromField,
|
||||
String toField,
|
||||
Map queryParams,
|
||||
int joinBatchSize,
|
||||
int threads,
|
||||
int maxDepth) {
|
||||
|
||||
init(zkHost,
|
||||
collection,
|
||||
fromNode,
|
||||
toNode,
|
||||
fromField,
|
||||
toField,
|
||||
new MapSolrParams(queryParams),
|
||||
joinBatchSize,
|
||||
threads,
|
||||
maxDepth);
|
||||
}
|
||||
|
||||
public ShortestPathStream(String zkHost,
|
||||
String collection,
|
||||
String fromNode,
|
||||
|
|
|
@ -51,7 +51,6 @@ import org.apache.solr.common.cloud.ClusterState;
|
|||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.cloud.Slice;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.ExecutorUtil;
|
||||
|
@ -89,32 +88,12 @@ public class CloudSolrStream extends TupleStream implements Expressible {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param zkHost Zookeeper ensemble connection string
|
||||
* @param collectionName Name of the collection to operate on
|
||||
* @param params Map<String, String> of parameter/value pairs
|
||||
* @throws IOException Something went wrong
|
||||
* <p>
|
||||
* This form does not allow specifying multiple clauses, say "fq" clauses, use the form that
|
||||
* takes a SolrParams. Transition code can call the preferred method that takes SolrParams
|
||||
* by calling CloudSolrStream(zkHost, collectionName,
|
||||
* new ModifiableSolrParams(SolrParams.toMultiMap(new NamedList(Map<String, String>)));
|
||||
* @deprecated Use the constructor that has a SolrParams obj rather than a Map
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public CloudSolrStream(String zkHost, String collectionName, Map params) throws IOException {
|
||||
init(collectionName, zkHost, new MapSolrParams(params));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zkHost Zookeeper ensemble connection string
|
||||
* @param collectionName Name of the collection to operate on
|
||||
* @param params Map<String, String[]> of parameter/value pairs
|
||||
* @throws IOException Something went wrong
|
||||
*/
|
||||
|
||||
public CloudSolrStream(String zkHost, String collectionName, SolrParams params) throws IOException {
|
||||
init(collectionName, zkHost, params);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
|
|||
import org.apache.solr.client.solrj.io.stream.metrics.Bucket;
|
||||
import org.apache.solr.client.solrj.io.stream.metrics.Metric;
|
||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -72,21 +71,6 @@ public class FacetStream extends TupleStream implements Expressible {
|
|||
protected transient SolrClientCache cache;
|
||||
protected transient CloudSolrClient cloudSolrClient;
|
||||
|
||||
/*
|
||||
*
|
||||
* @deprecated. Use the form that takes a SolrParams rather than Map<String, String>
|
||||
*/
|
||||
@Deprecated
|
||||
public FacetStream(String zkHost,
|
||||
String collection,
|
||||
Map<String, String> props,
|
||||
Bucket[] buckets,
|
||||
Metric[] metrics,
|
||||
FieldComparator[] bucketSorts,
|
||||
int bucketSizeLimit) throws IOException {
|
||||
init(collection, new MapSolrParams(props), buckets, bucketSorts, metrics, bucketSizeLimit, zkHost);
|
||||
}
|
||||
|
||||
public FacetStream(String zkHost,
|
||||
String collection,
|
||||
SolrParams params,
|
||||
|
|
|
@ -174,7 +174,7 @@ public class RandomStream extends TupleStream implements Expressible {
|
|||
if(cache != null) {
|
||||
cloudSolrClient = cache.getCloudSolrClient(zkHost);
|
||||
} else {
|
||||
cloudSolrClient = new CloudSolrClient(zkHost);
|
||||
cloudSolrClient = (new CloudSolrClient.Builder()).withZkHost(zkHost).build();
|
||||
}
|
||||
|
||||
ModifiableSolrParams params = getParams(this.props);
|
||||
|
@ -236,4 +236,4 @@ public class RandomStream extends TupleStream implements Expressible {
|
|||
public StreamComparator getStreamSort() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamExplanation;
|
|||
import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
|
||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -71,19 +70,6 @@ public class SolrStream extends TupleStream {
|
|||
private long checkpoint = -1;
|
||||
private CloseableHttpResponse closeableHttpResponse;
|
||||
|
||||
/**
|
||||
* @param baseUrl Base URL of the stream.
|
||||
* @param params Map<String, String> of parameters
|
||||
* @deprecated, use the form that thakes SolrParams. Existing code can use
|
||||
* new ModifiableSolrParams(SolrParams.toMultiMap(new NamedList(params)))
|
||||
* for existing calls that use Map<String, String>
|
||||
*/
|
||||
@Deprecated
|
||||
public SolrStream(String baseUrl, Map params) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.params = new ModifiableSolrParams(new MapSolrParams(params));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param baseUrl Base URL of the stream.
|
||||
* @param params Map<String, String> of parameters
|
||||
|
|
|
@ -60,9 +60,7 @@ public class SqlStream extends TupleStream implements Expressible {
|
|||
* takes a SolrParams. Transition code can call the preferred method that takes SolrParams
|
||||
* by calling CloudSolrStream(zkHost, collectionName,
|
||||
* new ModifiableSolrParams(SolrParams.toMultiMap(new NamedList(Map<String, String>)));
|
||||
* @deprecated Use the constructor that has a SolrParams obj rather than a Map
|
||||
*/
|
||||
|
||||
public SqlStream(String zkHost, String collectionName, SolrParams params) throws IOException {
|
||||
init(collectionName, zkHost, params);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
|
|||
import org.apache.solr.client.solrj.io.stream.metrics.Metric;
|
||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||
import org.apache.solr.common.SolrDocumentList;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -63,15 +62,6 @@ public class StatsStream extends TupleStream implements Expressible {
|
|||
protected transient CloudSolrClient cloudSolrClient;
|
||||
protected StreamContext streamContext;
|
||||
|
||||
// Use StatsStream(String, String, SolrParams, Metric[]
|
||||
@Deprecated
|
||||
public StatsStream(String zkHost,
|
||||
String collection,
|
||||
Map<String, String> props,
|
||||
Metric[] metrics) {
|
||||
init(zkHost, collection, new MapSolrParams(props), metrics);
|
||||
}
|
||||
|
||||
public StatsStream(String zkHost,
|
||||
String collection,
|
||||
SolrParams params,
|
||||
|
|
|
@ -55,7 +55,6 @@ import org.apache.solr.common.cloud.Replica;
|
|||
import org.apache.solr.common.cloud.Slice;
|
||||
import org.apache.solr.common.cloud.ZkCoreNodeProps;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.ExecutorUtil;
|
||||
|
@ -83,24 +82,6 @@ public class TopicStream extends CloudSolrStream implements Expressible {
|
|||
private String checkpointCollection;
|
||||
private long initialCheckpoint = -1;
|
||||
|
||||
// Use TopicStream that takes a SolrParams
|
||||
@Deprecated
|
||||
public TopicStream(String zkHost,
|
||||
String checkpointCollection,
|
||||
String collection,
|
||||
String id,
|
||||
long initialCheckpoint,
|
||||
long checkpointEvery,
|
||||
Map<String, String> params) {
|
||||
init(zkHost,
|
||||
checkpointCollection,
|
||||
collection,
|
||||
id,
|
||||
initialCheckpoint,
|
||||
checkpointEvery,
|
||||
new MapSolrParams(params));
|
||||
}
|
||||
|
||||
public TopicStream(String zkHost,
|
||||
String checkpointCollection,
|
||||
String collection,
|
||||
|
|
|
@ -24,8 +24,6 @@ public interface HighlightParams {
|
|||
// primary
|
||||
public static final String HIGHLIGHT = "hl";
|
||||
public static final String METHOD = HIGHLIGHT+".method"; // original|fastVector|postings|unified
|
||||
@Deprecated // see hl.method
|
||||
public static final String USE_FVH = HIGHLIGHT + ".useFastVectorHighlighter";
|
||||
public static final String FIELDS = HIGHLIGHT+".fl";
|
||||
public static final String SNIPPETS = HIGHLIGHT+".snippets";
|
||||
|
||||
|
|
|
@ -71,47 +71,6 @@ public class ExecutorUtil {
|
|||
public void clean(AtomicReference<?> ctx);
|
||||
}
|
||||
|
||||
// ** This will interrupt the threads! ** Lucene and Solr do not like this because it can close channels, so only use
|
||||
// this if you know what you are doing - you probably want shutdownAndAwaitTermination.
|
||||
// Marked as Deprecated to discourage use.
|
||||
@Deprecated
|
||||
public static void shutdownWithInterruptAndAwaitTermination(ExecutorService pool) {
|
||||
pool.shutdownNow(); // Cancel currently executing tasks - NOTE: this interrupts!
|
||||
boolean shutdown = false;
|
||||
while (!shutdown) {
|
||||
try {
|
||||
// Wait a while for existing tasks to terminate
|
||||
shutdown = pool.awaitTermination(60, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ie) {
|
||||
// Preserve interrupt status
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ** This will interrupt the threads! ** Lucene and Solr do not like this because it can close channels, so only use
|
||||
// this if you know what you are doing - you probably want shutdownAndAwaitTermination.
|
||||
// Marked as Deprecated to discourage use.
|
||||
@Deprecated
|
||||
public static void shutdownAndAwaitTerminationWithInterrupt(ExecutorService pool) {
|
||||
pool.shutdown(); // Disable new tasks from being submitted
|
||||
boolean shutdown = false;
|
||||
boolean interrupted = false;
|
||||
while (!shutdown) {
|
||||
try {
|
||||
// Wait a while for existing tasks to terminate
|
||||
shutdown = pool.awaitTermination(60, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ie) {
|
||||
// Preserve interrupt status
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
if (!shutdown && !interrupted) {
|
||||
pool.shutdownNow(); // Cancel currently executing tasks - NOTE: this interrupts!
|
||||
interrupted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void shutdownAndAwaitTermination(ExecutorService pool) {
|
||||
pool.shutdown(); // Disable new tasks from being submitted
|
||||
boolean shutdown = false;
|
||||
|
|
|
@ -122,12 +122,17 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry
|
|||
* When using this constructor, runtime type safety is only guaranteed if
|
||||
* all even numbered elements of the input list are of type "T".
|
||||
* </p>
|
||||
*
|
||||
* @param nameValuePairs underlying List which should be used to implement a NamedList
|
||||
* @deprecated Use {@link #NamedList(java.util.Map.Entry[])} for the NamedList instantiation
|
||||
* <p>
|
||||
* This method is package protected and exists solely so SimpleOrderedMap and clone() can utilize it
|
||||
* </p>
|
||||
* <p>
|
||||
* TODO: this method was formerly public, now that it's not we can change the impl details of
|
||||
* this class to be based on a Map.Entry[]
|
||||
* </p>
|
||||
* @lucene.internal
|
||||
* @see #nameValueMapToList
|
||||
*/
|
||||
@Deprecated
|
||||
public NamedList(List<Object> nameValuePairs) {
|
||||
NamedList(List<Object> nameValuePairs) {
|
||||
nvPairs=nameValuePairs;
|
||||
}
|
||||
|
||||
|
@ -136,12 +141,14 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry
|
|||
* indexed elements (0,2,4. ..etc) are Strings and odd elements (1,3,5,) are of
|
||||
* the type "T".
|
||||
*
|
||||
* @return Modified List as per the above description
|
||||
* @deprecated This a temporary placeholder method until the guts of the class
|
||||
* <p>
|
||||
* NOTE: This a temporary placeholder method until the guts of the class
|
||||
* are actually replaced by List<String, ?>.
|
||||
* </p>
|
||||
*
|
||||
* @return Modified List as per the above description
|
||||
* @see <a href="https://issues.apache.org/jira/browse/SOLR-912">SOLR-912</a>
|
||||
*/
|
||||
@Deprecated
|
||||
private List<Object> nameValueMapToList(Map.Entry<String, ? extends T>[] nameValuePairs) {
|
||||
List<Object> result = new ArrayList<>();
|
||||
for (Map.Entry<String, ?> ent : nameValuePairs) {
|
||||
|
|
|
@ -50,10 +50,15 @@ public class SimpleOrderedMap<T> extends NamedList<T> {
|
|||
* Creates an instance backed by an explicitly specified list of
|
||||
* pairwise names/values.
|
||||
*
|
||||
* <p>
|
||||
* TODO: this method was formerly public, now that it's not we can change the impl details of
|
||||
* this class to be based on a Map.Entry[]
|
||||
* </p>
|
||||
*
|
||||
* @param nameValuePairs underlying List which should be used to implement a SimpleOrderedMap; modifying this List will affect the SimpleOrderedMap.
|
||||
* @lucene.internal
|
||||
*/
|
||||
@Deprecated
|
||||
public SimpleOrderedMap(List<Object> nameValuePairs) {
|
||||
private SimpleOrderedMap(List<Object> nameValuePairs) {
|
||||
super(nameValuePairs);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SolrExampleStreamingTest extends SolrExampleTests {
|
|||
public Throwable lastError = null;
|
||||
|
||||
public ErrorTrackingConcurrentUpdateSolrClient(String solrServerUrl, int queueSize, int threadCount) {
|
||||
super(solrServerUrl, queueSize, threadCount);
|
||||
super(solrServerUrl, null, queueSize, threadCount, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -839,7 +839,7 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
|
|||
|
||||
try(HttpSolrClient createdClient = new HttpSolrClient.Builder()
|
||||
.withBaseSolrUrl(jetty.getBaseUrl().toString())
|
||||
.withDelegationToken("mydt")
|
||||
.withKerberosDelegationToken("mydt")
|
||||
.withInvariantParams(SolrTestCaseJ4.params(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM, "mydt"))
|
||||
.build()) {
|
||||
fail();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class CloudSolrClientMultiConstructorTest extends LuceneTestCase {
|
|||
clientChroot = "/mychroot";
|
||||
}
|
||||
|
||||
try (CloudSolrClient client = new CloudSolrClient(hosts, clientChroot)) {
|
||||
try (CloudSolrClient client = (new CloudSolrClient.Builder()).withZkHost(hosts).withZkChroot(clientChroot).build()) {
|
||||
assertEquals(sb.toString(), client.getZkHost());
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,6 @@ public class CloudSolrClientMultiConstructorTest extends LuceneTestCase {
|
|||
public void testBadChroot() {
|
||||
hosts = new ArrayList<>();
|
||||
hosts.add("host1:2181");
|
||||
new CloudSolrClient(hosts, "foo");
|
||||
(new CloudSolrClient.Builder()).withZkHost(hosts).withZkChroot("foo").build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,11 @@ public class ConcurrentUpdateSolrClientTest extends SolrJettyTestBase {
|
|||
int cussThreadCount = 2;
|
||||
int cussQueueSize = 10;
|
||||
|
||||
try (ConcurrentUpdateSolrClient concurrentClient = new ConcurrentUpdateSolrClient(jetty.getBaseUrl().toString(), cussQueueSize, cussThreadCount)) {
|
||||
try (ConcurrentUpdateSolrClient concurrentClient
|
||||
= (new ConcurrentUpdateSolrClient.Builder(jetty.getBaseUrl().toString()))
|
||||
.withQueueSize(cussQueueSize)
|
||||
.withThreadCount(cussThreadCount).build()) {
|
||||
|
||||
SolrInputDocument doc = new SolrInputDocument();
|
||||
doc.addField("id", "collection");
|
||||
concurrentClient.add("collection1", doc);
|
||||
|
@ -203,7 +207,11 @@ public class ConcurrentUpdateSolrClientTest extends SolrJettyTestBase {
|
|||
assertEquals(1, concurrentClient.query("collection1", new SolrQuery("id:collection")).getResults().getNumFound());
|
||||
}
|
||||
|
||||
try (ConcurrentUpdateSolrClient concurrentClient = new ConcurrentUpdateSolrClient(jetty.getBaseUrl().toString() + "/collection1", cussQueueSize, cussThreadCount)) {
|
||||
try (ConcurrentUpdateSolrClient concurrentClient
|
||||
= (new ConcurrentUpdateSolrClient.Builder(jetty.getBaseUrl().toString() + "/collection1"))
|
||||
.withQueueSize(cussQueueSize)
|
||||
.withThreadCount(cussThreadCount).build()) {
|
||||
|
||||
assertEquals(1, concurrentClient.query(new SolrQuery("id:collection")).getResults().getNumFound());
|
||||
}
|
||||
|
||||
|
@ -218,7 +226,10 @@ public class ConcurrentUpdateSolrClientTest extends SolrJettyTestBase {
|
|||
int numRunnables = 5;
|
||||
int expected = numDocs * numRunnables;
|
||||
|
||||
try (ConcurrentUpdateSolrClient concurrentClient = new ConcurrentUpdateSolrClient(jetty.getBaseUrl().toString(), cussQueueSize, cussThreadCount)) {
|
||||
try (ConcurrentUpdateSolrClient concurrentClient
|
||||
= (new ConcurrentUpdateSolrClient.Builder(jetty.getBaseUrl().toString()))
|
||||
.withQueueSize(cussQueueSize)
|
||||
.withThreadCount(cussThreadCount).build()) {
|
||||
concurrentClient.setPollQueueTime(0);
|
||||
|
||||
// ensure it doesn't block where there's nothing to do yet
|
||||
|
@ -246,7 +257,11 @@ public class ConcurrentUpdateSolrClientTest extends SolrJettyTestBase {
|
|||
concurrentClient.shutdownNow();
|
||||
}
|
||||
|
||||
try (ConcurrentUpdateSolrClient concurrentClient = new ConcurrentUpdateSolrClient(jetty.getBaseUrl().toString() + "/collection1", cussQueueSize, cussThreadCount)) {
|
||||
try (ConcurrentUpdateSolrClient concurrentClient
|
||||
= (new ConcurrentUpdateSolrClient.Builder(jetty.getBaseUrl().toString() + "/collection1"))
|
||||
.withQueueSize(cussQueueSize)
|
||||
.withThreadCount(cussThreadCount).build()) {
|
||||
|
||||
assertEquals(expected, concurrentClient.query(new SolrQuery("*:*")).getResults().getNumFound());
|
||||
}
|
||||
|
||||
|
|
|
@ -862,7 +862,7 @@ public class GraphExpressionTest extends SolrCloudTestCase {
|
|||
JettySolrRunner runner = runners.get(0);
|
||||
String url = runner.getBaseUrl().toString();
|
||||
|
||||
HttpSolrClient client = new HttpSolrClient(url);
|
||||
HttpSolrClient client = getHttpSolrClient(url);
|
||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||
|
||||
|
||||
|
|
|
@ -2222,7 +2222,14 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
public static Object skewed(Object likely, Object unlikely) {
|
||||
return (0 == TestUtil.nextInt(random(), 0, 9)) ? unlikely : likely;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A variant of {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} that will randomize which nodes recieve updates
|
||||
* unless otherwise specified by the caller.
|
||||
*
|
||||
* @see #sendDirectUpdatesToAnyShardReplica
|
||||
* @see #sendDirectUpdatesToShardLeadersOnly
|
||||
*/
|
||||
public static class CloudSolrClientBuilder extends CloudSolrClient.Builder {
|
||||
|
||||
private boolean configuredDUTflag = false;
|
||||
|
@ -2267,30 +2274,35 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
|
||||
*/
|
||||
public static CloudSolrClient getCloudSolrClient(String zkHost) {
|
||||
if (random().nextBoolean()) {
|
||||
return new CloudSolrClient(zkHost);
|
||||
}
|
||||
return new CloudSolrClientBuilder()
|
||||
.withZkHost(zkHost)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
|
||||
*/
|
||||
public static CloudSolrClient getCloudSolrClient(String zkHost, HttpClient httpClient) {
|
||||
if (random().nextBoolean()) {
|
||||
return new CloudSolrClient(zkHost, httpClient);
|
||||
}
|
||||
return new CloudSolrClientBuilder()
|
||||
.withZkHost(zkHost)
|
||||
.withHttpClient(httpClient)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
|
||||
*/
|
||||
public static CloudSolrClient getCloudSolrClient(String zkHost, boolean shardLeadersOnly) {
|
||||
if (random().nextBoolean()) {
|
||||
return new CloudSolrClient(zkHost, shardLeadersOnly);
|
||||
}
|
||||
|
||||
if (shardLeadersOnly) {
|
||||
return new CloudSolrClientBuilder()
|
||||
.withZkHost(zkHost)
|
||||
|
@ -2303,11 +2315,12 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.CloudSolrClient.Builder} class directly
|
||||
*/
|
||||
public static CloudSolrClient getCloudSolrClient(String zkHost, boolean shardLeadersOnly, HttpClient httpClient) {
|
||||
if (random().nextBoolean()) {
|
||||
return new CloudSolrClient(zkHost, shardLeadersOnly, httpClient);
|
||||
}
|
||||
|
||||
if (shardLeadersOnly) {
|
||||
return new CloudSolrClientBuilder()
|
||||
.withZkHost(zkHost)
|
||||
|
@ -2322,20 +2335,24 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Builder} class directly
|
||||
*/
|
||||
public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, int queueSize, int threadCount) {
|
||||
if (random().nextBoolean()) {
|
||||
return new ConcurrentUpdateSolrClient(baseSolrUrl, queueSize, threadCount);
|
||||
}
|
||||
return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl)
|
||||
.withQueueSize(queueSize)
|
||||
.withThreadCount(threadCount)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Builder} class directly
|
||||
*/
|
||||
public static ConcurrentUpdateSolrClient getConcurrentUpdateSolrClient(String baseSolrUrl, HttpClient httpClient, int queueSize, int threadCount) {
|
||||
if (random().nextBoolean()) {
|
||||
return new ConcurrentUpdateSolrClient(baseSolrUrl, httpClient, queueSize, threadCount);
|
||||
}
|
||||
return new ConcurrentUpdateSolrClient.Builder(baseSolrUrl)
|
||||
.withHttpClient(httpClient)
|
||||
.withQueueSize(queueSize)
|
||||
|
@ -2343,30 +2360,35 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.LBHttpSolrClient.Builder} class directly
|
||||
*/
|
||||
public static LBHttpSolrClient getLBHttpSolrClient(HttpClient client, String... solrUrls) {
|
||||
if (random().nextBoolean()) {
|
||||
return new LBHttpSolrClient(client, solrUrls);
|
||||
}
|
||||
|
||||
return new LBHttpSolrClient.Builder()
|
||||
.withHttpClient(client)
|
||||
.withBaseSolrUrls(solrUrls)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.LBHttpSolrClient.Builder} class directly
|
||||
*/
|
||||
public static LBHttpSolrClient getLBHttpSolrClient(String... solrUrls) throws MalformedURLException {
|
||||
if (random().nextBoolean()) {
|
||||
return new LBHttpSolrClient(solrUrls);
|
||||
}
|
||||
return new LBHttpSolrClient.Builder()
|
||||
.withBaseSolrUrls(solrUrls)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
|
||||
*/
|
||||
public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient, ResponseParser responseParser, boolean compression) {
|
||||
if(random().nextBoolean()) {
|
||||
return new HttpSolrClient(url, httpClient, responseParser, compression);
|
||||
}
|
||||
return new Builder(url)
|
||||
.withHttpClient(httpClient)
|
||||
.withResponseParser(responseParser)
|
||||
|
@ -2374,29 +2396,35 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
|
||||
*/
|
||||
public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient, ResponseParser responseParser) {
|
||||
if(random().nextBoolean()) {
|
||||
return new HttpSolrClient(url, httpClient, responseParser);
|
||||
}
|
||||
return new Builder(url)
|
||||
.withHttpClient(httpClient)
|
||||
.withResponseParser(responseParser)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
|
||||
*/
|
||||
public static HttpSolrClient getHttpSolrClient(String url, HttpClient httpClient) {
|
||||
if(random().nextBoolean()) {
|
||||
return new HttpSolrClient(url, httpClient);
|
||||
}
|
||||
return new Builder(url)
|
||||
.withHttpClient(httpClient)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method <i>may</i> randomize unspecified aspects of the resulting SolrClient.
|
||||
* Tests that do not wish to have any randomized behavior should use the
|
||||
* {@link org.apache.solr.client.solrj.impl.HttpSolrClient.Builder} class directly
|
||||
*/
|
||||
public static HttpSolrClient getHttpSolrClient(String url) {
|
||||
if(random().nextBoolean()) {
|
||||
return new HttpSolrClient(url);
|
||||
}
|
||||
return new Builder(url)
|
||||
.build();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue