当前位置: 首页>>代码示例>>Java>>正文


Java NamedList.iterator方法代码示例

本文整理汇总了Java中org.apache.solr.common.util.NamedList.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java NamedList.iterator方法的具体用法?Java NamedList.iterator怎么用?Java NamedList.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.common.util.NamedList的用法示例。


在下文中一共展示了NamedList.iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pingSolr

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
protected void pingSolr()
{
    ModifiableSolrParams params = new ModifiableSolrParams();
    params.set("qt", "/admin/cores");
    params.set("action", "STATUS");
	
    QueryResponse response = basicQuery(params);
    if(response != null && response.getStatus() == 0)
    {
	    NamedList<Object> results = response.getResponse();
	    @SuppressWarnings("unchecked")
              NamedList<Object> report = (NamedList<Object>)results.get("status");
	    Iterator<Map.Entry<String, Object>> coreIterator = report.iterator();
	    List<String> cores = new ArrayList<String>(report.size());
	    while(coreIterator.hasNext())
	    {
	    	Map.Entry<String, Object> core = coreIterator.next();
	    	cores.add(core.getKey());
	    }
	    
	    registerCores(cores);
    	setSolrActive(true);
    }
    else
    {
    	setSolrActive(false);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:SOLRAdminClient.java

示例2: mergePayload

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@Override
public NamedList<Object> mergePayload(NamedList<Object> preExisting, NamedList<Object> add, long preExistingCount, long addCount) {

  if (addCount != ((Number)add.get(KEY_COUNT)).longValue()) {
    throw new IllegalStateException("fieldType-internal and -external counts do not match");
  }
  int countIndex = preExisting.indexOf(KEY_COUNT, 0);
  long preCount = ((Number)preExisting.getVal(countIndex)).longValue();
  preExisting.setVal(countIndex, preCount + addCount);

  if(add.get(KEY_SELF) != null) {
    NamedList<Object> addSelf = (NamedList<Object>) add.get(KEY_SELF);

    NamedList<Object> preExistingSelf = getOrCreateNamedListValue(preExisting, KEY_SELF);

    mergeCount(addSelf, preExistingSelf, KEY_COUNT);

    copyFieldInNamedList(addSelf, preExistingSelf, KEY_FILING);
    copyFieldInNamedList(addSelf, preExistingSelf, KEY_PREFIX);
  }

  if(add.get(KEY_REFS) != null) {
    NamedList<Object> addRefs = (NamedList<Object>) add.get(KEY_REFS);
    Iterator<Map.Entry<String, Object>> refTypesIter = addRefs.iterator();
    while (refTypesIter.hasNext()) {
      Map.Entry<String, Object> entry = refTypesIter.next();
      String addReferenceType = entry.getKey();
      NamedList<Object> addNameStructs = (NamedList<Object>) entry.getValue();

      // if "refs" doesn't exist in preExisting yet, create it
      NamedList<Object> preExistingRefs = getOrCreateNamedListValue(preExisting, KEY_REFS);

      // if referenceType doesn't exist in preExisting yet, create it
      NamedList<Object> preExistingNameStructs = getOrCreateNamedListValue(preExistingRefs, addReferenceType);

      // loop through names and merge them into preExisting
      Iterator<Map.Entry<String, Object>> addNameStructsIter = addNameStructs.iterator();
      while (addNameStructsIter.hasNext()) {
        Map.Entry<String, Object> nameStructEntry = addNameStructsIter.next();
        String name = nameStructEntry.getKey();
        NamedList<Object> addNameStruct = (NamedList<Object>) nameStructEntry.getValue();

        // if name doesn't exist in preExisting yet, create it
        NamedList<Object> preExistingNameStruct = getOrCreateNamedListValue(preExistingNameStructs, name);

        mergeCount(addNameStruct, preExistingNameStruct, KEY_COUNT);

        copyFieldInNamedList(addNameStruct, preExistingNameStruct, KEY_FILING);
        copyFieldInNamedList(addNameStruct, preExistingNameStruct, KEY_PREFIX);
      }
    }
  }
  return preExisting;
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:55,代码来源:JsonReferencePayloadHandler.java


注:本文中的org.apache.solr.common.util.NamedList.iterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。