The user who is searching is mainly interested in the search output/response. Rather than providing output in only a single format, if we allow them to select their choice of output/response format and return a response in that format, it will really make the user happy. The good news is that Solr provides various response writers for the end user's convenience.
Once the user runs a search, along with providing matching results, Solr provides a formatted and well-organized output result that becomes easy and attractive for the end user. Solr handles this through a response writer. Solr supports these response writers:
- JSON (default)
- Standard XML
- XSLT
- Binary
- GeoJSON
- Python
- PHP
- PHP serialized
- Ruby
- CSV
- Velocity
- Smile
- XLSX
We can select the response writer by providing an appropriate value to the wt parameter. These are the response writer values for wt:
Response writer | wt parameter value |
JSON |
json
|
Standard XML |
xml
|
XSLT |
xslt
|
Binary |
javabin
|
GeoJSON |
geojson
|
Python | python |
PHP | php |
PHP serialized | phps |
Ruby | ruby |
CSV | csv |
Velocity | velocity |
Smile | smile |
XLSX | xlsx |
Let's explore some of these response writers in detail.