本文整理汇总了Java中org.apache.solr.common.util.NamedList.getName方法的典型用法代码示例。如果您正苦于以下问题:Java NamedList.getName方法的具体用法?Java NamedList.getName怎么用?Java NamedList.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.common.util.NamedList
的用法示例。
在下文中一共展示了NamedList.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toMultiMap
import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
/** Create a Map<String,String[]> from a NamedList */
public static Map<String,String[]> toMultiMap(NamedList params) {
HashMap<String,String[]> map = new HashMap<>();
for (int i=0; i<params.size(); i++) {
String name = params.getName(i);
Object val = params.getVal(i);
if (val instanceof String[]) {
MultiMapSolrParams.addParam(name, (String[]) val, map);
} else if (val instanceof List) {
List l = (List) val;
String[] s = new String[l.size()];
for (int j = 0; j < l.size(); j++) {
s[j] = l.get(j) == null ? null : String.valueOf(l.get(j));
}
MultiMapSolrParams.addParam(name, s, map);
} else {
MultiMapSolrParams.addParam(name, val.toString(), map);
}
}
return map;
}
示例2: toMultiMap
import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
static Map<String, String[]> toMultiMap(ModifiableSolrParams solrQueryParameter) {
NamedList<Object> namedList = solrQueryParameter.toNamedList();
//disabled for MCR-953 and https://issues.apache.org/jira/browse/SOLR-7508
//Map<String, String[]> parameters = ModifiableSolrParams.toMultiMap(namedList);
HashMap<String, String[]> parameters = new HashMap<>();
for (int i = 0; i < namedList.size(); i++) {
String name = namedList.getName(i);
Object val = namedList.getVal(i);
if (val instanceof String[]) {
MultiMapSolrParams.addParam(name, (String[]) val, parameters);
} else {
MultiMapSolrParams.addParam(name, val.toString(), parameters);
}
}
//end of fix
return parameters;
}
示例3: Tag
import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
Tag(NamedList<Object> res){
for( int i=0; i<res.size(); i++ ) {
String n = res.getName( i );
switch (n) {
case "startOffset":
_start = (Integer)res.getVal(i);
break;
case "endOffset":
_end = (Integer)res.getVal(i);
break;
case "ids":
_ids = (List<Object>)res.getVal(i);
break;
default:
break;
}
}
}
示例4: updateExternalRepresentation
import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@Override
public void updateExternalRepresentation(NamedList<Object> nl) {
for (int i = 0; i < nl.size(); i++) {
String rawName = nl.getName(i);
String externalName = readableToExternal(rawName);
nl.setName(i, externalName);
Object val = nl.getVal(i);
Object updatedVal;
if (!(val instanceof Number) && (updatedVal = updateValueExternalRepresentation(val)) != null) {
nl.setVal(i, updatedVal);
}
}
}
示例5: QuerySegmenterConfig
import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public QuerySegmenterConfig(NamedList args) {
segmenter = new QuerySegmenterDefaultImpl();
NamedList segments = (NamedList) args.get(INIT_ATTR_SEGMENTS);
for (int i = 0; i < segments.size(); i++) {
String name = segments.getName(i);
NamedList values = (NamedList) segments.getVal(i);
initSegmentType(name, values);
}
}