lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noor <noo...@opentechindia.com>
Subject Re: Custom Request handler Error:
Date Mon, 15 Jun 2009 12:07:20 GMT
I want Solr, to accept my custom class changes and run it.
So for this, pls anyone guide me ....to achieve this..

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<noor.m@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<noor.m@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<noor.m@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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>             
>>>>>>
>>>>>>           
>>>>>         
>>>>
>>>>
>>>>       
>>>     
>>
>>
>>
>>   
>
>


Mime
View raw message