HTML Response Writer

Image search results are hard to evaluate when they are only available in JSON or XML. The HtmlResponseWriter provides an easy and fast way of inspecting visual search results without the need of building a frontend first. The response writer returns HTML formatted responses, visualizing the query parameters and result images as floating list.

The HtmlResponseWriter must be configured in the solrconfig.xml:

<queryResponseWriter name="html" default="false" class="de.pixolution.solr.response.HtmlResponseWriter" >
  <str name="response.image.url.fieldname">path</str>    
  <str name="response.image.prefix">http://myserver.com/</str>
  <str name="response.image.postfix"></str>
  <str name="response.keywords.fieldname">keywords</str>
</queryResponseWriter>

response.image.url.fieldname

Mandatory parameter defining the fieldname for a field which stores the URL of the corresponding image. This field must be configured stored=true. If you only store relative paths in the index, the values of this field can be decorated with static pre- and postfixes, so that an image URL would consist of URL = prefix + value + postfix. Please see response.image.prefix and response.image.postfix for more details.

response.image.prefix

Optional parameter. If set, the given string will always be prepended to the value of the response.image.url.fieldname. This is useful if the response.image.url.fieldname only stores a relative path to the image (e.g. contextpath/to/image.jpg), so that response.image.prefix should contain the base URL (e.g. http://server.com/). The resulting image URL would be http://server.com/contextpath/to/image.jpg.

response.image.postfix

Optional parameter, that is almost identical to the response.image.prefix parameter, but instead of prepending the string to the value of response.image.url.fieldname, it will be appended.

response.keywords.fieldname

Optional parameter defining a text field that should be added as image hint in the resulting HTML response (for example the keywords of the image). The referenced field must be configured stored=true.

In order to retrieve HTML formatted responses just set the query parameter wt to the configured name of the HtmlResponseWriter (e.g. wt=html). The result can be viewed directly within your browser.

Example search for all images formatting the response as HTML:

&q=*:*&wt=html

Please note, that the HtmlResponseWriter is designed for fast image search tests and should not be used in a production environment. It is not a substitute of a real HTML frontend.