please take a look at one of the updatehandlers which are already there XmlUpdateRequestHandler CSVRequestHandler BinaryUpdateRequestHandler
On Tue, Jun 16, 2009 at 1:34 PM, noor<noo...@opentechindia.com> wrote: > how to create a custom update handler, to update my fields... ? > Also, how to make the update, through url, i mean, > > http://localhost:8983/solr/update..../../ like that... ??? > > > > > noor wrote: >> >> Yes, i changed "custom" into "/custom", now it calls my class. >> But, in browser, It shows >> Null RequestHandler null. >> >> So, i need to accept my changes by solr. For that, what i need to do, >> pls guide me to acheive this. >> >> >> Noble Paul wrote: >>> >>> register is as follows >>> <requestHandler name="/custom" >>> class="org.apache.solr.my.MyCustomHandler"> >>> >>> the request must be made to the uri "/custom" only then the requests >>> would come to your handler >>> >>> On Sat, Jun 13, 2009 at 5:49 PM, noor<noo...@opentechindia.com> wrote: >>> >>>> >>>> Yes, i changed requestHandler name as, >>>> <requestHandler name="custom" >>>> class="org.apache.solr.my.MyCustomHandler"> >>>> ..... >>>> >>>> Then also, >>>> In statistics page, my custom handler under QueryHandler's request count >>>> remains 0. It shows that, the webrequest is not coming to my class.... >>>> >>>> Noble Paul wrote: >>>> >>>>> >>>>> register your handler in some other name and fire a request to that >>>>> >>>>> On Fri, Jun 12, 2009 at 8:07 PM, noor<noo...@opentechindia.com> wrote: >>>>> >>>>> >>>>>> >>>>>> I solved this NullPointerException, by the following changes. >>>>>> >>>>>> In java code: >>>>>> public void handleRequestBody(SolrQueryRequest request, >>>>>> SolrQueryResponse >>>>>> response) throws Exception { >>>>>> SolrCore coreToRequest = >>>>>> request.getCore();//coreContainer.getCore("core2"); >>>>>> ..... >>>>>> } >>>>>> >>>>>> and in solr-config.xml: >>>>>> <requestHandler name="/select" class="solr.my.MyCustomHandler"> >>>>>> <lst name="defaults"> >>>>>> <str name="echoParams">explicit</str> >>>>>> <str name="q">tandem</str> >>>>>> <str name="debugQuery">true</str> >>>>>> </lst> >>>>>> </requestHandler> >>>>>> >>>>>> Now, my webapp runs fine by, >>>>>> http://localhost:8983/mysearch >>>>>> searching also working fine. >>>>>> But, these are not run through my custom handler. So i felt, it >>>>>> wrongly >>>>>> doing searching. >>>>>> Because, in solr admin statistics page, >>>>>> my custom handler under QueryHandler's request count remains 0, it >>>>>> doesn't >>>>>> get incremented, when i search something. Rather, >>>>>> statndardReqHandler's >>>>>> request count is incremented. >>>>>> >>>>>> And another thing, how do we debug solr. ??? >>>>>> Please anybody help me to solve this ... >>>>>> >>>>>> Thanks in advance. >>>>>> >>>>>> Noble Paul ??????? ?????? wrote: >>>>>> >>>>>> >>>>>>> >>>>>>> is there any error on the console? >>>>>>> >>>>>>> On Fri, Jun 12, 2009 at 4:26 PM, Noor<noo...@opentechindia.com> >>>>>>> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> hi, >>>>>>>> i am new to apache solr. >>>>>>>> I need to create a custom request handler class. So i create a new >>>>>>>> one >>>>>>>> and >>>>>>>> changed the solr-config.xml file as, >>>>>>>> <requestHandler name="/select" class="solr.my.MyCustomHandler"> >>>>>>>> <lst name="defaults"> >>>>>>>> <str name="echoParams">explicit</str> >>>>>>>> <str name="q">tandem</str> >>>>>>>> <str name="debugQuery">true</str> >>>>>>>> </lst> >>>>>>>> </requestHandler> >>>>>>>> >>>>>>>> And in my java class, the code is, >>>>>>>> >>>>>>>> public class MyCustomHandler extends RequestHandlerBase{ >>>>>>>> public CoreContainer coreContainer; >>>>>>>> public void handleRequestBody(SolrQueryRequest request, >>>>>>>> SolrQueryResponse >>>>>>>> response) throws Exception { >>>>>>>> SolrCore coreToRequest = coreContainer.getCore("core2"); >>>>>>>> ModifiableSolrParams params = new ModifiableSolrParams(); >>>>>>>> params.set("echoParams", "explicit"); >>>>>>>> params.set("q", "text"); >>>>>>>> params.set("debugQuery", "true"); >>>>>>>> request = new LocalSolrQueryRequest(coreToRequest, params); >>>>>>>> // SolrRequestHandler reqHandler = >>>>>>>> coreToRequest.getRequestHandler("/select"); >>>>>>>> coreToRequest.execute(reqHandler, request, response); >>>>>>>> coreToRequest.close(); >>>>>>>> request.close(); >>>>>>>> } >>>>>>>> // the abstract methods - getDescription(), getSourceId(), >>>>>>>> getSource(), >>>>>>>> getVersion() are //overrided... but these methods doesn't have any >>>>>>>> implementations. >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> But, if i search any text in my webapp from browser, gots the HTTP >>>>>>>> 500 >>>>>>>> error. >>>>>>>> i dont know how SolrContainer is intialized.... >>>>>>>> Pls anyone give me the solution... >>>>>>>> >>>>>>>> thanks and regards, >>>>>>>> Mohamed >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >>> >>> >> >> > > -- ----------------------------------------------------- Noble Paul | Principal Engineer| AOL | http://aol.com