/** * 重启 * * @param req * @param resp * @return */ public ModelAndView restart(HttpServletRequest req, HttpServletResponse resp) { SolrServer coreadmin = solr.getSolrServer(SearchConstants.CORE_NAME_ADMIN); try { CoreAdminRequest.reloadCore(SearchConstants.CORE_NAME_PRODUCT, coreadmin); CoreAdminRequest.reloadCore(SearchConstants.CORE_NAME_CONTENT, coreadmin); CoreAdminRequest.reloadCore(SearchConstants.CORE_NAME_SALESORDER, coreadmin); saveMessage(Message.info("searchServer.confirm.restart.succeeded")); } catch (Exception e) { logger.error(e); // TODO Auto-generated catch block e.printStackTrace(); } ModelAndView mv = new ModelAndView(new RedirectView("/system/searchServer.html", true)); return mv; }
public ModelAndView defaultAction(HttpServletRequest req, HttpServletResponse resp) { removeNavFromSearchCriteria(req); // 获得admin的solrServer SolrServer coreadmin = solr.getSolrServer(SearchConstants.CORE_NAME_ADMIN); ModelAndView mv = new ModelAndView("system/searchServer"); try { // 获得product的status CoreAdminResponse mcr = CoreAdminRequest.getStatus(SearchConstants.CORE_NAME_PRODUCT, coreadmin); NamedList rs = mcr.getCoreStatus().get(SearchConstants.CORE_NAME_PRODUCT); NamedList indexInfo = (NamedList) rs.get("index"); mv.addObject("productCore", rs); mv.addObject("productIndexInfo", indexInfo); // 获得salesorder的status CoreAdminResponse so_mcr = CoreAdminRequest.getStatus(SearchConstants.CORE_NAME_SALESORDER, coreadmin); NamedList so_rs = so_mcr.getCoreStatus().get(SearchConstants.CORE_NAME_SALESORDER); NamedList so_indexInfo = (NamedList) so_rs.get("index"); mv.addObject("salesOrderCore", so_rs); mv.addObject("salesOrderIndexInfo", so_indexInfo); // 获得salesorder的status CoreAdminResponse cn_mcr = CoreAdminRequest.getStatus(SearchConstants.CORE_NAME_CONTENT, coreadmin); NamedList cn_rs = cn_mcr.getCoreStatus().get(SearchConstants.CORE_NAME_CONTENT); NamedList cn_indexInfo = (NamedList) cn_rs.get("index"); mv.addObject("contentCore", cn_rs); mv.addObject("contentIndexInfo", cn_indexInfo); String searchServerPath = ConfigUtil.getInstance().getStoreSearchPath(); if (logger.isDebugEnabled()) logger.debug("searchServerPath=" + searchServerPath); if (searchServerPath != null) { String synonyms = FileUtil.readFileToString(searchServerPath + "/product/conf/synonyms.txt"); String protwords = FileUtil.readFileToString(searchServerPath + "/product/conf/protwords.txt"); mv.addObject("synonyms", synonyms); mv.addObject("protwords", protwords); } } catch (Exception e) { logger.error(e); // TODO Auto-generated catch block e.printStackTrace(); } return mv; }