Sure -

import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.handler.RequestHandlerBase;

public class FlaxTestHandler extends RequestHandlerBase {

    public FlaxTestHandler() { }

    public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse
rsp)
        throws Exception
    {
        rsp.add("FlaxTest", "Hello!");
    }

    public String getDescription() { return "Flax"; }
    public String getSourceId() { return "Flax"; }
    public String getSource() { return "Flax"; }
    public String getVersion() { return "Flax"; }

}



On 10 August 2011 16:43, simon <mtnes...@gmail.com> wrote:

> Th attachment isn't showing up (in gmail, at least). Can you inline
> the relevant bits of code ?
>
> On Wed, Aug 10, 2011 at 11:05 AM, Tom Mortimer <t...@flax.co.uk> wrote:
> > Hi,
> > Apologies if this is really basic. I'm trying to learn how to create a
> > custom request handler, so I wrote the minimal class (attached), compiled
> > and jar'd it, and placed it in example/lib. I added this to
> solrconfig.xml:
> >     <requestHandler name="/flaxtest" class="FlaxTestHandler" />
> > When I started Solr with java -jar start.jar, I got this:
> >     ...
> >     SEVERE: java.lang.NoClassDefFoundError:
> > org/apache/solr/handler/RequestHandlerBase
> > at java.lang.ClassLoader.defineClass1(Native Method)
> >         ...
> > So I copied all the dist/*.jar files into lib and tried again. This time
> it
> > seemed to start ok, but browsing to http://localhost:8983/solr/displayed
> > this:
> >     org.apache.solr.common.SolrException: Error Instantiating Request
> > Handler, FlaxTestHandler is not a
> org.apache.solr.request.SolrRequestHandler
> >
> >       at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:410)
> ...
> >
> > Any ideas?
> > thanks,
> > Tom
> >
>

Reply via email to