bruno-roustant commented on code in PR #4064:
URL: https://github.com/apache/solr/pull/4064#discussion_r2717470218
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java:
##########
@@ -460,10 +484,12 @@ public UpdateResponse commit() throws
SolrServerException, IOException {
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*/
+ @Deprecated(since = "10.1")
public UpdateResponse commit(String collection, boolean waitFlush, boolean
waitSearcher)
throws SolrServerException, IOException {
return new UpdateRequest()
- .setAction(UpdateRequest.ACTION.COMMIT, waitFlush, waitSearcher)
+ .setAction(
Review Comment:
Can we call commit(String, CommitOptions) here? I think it will help readers
understand the new way given this method becomes deprecated.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/request/AbstractUpdateRequest.java:
##########
@@ -35,21 +35,64 @@ public AbstractUpdateRequest(METHOD m, String path) {
super(m, path, SolrRequestType.UPDATE);
}
- /** Sets appropriate parameters for the given ACTION */
+ /**
+ * Sets appropriate parameters for the given ACTION using CommitOptions.
This is the preferred
+ * method for setting commit/optimize actions.
+ *
+ * @param action the action to perform (COMMIT or OPTIMIZE)
+ * @param options the commit options specifying behavior
+ * @return this request for method chaining
+ */
+ public AbstractUpdateRequest setAction(ACTION action, CommitOptions options)
{
+ if (action == ACTION.OPTIMIZE) {
+ params.set(UpdateParams.OPTIMIZE, "true");
+ params.set(UpdateParams.MAX_OPTIMIZE_SEGMENTS,
options.getMaxOptimizeSegments());
+ } else if (action == ACTION.COMMIT) {
+ params.set(UpdateParams.COMMIT, "true");
+ params.set(UpdateParams.SOFT_COMMIT,
String.valueOf(options.getSoftCommit()));
+ }
+ params.set(UpdateParams.WAIT_SEARCHER,
String.valueOf(options.getWaitSearcher()));
+ params.set(UpdateParams.OPEN_SEARCHER,
String.valueOf(options.getOpenSearcher()));
+ params.set(UpdateParams.EXPUNGE_DELETES,
String.valueOf(options.getExpungeDeletes()));
+ return this;
+ }
+
+ /**
+ * Sets appropriate parameters for the given ACTION
+ *
+ * @deprecated Use {@link #setAction(ACTION, CommitOptions)} instead. The
waitFlush parameter is
+ * ignored.
+ */
+ @Deprecated(since = "10.0")
Review Comment:
10.1 ?
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClient.java:
##########
@@ -507,11 +534,14 @@ public UpdateResponse commit(boolean waitFlush, boolean
waitSearcher)
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*/
+ @Deprecated(since = "10.1")
public UpdateResponse commit(
String collection, boolean waitFlush, boolean waitSearcher, boolean
softCommit)
throws SolrServerException, IOException {
return new UpdateRequest()
- .setAction(UpdateRequest.ACTION.COMMIT, waitFlush, waitSearcher,
softCommit)
+ .setAction(
Review Comment:
Can we call commit(String, CommitOptions) here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]