godong9 / solr-node

Simple Solr Node Client Project.
MIT License
25 stars 25 forks source link

Provide option for specifying request method #85

Open bejohu opened 5 years ago

bejohu commented 5 years ago

When calling the client's search method a GET request is made. However, under certain circumstances POST request is required, e.g. when the request URI gets to long, solr will return error 414: URI too long. This can be avoided by sending the parameters in the body of a POT request.

The modified interface could look like this:

solrClient.search(strQuery, { method: 'POST' }, function (err, result) {
   if (err) {
      console.log(err);
      return;
   }
   console.log('Response:', result.response);
});
lvenier commented 5 years ago

Hi

let me try to clarify : what you mean is that you would like to have a GET Request with a JSON BODY as described here : https://lucene.apache.org/solr/guide/8_1/json-request-api.html

Is this correct ? I am not sure { method: 'POST' } is appropriate as this is still a GET. { parameters: 'URL' } or { parameters: 'JSON' }... ??

lvenier commented 5 years ago

@bejohu @godong9 : opinion?