@Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { SolrIndexSearcher searcher = req.getSearcher(); AtomicReader reader = searcher.getAtomicReader(); Set<String> fieldNames = new TreeSet<String>(); for (FieldInfo fieldInfo : reader.getFieldInfos()) { if (!ignoredFields.contains(fieldInfo.name)) { fieldNames.add(fieldInfo.name); } } rsp.add("fields", fieldNames); rsp.setHttpCaching(false); }
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { rsp.setHttpCaching(false); final SolrParams solrParams = req.getParams(); String dicPath = solrParams.get("dicPath"); Dictionary dict = Utils.getDict(dicPath, loader); NamedList<Object> result = new NamedList<Object>(); result.add("dicPath", dict.getDicPath().toURI()); boolean check = solrParams.getBool("check", false); //仅仅用于检测词库是否有变化 //用于尝试加载词库,有此参数, check 参数可以省略。 boolean reload = solrParams.getBool("reload", false); check |= reload; boolean changed = false; boolean reloaded = false; if(check) { changed = dict.wordsFileIsChange(); result.add("changed", changed); } if(changed && reload) { reloaded = dict.reload(); result.add("reloaded", reloaded); } rsp.add("result", result); }
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { rsp.setHttpCaching(false); final SolrParams solrParams = req.getParams(); String dicPath = solrParams.get("dicPath"); Dictionary dict = Utils.getDict(dicPath, loader); NamedList<Object> result = new NamedList<Object>(); result.add("dicPath", dict.getDicPath().toURI()); boolean check = solrParams.getBool("check", false); //仅仅用于检测词库是否有变化 //用于尝试加载词库,有此参数, check 参数可以省略。 boolean reload = solrParams.getBool("reload", false); check |= reload; boolean changed = false; boolean reloaded = false; if(check) { changed = dict.wordsFileIsChange(); result.add("changed", changed); } if(changed && reload) { reloaded = dict.reload(); result.add("reloaded", reloaded); } rsp.add("result", result); }
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { rsp.setHttpCaching(false);