Hi again,

Thanx for the help :)

I have this handler:

public class SynonymsHandler extends RequestHandlerBase implements
SolrCoreAware {

public SynonymsHandler() {}

private static Logger log = LoggerFactory.getLogger(SynonymsHandler.class);

@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
throws Exception {
 System.out.println(req.getContext());
if (req.getContext().get("path").equals("/synonyms/update")) {}
 if (req.getContext().get("path").equals("/synonyms/get")) {}
req.getCore().reload(req.getCore());
 }

@Override
public String getDescription() {
 return null;
}

@Override
public String getSource() {
 return null;
}

@Override
public void inform(SolrCore core) {}

}

and when i call the reload I get this error:

63748 T33 C6 oasc.SolrException.log ERROR java.lang.NullPointerException
at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:181)
 at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1904)
 at
org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:64)
at org.apache.solr.core.SolrCore$5.call(SolrCore.java:1693)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:724)

here

ShardHandler shardHandler1 = shardHandlerFactory.getShardHandler();

the factory is null... how can I get it to initialize? I checked on the
CoreAdminHandler that I have to do something on the inform like you said
but I am not sure what... the inform is recursive right? Could I try to
execute the CoreAdminHandler from within my Handler with the reload action?
I am not sure what is the best practice

Regards
Bruno


On Fri, Aug 23, 2013 at 11:20 AM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

> I don't think that should be a problem. Your custom RequestHandler
> must call "reload". Note that a new instance of your request handler
> will be created and inform will be called on it once reload happens
> i.e. you won't be able to keep any state in the request handler across
> core reloads.
>
> You can also do this at a level above RequestHandler i.e. via a custom
> CoreAdminHandler. See CoreAdminHandler.handleCustomAction()
>
> On Fri, Aug 23, 2013 at 2:57 PM, Bruno René Santos <brunor...@gmail.com>
> wrote:
> > Great! What about inside a RequestHandler source code in Java? I want to
> > create a requestHandler that receives new synonyms, insert them on the
> > synonyms file and reload the core.
> >
> > Regards
> > Bruno
> >
> >
> > On Fri, Aug 23, 2013 at 9:28 AM, Shalin Shekhar Mangar <
> > shalinman...@gmail.com> wrote:
> >
> >> Yes, you can use the Core RELOAD command:
> >>
> >>
> >>
> https://cwiki.apache.org/confluence/display/solr/CoreAdminHandler+Parameters+and+Usage#CoreAdminHandlerParametersandUsage-%7B%7BRELOAD%7D%7D
> >>
> >> On Fri, Aug 23, 2013 at 1:51 PM, Bruno René Santos <brunor...@gmail.com
> >
> >> wrote:
> >> > Hello,
> >> >
> >> > Is it possible to reload the synonyms and stopwords files without
> >> rebooting
> >> > solr?
> >> >
> >> > Regards
> >> > Bruno Santos
> >> >
> >> > --
> >> > Bruno René Santos
> >> > Lisboa - Portugal
> >>
> >>
> >>
> >> --
> >> Regards,
> >> Shalin Shekhar Mangar.
> >>
> >
> >
> >
> > --
> > Bruno René Santos
> > Lisboa - Portugal
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
Bruno René Santos
Lisboa - Portugal

Reply via email to