Reputation: 1666
Well , I want to write custom request handler. So I thought of reviewing code of 'standard request handler' come with solr. Where can I find source code of handler. i didn't find it in my solr directory.
Upvotes: 1
Views: 1929
Reputation: 3791
In order to create and use a custom request handler in solr you need to:
SearchHandler
and handles the custom logic.solrconfig.xml
to add en endpoint that uses the custom request handler.public class MyCustomRequestHandler extends SearchHandler {
@Override
public void handleRequestBody(SolrQueryRequest solrRequest,
SolrQueryResponse solrResponse) throws Exception {
/// modify solr request object
// let solr handle the modified request
super.handleRequestBody(solrRequest, solrResponse);
// optionally modify solr response object
}
}
<requestHandler name="/custom_endpoint"
class="org.example.MyCustomRequestHandler" default="true">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="wt">json</str>
<str name="defType">edismax</str>
... rest of configuration
</lst>
</requestHandler>
Upvotes: 2
Reputation: 22555
You can view the source code of the StandardRequestHandler from this link. The entire tree of the source code can be accessed in readonly view via http://svn.apache.org/viewvc/lucene/dev/
I would encourage you to check out the RequestHandler documentation on the Solr Wiki as well for reference and guidance.
Upvotes: 1