本文整理汇总了Java中org.apache.solr.core.SolrInfoMBean.getDocs方法的典型用法代码示例。如果您正苦于以下问题:Java SolrInfoMBean.getDocs方法的具体用法?Java SolrInfoMBean.getDocs怎么用?Java SolrInfoMBean.getDocs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.core.SolrInfoMBean
的用法示例。
在下文中一共展示了SolrInfoMBean.getDocs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMBean
import org.apache.solr.core.SolrInfoMBean; //导入方法依赖的package包/类
private void addMBean(SolrQueryRequest req, NamedList<NamedList<NamedList<Object>>> cats, Set<String> requestedKeys, String key, SolrInfoMBean m) {
if ( ! ( requestedKeys.isEmpty() || requestedKeys.contains(key) ) ) return;
NamedList<NamedList<Object>> catInfo = cats.get(m.getCategory().name());
if ( null == catInfo ) return;
NamedList<Object> mBeanInfo = new SimpleOrderedMap<>();
mBeanInfo.add("class", m.getName());
mBeanInfo.add("version", m.getVersion());
mBeanInfo.add("description", m.getDescription());
mBeanInfo.add("src", m.getSource());
// Use an external form
URL[] urls = m.getDocs();
if(urls!=null) {
List<String> docs = new ArrayList<>(urls.length);
for(URL url : urls) {
docs.add(url.toExternalForm());
}
mBeanInfo.add("docs", docs);
}
if (req.getParams().getFieldBool(key, "stats", false))
mBeanInfo.add("stats", m.getStatistics());
catInfo.add(key, mBeanInfo);
}
示例2: getSolrInfoBeans
import org.apache.solr.core.SolrInfoMBean; //导入方法依赖的package包/类
private static SimpleOrderedMap<Object> getSolrInfoBeans( SolrCore core, boolean stats )
{
SimpleOrderedMap<Object> list = new SimpleOrderedMap<>();
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values())
{
SimpleOrderedMap<Object> category = new SimpleOrderedMap<>();
list.add( cat.name(), category );
Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
SolrInfoMBean m = entry.getValue();
if (m.getCategory() != cat) continue;
String na = "Not Declared";
SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();
category.add( entry.getKey(), info );
info.add( "name", (m.getName() !=null ? m.getName() : na) );
info.add( "version", (m.getVersion() !=null ? m.getVersion() : na) );
info.add( "description", (m.getDescription()!=null ? m.getDescription() : na) );
info.add( "source", (m.getSource() !=null ? m.getSource() : na) );
URL[] urls = m.getDocs();
if ((urls != null) && (urls.length > 0)) {
ArrayList<String> docs = new ArrayList<>(urls.length);
for( URL u : urls ) {
docs.add( u.toExternalForm() );
}
info.add( "docs", docs );
}
if( stats ) {
info.add( "stats", m.getStatistics() );
}
}
}
return list;
}
示例3: getSolrInfoBeans
import org.apache.solr.core.SolrInfoMBean; //导入方法依赖的package包/类
private static SimpleOrderedMap<Object> getSolrInfoBeans( SolrCore core, boolean stats )
{
SimpleOrderedMap<Object> list = new SimpleOrderedMap<Object>();
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values())
{
SimpleOrderedMap<Object> category = new SimpleOrderedMap<Object>();
list.add( cat.name(), category );
Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
SolrInfoMBean m = entry.getValue();
if (m.getCategory() != cat) continue;
String na = "Not Declared";
SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
category.add( entry.getKey(), info );
info.add( "name", (m.getName() !=null ? m.getName() : na) );
info.add( "version", (m.getVersion() !=null ? m.getVersion() : na) );
info.add( "description", (m.getDescription()!=null ? m.getDescription() : na) );
info.add( "source", (m.getSource() !=null ? m.getSource() : na) );
URL[] urls = m.getDocs();
if ((urls != null) && (urls.length > 0)) {
ArrayList<String> docs = new ArrayList<String>(urls.length);
for( URL u : urls ) {
docs.add( u.toExternalForm() );
}
info.add( "docs", docs );
}
if( stats ) {
info.add( "stats", m.getStatistics() );
}
}
}
return list;
}
示例4: getMBeanInfo
import org.apache.solr.core.SolrInfoMBean; //导入方法依赖的package包/类
protected NamedList<NamedList<NamedList<Object>>> getMBeanInfo(SolrQueryRequest req) {
NamedList<NamedList<NamedList<Object>>> cats = new NamedList<NamedList<NamedList<Object>>>();
String[] requestedCats = req.getParams().getParams("cat");
if (null == requestedCats || 0 == requestedCats.length) {
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
cats.add(cat.name(), new SimpleOrderedMap<NamedList<Object>>());
}
} else {
for (String catName : requestedCats) {
cats.add(catName,new SimpleOrderedMap<NamedList<Object>>());
}
}
Set<String> requestedKeys = arrayToSet(req.getParams().getParams("key"));
Map<String, SolrInfoMBean> reg = req.getCore().getInfoRegistry();
for (Map.Entry<String, SolrInfoMBean> entry : reg.entrySet()) {
String key = entry.getKey();
SolrInfoMBean m = entry.getValue();
if ( ! ( requestedKeys.isEmpty() || requestedKeys.contains(key) ) ) continue;
NamedList<NamedList<Object>> catInfo = cats.get(m.getCategory().name());
if ( null == catInfo ) continue;
NamedList<Object> mBeanInfo = new SimpleOrderedMap<Object>();
mBeanInfo.add("class", m.getName());
mBeanInfo.add("version", m.getVersion());
mBeanInfo.add("description", m.getDescription());
mBeanInfo.add("src", m.getSource());
// Use an external form
URL[] urls = m.getDocs();
if(urls!=null) {
List<String> docs = new ArrayList<String>(urls.length);
for(URL url : urls) {
docs.add(url.toExternalForm());
}
mBeanInfo.add("docs", docs);
}
if (req.getParams().getFieldBool(key, "stats", false))
mBeanInfo.add("stats", m.getStatistics());
catInfo.add(key, mBeanInfo);
}
return cats;
}