gerlowskija commented on PR #2079:
URL: https://github.com/apache/solr/pull/2079#issuecomment-1817197921

   Progress!  I was able to make some tweaks to the Java interfaces the 
generate the OAS and clients so that users can specify their query JSON a few 
different ways in the generated clients.  Things mostly "just worked" in JS 
with the generated Java code needing a good bit more massaging to get working.  
I also caught a few bugs in the process, so it was a nice diversion to take.
   
   With the most recent changes client usage now looks like:
   
   **Javascript w/ String-JSON**
   
   ```
   var queryingApi = new V2Api.QueryingApi();
   var opts = {
       'body': "{\"query\":\"*:*\"}"
   }
   queryingApi.jsonQuery("collections", "techproducts", opts, (error, data, 
response) => {
     ....handle the response...
   });
   ```
   
   **Javascript w/ Typed-JSON**
   
   ```
   var queryingApi = new V2Api.QueryingApi();
   var opts = {
       'body': {"query": "*:*"}
   }
   queryingApi.jsonQuery("collections", "techproducts", opts, (error, data, 
response) => {
     ....handle the response...
   });
   ```
   
   **Java w/ String-JSON**
   
   ```
   final var rawRequest = new QueryingApi.JsonQuery(StoreType.COLLECTION, 
"techproducts", "{\"query\": \"*:*\"}");
   final var rawRequestResponse = rawRequest.process(client).getParsed();
   System.out.println("Response status was: " + 
rawRequestResponse.responseHeader.status);
   ```
   
   **Java w/ Typed-JSON** (used a map here, but any Jackson-serializable object 
will work)
   
   ```
   final var typedRequest = new QueryingApi.JsonQuery(StoreType.COLLECTION, 
"techproducts", Map.of("query", "*:*"));
   final var typedRequestResponse = typedRequest.process(client).getParsed();
   System.out.println("Response status was: " + 
typedRequestResponse.responseHeader.status);
   ```


-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to