mcacorner
mcacorner

Reputation: 1274

Solr : Make XML as response in Solr 4.8.1

I am using solr 4.8.1.
When I execute any query for testing purpose from Dashboard I get response in JSON(BY DEFAULT)
Can I change it and make XML as default.
Plz refer below screen. I am taking about dashboard only.
enter image description here
Thanks for looking here.... :)

Upvotes: 1

Views: 216

Answers (2)

Cipous
Cipous

Reputation: 992

I dont know if there is administration for web UI defaults, but you can change html easily:

in

solr-4.8.1\example\solr-webapp\webapp\tpl\query.html

change order of options

<select name="wt" id="wt" title="The writer type (response format).">
      <option>xml</option>
      <option>json</option>
      <option>python</option>
      <option>ruby</option>
      <option>php</option>
      <option>csv</option>
</select>

Whatever option you put on first will be default, or set it selected:

<option selected="selected">

You may also change this html in war file in solr-4.8.1\example\webapps.

Note that path is relative to example from 4.8.1 release

Upvotes: 1

MatsLindh
MatsLindh

Reputation: 52930

The default values for your requestHandlers (which is what responds when a query is sent to /query or /select etc.), is set in solrconfig.xml. Here's the example from example/solr in the distribution:

<!-- A request handler that returns indented JSON by default -->
<requestHandler name="/query" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="echoParams">explicit</str>
        <str name="wt">json</str>
        <str name="indent">true</str>
        <str name="df">text</str>
    </lst>
</requestHandler>

Changing wt to xml will give you a requestHandler that returns it response as XML by default, unless overridden at query time with the wt parameter. There might be parts of the web interface that assumes the response will be json, but I'm pretty sure those supply a value for wt anyway.

Upvotes: 2

Related Questions