List of usage examples for org.apache.solr.core SolrCore getInfoRegistry
public Map<String, SolrInfoBean> getInfoRegistry()
From source file:lux.solr.SolrIndexConfig.java
License:Mozilla Public License
public static SolrIndexConfig registerIndexConfiguration(SolrCore core) { // Read the init args from the LuxUpdateProcessorFactory's configuration NamedList<?> initArgs = null;//from w w w.j av a2 s .c o m for (PluginInfo info : core.getSolrConfig().getPluginInfos(UpdateRequestProcessorChain.class.getName())) { // FIXME: if there are multiple processors, we prefer the 'default' one, otherwise // just take the last? This is a bit lame, but it provides back-compat. We should at least // raise a warning if this is ambiguous initArgs = info.initArgs; if ("true".equals(info.attributes.get("default"))) { break; } } String configName = SolrIndexConfig.class.getName(); SolrInfoMBean configBean = core.getInfoRegistry().get(configName); SolrIndexConfig indexConfig; if (configBean != null) { indexConfig = (SolrIndexConfig) configBean; } else { int options = (INDEX_PATHS | INDEX_FULLTEXT | STORE_DOCUMENT | SOLR); indexConfig = SolrIndexConfig.makeIndexConfiguration(options, initArgs, configName); indexConfig.inform(core); core.getInfoRegistry().put(configName, indexConfig); } return indexConfig; }
From source file:org.xwiki.platform.search.internal.SolrjSearchRequest.java
License:Open Source License
/** * @return List of Fields.// w ww .ja v a2 s. c o m */ private List<String> getFields() { CoreContainer container = (CoreContainer) searchEngine.getCoreContainer(); SolrCore core = null; for (SolrCore c : container.getCores()) { core = c; } Map<String, SolrInfoMBean> reg = core.getInfoRegistry(); LukeRequestHandler handler = (LukeRequestHandler) reg.get("/admin/luke"); LocalSolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams()); SolrQueryResponse response = new SolrQueryResponse(); handler.handleRequest(req, response); NamedList list = response.getValues(); List<String> fieldsList = new ArrayList<String>(); for (Object obj : list.getAll("fields")) { SimpleOrderedMap map = (SimpleOrderedMap) obj; Iterator<Map.Entry<String, Object>> entries = map.iterator(); while (entries.hasNext()) { Map.Entry<String, Object> entry = entries.next(); fieldsList.add(entry.getKey()); } } return fieldsList; }