@@ -68,12 +68,8 @@ public void testUpdateViaV2Api() throws Exception {
6868 "[{\" id\" :\" v2update1\" ,\" title\" :\" V2 update test\" }]" , "application/json" ));
6969 client .request (addReq );
7070
71- // Commit via V2 update endpoint
72- final GenericV2SolrRequest commitReq =
73- new GenericV2SolrRequest (SolrRequest .METHOD .POST , "/cores/" + CORE_NAME + "/update" );
74- commitReq .setContentWriter (
75- new RequestWriter .StringPayloadContentWriter ("{\" commit\" :{}}" , "application/json" ));
76- client .request (commitReq );
71+ // Commit via standard SolrJ commit (v2 /update is docs-only and does not support commands)
72+ client .commit (CORE_NAME );
7773
7874 // Verify the document was indexed
7975 final ModifiableSolrParams queryParams = new ModifiableSolrParams ();
@@ -94,12 +90,8 @@ public void testUpdateJsonViaV2Api() throws Exception {
9490 "[{\" id\" :\" v2updatejson1\" ,\" title\" :\" V2 update/json test\" }]" , "application/json" ));
9591 client .request (addReq );
9692
97- // Commit
98- final GenericV2SolrRequest commitReq =
99- new GenericV2SolrRequest (SolrRequest .METHOD .POST , "/cores/" + CORE_NAME + "/update" );
100- commitReq .setContentWriter (
101- new RequestWriter .StringPayloadContentWriter ("{\" commit\" :{}}" , "application/json" ));
102- client .request (commitReq );
93+ // Commit via standard SolrJ commit (v2 /update is docs-only and does not support commands)
94+ client .commit (CORE_NAME );
10395
10496 // Verify
10597 final ModifiableSolrParams queryParams = new ModifiableSolrParams ();
@@ -122,12 +114,8 @@ public void testUpdateXmlViaV2Api() throws Exception {
122114 "application/xml" ));
123115 client .request (addReq );
124116
125- // Commit
126- final GenericV2SolrRequest commitReq =
127- new GenericV2SolrRequest (SolrRequest .METHOD .POST , "/cores/" + CORE_NAME + "/update" );
128- commitReq .setContentWriter (
129- new RequestWriter .StringPayloadContentWriter ("{\" commit\" :{}}" , "application/json" ));
130- client .request (commitReq );
117+ // Commit via standard SolrJ commit (v2 /update is docs-only and does not support commands)
118+ client .commit (CORE_NAME );
131119
132120 // Verify
133121 final ModifiableSolrParams queryParams = new ModifiableSolrParams ();
0 commit comments