@Override public void close() { request.close(); }
@Override public void close() { request.close(); }
/*** public static void clearNCache() { SolrQueryRequest req = req(); req.getSearcher().getnCache().clear(); // OFF-HEAP req.close(); }***/ public static void clearQueryCache() { SolrQueryRequest req = req(); req.getSearcher(); req.close(); }
/** * Processes a "query" using a user constructed SolrQueryRequest * * @param handler the name of the request handler to process the request * @param req the Query to process, will be closed. * @return The XML response to the query * @exception Exception any exception in the response. * @exception IOException if there is a problem writing the XML * @see LocalSolrQueryRequest */ public String query(String handler, SolrQueryRequest req) throws IOException, Exception { SolrQueryResponse rsp = queryAndResponse(handler, req); StringWriter sw = new StringWriter(32000); QueryResponseWriter responseWriter = core.getQueryResponseWriter(req); responseWriter.write(sw,req,rsp); req.close(); return sw.toString(); }
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"internal server error", e); } finally { req.close();
public SolrQueryResponse handleSuggestionResponseRequest(ReSearcherRequestContext ctx, ModifiableSolrParams params, String componentName, List<SearchComponent> components) throws Exception { params.set(componentName, "false"); SolrQueryRequest req = new SolrQueryRequestBase(ctx.getCore(), params) {}; SolrQueryResponse rsp = new SolrQueryResponse(); ResponseBuilder rb = new ResponseBuilder(req, rsp, components); try { handleSuggestionRequest(ctx, rb, components, false); } finally { req.close(); } return rsp; }
} finally { if (req != null) { req.close();
req.close(); SolrRequestInfo.clearRequestInfo();
public SolrQueryResponse handleSuggestionResponseRequest(ReSearcherRequestContext ctx, String query, String componentName, ResponseBuilder originalRb) throws Exception { ModifiableSolrParams newParams = new ModifiableSolrParams(originalRb.req.getParams()); newParams.set(CommonParams.Q, query); newParams.set(componentName, "false"); SolrQueryRequest req = new SolrQueryRequestBase(ctx.getCore(), newParams) {}; SolrQueryResponse rsp = new SolrQueryResponse(); ResponseBuilder rb = new ResponseBuilder(req, rsp, originalRb.components); try { handleSuggestionRequest(ctx, rb, originalRb.components, false); } finally { req.close(); } return rsp; }
protected void finish(final String chain) throws IOException { SolrCore core = h.getCore(); UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain); assertNotNull("No Chain named: " + chain, pc); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams()); UpdateRequestProcessor processor = pc.createProcessor(req, rsp); try { processor.finish(); } finally { IOUtils.closeQuietly(processor); req.close(); } }
protected void processCommit(final String chain) throws IOException { SolrCore core = h.getCore(); UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain); assertNotNull("No Chain named: " + chain, pc); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams()); CommitUpdateCommand cmd = new CommitUpdateCommand(req,false); UpdateRequestProcessor processor = pc.createProcessor(req, rsp); try { processor.processCommit(cmd); } finally { req.close(); } }
protected void processDeleteById(final String chain, String id) throws IOException { SolrCore core = h.getCore(); UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain); assertNotNull("No Chain named: " + chain, pc); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams()); DeleteUpdateCommand cmd = new DeleteUpdateCommand(req); cmd.setId(id); UpdateRequestProcessor processor = pc.createProcessor(req, rsp); try { processor.processDelete(cmd); } finally { req.close(); } }
req.close(); return normalized;
public long handleSuggestionHitsRequest(ReSearcherRequestContext ctx, String query, Set<String> componentNames) throws Exception { ModifiableSolrParams params = new ModifiableSolrParams(ctx.getParams()); params.set(CommonParams.ROWS, "0"); for(String componentName : componentNames) { params.set(componentName, "false"); } params.set(CommonParams.Q, query); SolrQueryRequest req = new SolrQueryRequestBase(ctx.getCore(), params) {}; SolrQueryResponse rsp = new SolrQueryResponse(); ResponseBuilder rb = new ResponseBuilder(req, rsp, ctx.getQueryOnlyComponents()); try { handleSuggestionRequest(ctx, rb, ctx.getQueryOnlyComponents(), true); } finally { req.close(); } return ReSearcherUtils.extractOriginalQueryHits(rb); }
/** * Runs a document through the specified chain, and returns the final * document used when the chain is completed (NOTE: some chains may * modify the document in place */ protected SolrInputDocument processAdd(final String chain, final SolrParams requestParams, final SolrInputDocument docIn) throws IOException { SolrCore core = h.getCore(); UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain); assertNotNull("No Chain named: " + chain, pc); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = new LocalSolrQueryRequest(core, requestParams); try { SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp)); AddUpdateCommand cmd = new AddUpdateCommand(req); cmd.solrDoc = docIn; UpdateRequestProcessor processor = pc.createProcessor(req, rsp); if (null != processor) { // test chain might be empty or short circuited. processor.processAdd(cmd); } return cmd.solrDoc; } finally { SolrRequestInfo.clearRequestInfo(); req.close(); } }
/** * Runs a document through the specified chain, and returns the final * document used when the chain is completed (NOTE: some chains may * modify the document in place */ protected SolrInputDocument processAdd(final String chain, final SolrParams requestParams, final SolrInputDocument docIn) throws IOException { SolrCore core = h.getCore(); UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain); assertNotNull("No Chain named: " + chain, pc); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = new LocalSolrQueryRequest(core, requestParams); try { AddUpdateCommand cmd = new AddUpdateCommand(req); cmd.solrDoc = docIn; UpdateRequestProcessor processor = pc.createProcessor(req, rsp); processor.processAdd(cmd); return cmd.solrDoc; } finally { req.close(); } }