HTTP API

For the generation of image descriptors via HTTP requests a specific endpoint can be configured by adding a request handler to the 'solrconfig.xml'.

If Solr is running in cloud mode the request load will automaticly distributed on all shards. The request handler is able to process one image per request. To speed up the generation of image descriptors you can send multiple requests in parallel. Different response formats are supported and can be set via the Solr parameter wt (e.g. JSON, XML, Python, PHP).

Configuration

The configuration of the request handler is straightforward as shown below. Just add DescriptorHandler class as request handler to the solrconfig.xml:

<requestHandler name="/descriptor" class="de.pixolution.solr.handler.component.DescriptorHandler" />

Parameters

The DescriptorHandlersupports the following HTTP GET parameters.

descriptor.src

Necessity:mandatory
Value:URL

The descriptor.src parameter contains the URL of the image which image descriptor should be generated. Valid protocols in this URL are HTTPS, HTTP and FILE. The URL must be RFC2396 compliant and point to a valid accessible image ressource, otherwise an error will be returned.

descriptor.legacy

Necessity:optional
Value:true | false
Default:false

Set this parameter to true if the returned image descriptor should be in the legacy format of pixolution flow 2.x (see Legacy Mode).

debug

Necessity:optional
Value:true | false
Default:false

This default Solr parameter can be used to retrieve additional information about the time needed to download and analyze images and the Solr shard which did the work.

Example

An example request to the HTTP API done with curl:

curl "http://127.0.0.1:45675/solr/testcollection/descriptor?descriptor.src=http://mydomain.com/testimage.jpg&wt=json&indent=true"

And this could be the response formatted in JSON:

{
  "responseHeader":{
      "zkConnected":true,
          "status":0,
          "QTime":459},
      "response":{
          "numFound":0,
          "start":0,
          "docs":[]},
      "descriptorlist":[
          "http://mydomain.com/testimage.jpg","gCBWMjkpEOYo7O3a+AY0NwoZI7/4BCbqHAwDIw/44wMMHiUHAQAcDfEK/PT+HgUKGgEQFfz09wYD9gkEHfUE/4AA2fWSo7C0lJKR7o6MnrudnZ3AgBDzCP0LAvn2//3n/QftAgWPkbnC37yfp9HusaStmKe5nIAxAACAQGsfTF0TEXgDHnl7dCJyCi8="]
}