/** * Returns the {@link SolrRequestHandler} associated with the given name. * * @param request the current Solr request. * @param name the {@link SolrRequestHandler} name. * @return the {@link SolrRequestHandler} associated with the given name. */ SolrRequestHandler requestHandler(final SolrQueryRequest request, final String name) { return request.getCore().getRequestHandler(name); }
if( core.getRequestHandler( path+handler.name ) == null ) { handler.handler.init( initArgs ); core.registerRequestHandler( path+handler.name, handler.handler );
/** * @deprecated Use {@link #execute(SolrRequestHandler, SolrQueryRequest, SolrQueryResponse)} instead. */ @Deprecated public void execute(SolrQueryRequest req, SolrQueryResponse rsp) { SolrRequestHandler handler = getRequestHandler(req.getQueryType()); if (handler==null) { log.warn(logid+"Unknown Request Handler '" + req.getQueryType() +"' :" + req); throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + req.getQueryType() + "'", true); } execute(handler, req, rsp); }
if( core.getRequestHandler( path+handler.name ) == null ) { handler.handler.init( initArgs ); core.registerRequestHandler( path+handler.name, handler.handler );
public SolrQueryResponse queryAndResponse(String handler, SolrQueryRequest req) throws Exception { SolrQueryResponse rsp = new SolrQueryResponse(); core.execute(core.getRequestHandler(handler),req,rsp); if (rsp.getException() != null) { throw rsp.getException(); } return rsp; }
"solrconfig.xml uses deprecated <admin/gettableFiles>, Please "+ "update your config to use the ShowFileRequestHandler." ); if( getRequestHandler( "/admin/file" ) == null ) { NamedList<String> invariants = new NamedList<String>();
/** * Forwards the control to the appropriate {@link RequestHandlerBase}. * * @param request the current Solr query request. * @param response the current Solr query response. * @param requestHandlerName the target requestHandler name. * @param defaultRequestHandlerName the default request handler name (in case of absence of the preceding handler). */ void forward(final SolrQueryRequest request, final SolrQueryResponse response, final String requestHandlerName, final String defaultRequestHandlerName) { request.getCore() .getRequestHandler( request.getParams().get(requestHandlerName, defaultRequestHandlerName)) .handleRequest(request, response); } }
/** It is the users responsibility to close the request object when done with it. * This method does not set/clear SolrRequestInfo */ public SolrQueryResponse queryAndResponse(String handler, SolrQueryRequest req) throws Exception { try (SolrCore core = getCoreInc()) { SolrQueryResponse rsp = new SolrQueryResponse(); core.execute(core.getRequestHandler(handler), req, rsp); if (rsp.getException() != null) { throw rsp.getException(); } return rsp; } }
SolrRequestHandler handler = core.getRequestHandler( path ); if( handler == null ) { if( "/select".equals( path ) || "/select/".equalsIgnoreCase( path) ) { String qt = params.get( CommonParams.QT ); handler = core.getRequestHandler( qt ); if( handler == null ) { throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+qt);
/** * Processes an "update" (add, commit or optimize) and * returns the response as a String. * * @param xml The XML of the update * @return The XML response to the update */ public String update(String xml) { try (SolrCore core = getCoreInc()) { DirectSolrConnection connection = new DirectSolrConnection(core); SolrRequestHandler handler = core.getRequestHandler("/update"); // prefer the handler mapped to /update, but use our generic backup handler // if that lookup fails if (handler == null) { handler = updater; } return connection.request(handler, null, xml); } catch (SolrException e) { throw (SolrException)e; } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); } }
SolrQueryResponse rsp = new SolrQueryResponse(); SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp)); core.execute(core.getRequestHandler(handler),req,rsp); if (rsp.getException() != null) { throw rsp.getException();
private void getMoreTerms() { SolrRequestHandler termsHandler = xqueryComponent.getCore().getRequestHandler("/terms"); if (termsHandler == null) { LoggerFactory.getLogger(getClass()).error("No /terms handler configured; lux:field-terms giving up"); return; } ModifiableSolrParams params = new ModifiableSolrParams(); params.add(TermsParams.TERMS_FIELD, term.field()); if (current != null) { params.add(TermsParams.TERMS_LOWER, current); params.add(TermsParams.TERMS_LOWER_INCLUSIVE, "false"); offset = pos; } else { pos = 0; params.add(TermsParams.TERMS_LOWER, term.text()); } params.add(TermsParams.TERMS_SORT, TermsParams.TERMS_SORT_INDEX); params.add(TermsParams.TERMS_LIMIT, Integer.toString(100)); params.add("distrib", "true"); xqueryComponent.getCurrentShards(); params.add(ShardParams.SHARDS, StringUtils.join(xqueryComponent.getCurrentShards(), ",")); params.add(ShardParams.SHARDS_QT, "/terms"); // this gets passed to the shards to tell them what the request is SolrQueryRequest req = new CloudQueryRequest(xqueryComponent.getCore(), params, null); response = new SolrQueryResponse(); termsHandler.handleRequest(req, response); }
SolrRequestHandler handler = core.getRequestHandler( qt ); if( handler == null ) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
private String sendUpdateRequest(String input) { try (SolrCore core = h.getCoreInc()) { DirectSolrConnection connection = new DirectSolrConnection(core); SolrRequestHandler handler = core.getRequestHandler(HANDLER_NAME); return connection.request(handler, null, input); } catch (SolrException e) { throw e; } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); } }
SolrRequestHandler handler = core.getRequestHandler( path ); if( handler == null ) { if( "/select".equals( path ) || "/select/".equalsIgnoreCase( path) ) { String qt = params.get( CommonParams.QT ); handler = core.getRequestHandler( qt ); if( handler == null ) { throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+qt);
core.execute(core.getRequestHandler(req.getParams().get(CommonParams.QT)), req, rsp);
/** * @see org.opencms.search.CmsSearchIndex#createIndexBackup() */ @Override protected String createIndexBackup() { if (!isBackupReindexing()) { // if no backup is generated we don't need to do anything return null; } if (m_solr instanceof EmbeddedSolrServer) { EmbeddedSolrServer ser = (EmbeddedSolrServer)m_solr; CoreContainer con = ser.getCoreContainer(); SolrCore core = con.getCore(getCoreName()); if (core != null) { try { SolrRequestHandler h = core.getRequestHandler("/replication"); if (h instanceof ReplicationHandler) { h.handleRequest( new LocalSolrQueryRequest(core, CmsRequestUtil.createParameterMap("?command=backup")), new SolrQueryResponse()); } } finally { core.close(); } } } return null; }
/** Send JSON update commands */ public static String updateJ(String json, SolrParams args) throws Exception { SolrCore core = h.getCore(); if (args == null) { args = params("wt","json","indent","true"); } else { ModifiableSolrParams newArgs = new ModifiableSolrParams(args); if (newArgs.get("wt") == null) newArgs.set("wt","json"); if (newArgs.get("indent") == null) newArgs.set("indent","true"); args = newArgs; } DirectSolrConnection connection = new DirectSolrConnection(core); SolrRequestHandler handler = core.getRequestHandler("/update/json"); if (handler == null) { handler = new UpdateRequestHandler(); handler.init(null); } return connection.request(handler, args, json); }
try { SolrRequestHandler handler = core.getRequestHandler(solrReq.getQueryType()); if (handler==null) { log.warn("Unknown Request Handler '" + solrReq.getQueryType() +"' :" + solrReq);
SolrRequestHandler handler = core.getRequestHandler(path); String qt = request.getResourceRef().getQueryAsForm() .getFirstValue(CommonParams.QT); handler = core.getRequestHandler(qt); if (handler == null) { response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST,