Toco
Toco

Reputation: 104

How to send a Solr spatial query using JSON request API

What is the equivalent JSON request for querying a spatial location field in Apache Solr to:

&fq={!bbox sfield=locfield}&pt=45.15,-93.85&d=5

Upvotes: 1

Views: 233

Answers (1)

EricLavault
EricLavault

Reputation: 16055

You can use a params block.

Parameters placed in a params block act as if they were added verbatim to the query-parameters of the request.

For example using curl :

curl "http://hostname:8983/solr/corename/query?" -d '
{
  params: {
    q: "*:*",
    fq: "{!bbox sfield=locfield}",
    pt: "45.15,-93.85",
    d: "5"
  }
}'

@see JSON Request API Supported Properties and Syntax

Upvotes: 1

Related Questions