You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2007/07/03 18:11:22 UTC

[Solr Wiki] Update of "QueryResponseWriter" by HossMan

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by HossMan:
http://wiki.apache.org/solr/QueryResponseWriter

New page:
= QueryResponseWriter =



A [http://lucene.apache.org/solr/api/org/apache/solr/request/QueryResponseWriter.html QueryResponseWriter] is a !SolrPlugin that defines the response format for any request.  Multiple writers (including multiple instances of the same !QueryResponseWriter class with different configurations) can be specified in the [wiki:SolrConfigXml solrconfig.xml]

{{{
    <queryResponseWriter name="foo" default="true" class="my.package.CustomResponseWriter"/>
    <queryResponseWriter name="bar" class="my.package.AnotherCustomResponseWriter"/>
    <queryResponseWriter name="blat" class="my.package.AnotherCustomResponseWriter">
      <int name="some_init_param">5</int>
    </queryResponseWriter> 
}}}

== Handler Resolution ==

Clients access specific !QueryResponseWriters using the [http://wiki.apache.org/solr/CoreQueryParameters 'wt' parameter]   For the above example, running on localhost:8983/solr/, you could access:

{{{
  http://localhost:8983/solr/select/?wt=foo&q=solr
  http://localhost:8983/solr/select/?wt=bar&q=solr
  http://localhost:8983/solr/select/?wt=blat&q=solr
  http://localhost:8983/solr/select/?q=solr
}}}

Solr selects a handler to process a request using the following steps...

   1. look for a writer with a name matching the "wt"
   1. look for a writer configured with {{{default="true"}}}
   1. look for a writer configured with name="standard"
   1. use an anonymous instance of [wiki:XMLResponseFormat XmlResponseWriter]