You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Zheng Lin Edwin Yeo <ed...@gmail.com> on 2018/08/02 15:29:20 UTC

Converting curl request to HTTP URL for Tagger Handler

Hi,

I am building up my application using the Tagger Handler in Solr 7.4.0. For
the example in the Solr Reference Guide, the query request are done using
curl.

However, for the actual tagging query, I will need to run it in the HTTP
URL in my application.
This is the curl query:

curl -X POST \
  'http://localhost:8983/solr/geonames/tag?overlaps=NO_SUB&tagsLimit=5000&fl=id,name,countrycode&wt=json&indent=on'
\
  -H 'Content-Type:text/plain' -d 'Hello New York City'


I could not find a way to get this to work in HTTP URL. I will get this
error when I tried, which is likely due to the URL is not able to detect
the text 'Hello New York City'.

{

  "responseHeader":{
    "status":400,
    "QTime":0},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"TaggerRequestHandler requires text to be POSTed to it",
    "code":400}}


Regards,
Edwin

Re: Converting curl request to HTTP URL for Tagger Handler

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
The error message tells you the issue. You need to POST to the URL,
not GET. Check the library you are using and see if you can specify a
method there. Most of the libraries do.

Regards,
   Alex.

On 2 August 2018 at 11:29, Zheng Lin Edwin Yeo <ed...@gmail.com> wrote:
> Hi,
>
> I am building up my application using the Tagger Handler in Solr 7.4.0. For
> the example in the Solr Reference Guide, the query request are done using
> curl.
>
> However, for the actual tagging query, I will need to run it in the HTTP
> URL in my application.
> This is the curl query:
>
> curl -X POST \
>   'http://localhost:8983/solr/geonames/tag?overlaps=NO_SUB&tagsLimit=5000&fl=id,name,countrycode&wt=json&indent=on'
> \
>   -H 'Content-Type:text/plain' -d 'Hello New York City'
>
>
> I could not find a way to get this to work in HTTP URL. I will get this
> error when I tried, which is likely due to the URL is not able to detect
> the text 'Hello New York City'.
>
> {
>
>   "responseHeader":{
>     "status":400,
>     "QTime":0},
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.common.SolrException",
>       "root-error-class","org.apache.solr.common.SolrException"],
>     "msg":"TaggerRequestHandler requires text to be POSTed to it",
>     "code":400}}
>
>
> Regards,
> Edwin