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


Java NamedList.get方法代码示例

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


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

示例1: SuggestionService

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
public SuggestionService(SolrCore solrCore, NamedList args) {

        NamedList l = new NamedList();

        //set spellcheck component if there is one
        if(((ArrayList)args.get("first-components")).contains("spellcheck")) {
            List component = new ArrayList<String>();
            component.add("spellcheck");
            l.add("first-components",component);
            spellcheck_enabled = true;
        }

        if(args.get("defaults") != null && ((NamedList)args.get("defaults")).get(SuggestionRequestParams.SUGGESTION_INTERNAL_LIMIT) != null) {
            internalFacetLimit = (String)((NamedList)args.get("defaults")).get(SuggestionRequestParams.SUGGESTION_INTERNAL_LIMIT);
        }

        this.solrCore = solrCore;
        this.searchHandler = new SearchHandler();
        this.searchHandler.init(l);
        this.searchHandler.inform(solrCore);
    }
 
开发者ID:RBMHTechnology,项目名称:vind,代码行数:22,代码来源:SuggestionService.java

示例2: initSegmentType

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initSegmentType(String name, NamedList values) {
  String dictionaryClass = (String) values.get(INIT_ATTR_DICTIONARY);
  Class<?> clazz;
  try {
    clazz = Class.forName(dictionaryClass);
  } catch (ClassNotFoundException e) {
    throw new RuntimeException(e);
  }

  String filename = (String) values.get(INIT_ATTR_FILENAME);
  segmenter.addFileDictionary(name, filename, (Class<? extends FileBasedSegmentDictionary>) clazz);

  FieldMapping mapping = new FieldMapping();
  mapping.field = (String) values.get(INIT_ATTR_FIELD);
  mapping.useLatLon = values.get(INIT_ATTR_LATLON) == null ? false : (Boolean) values.get(INIT_ATTR_LATLON);
  mapping.useBoostQuery = values.get(INIT_ATTR_BQ) == null ? false : (Boolean) values.get(INIT_ATTR_BQ);
  mapping.useTime = values.get(INIT_ATTR_TIME) == null ? false : (Boolean) values.get(INIT_ATTR_TIME);
  mappings.put(name, mapping);
}
 
开发者ID:sematext,项目名称:query-segmenter,代码行数:21,代码来源:QuerySegmenterConfig.java

示例3: getEstimatedSizeOfShard

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
private long getEstimatedSizeOfShard(ReplicaInfo replica) throws IOException {
  try (AuthorizedSolrClient solrClient =
      spec.getConnectionConfiguration().createClient(replica.baseUrl())) {
    CoreAdminRequest req = new CoreAdminRequest();
    req.setAction(CoreAdminParams.CoreAdminAction.STATUS);
    req.setIndexInfoNeeded(true);
    CoreAdminResponse response;
    try {
      response = solrClient.process(req);
    } catch (SolrServerException e) {
      throw new IOException("Can not get core status from " + replica, e);
    }
    NamedList<Object> coreStatus = response.getCoreStatus(replica.coreName());
    NamedList<Object> indexStats = (NamedList<Object>) coreStatus.get("index");
    return (long) indexStats.get("sizeInBytes");
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:18,代码来源:SolrIO.java

示例4: executeStreamingExpression

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
public static RStreamingExpressionIterator executeStreamingExpression(SolrClient sc, String collection,
    String expression, String[] columnNames) throws IOException, SolrServerException {
    if (!checkResponseWriter(sc)) {
        log.error("The SolrClient's Response Writer should be: " + InputStreamResponseParser.class.getName());
    }
    SolrParams sp = new MapSolrParams(Collections.singletonMap("expr", expression));
    SolrRequest<?> sr = new GenericSolrRequest(METHOD.POST, "/stream", sp);
    NamedList<Object> nl = sc.request(sr, collection);
    InputStream stream = (InputStream) nl.get("stream");
    InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
    if (columnNames == null || columnNames.length == 0) {
        return new RStreamingExpressionIterator(reader);
    }
    return new RStreamingExpressionIterator(reader, columnNames);
}
 
开发者ID:jdyer1,项目名称:R-solr-stream,代码行数:16,代码来源:RStreamingExpressions.java

示例5: 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

示例6: init

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void init(NamedList args) {
    super.init(args);

    solrAC = (String) args.get("solrAC");

    if (solrAC.startsWith("http:")) {

        // Used when AC core is deployed on separate Solr
        this.solrACServer = new HttpSolrClient.Builder(solrAC).build();
    }

    this.separator = (String) args.get("separator");

    String fieldsStr = (String) args.get("fields");
    String copyAsIsFieldsStr = (String) args.get("copyAsIsFields");

    if (fieldsStr == null) {
        throw new RuntimeException(
                "Can't initialize AutocompleteUpdateRequestProcessor unless fields are specified");
    }

    StringTokenizer tok = new StringTokenizer(fieldsStr, ",");
    while (tok.hasMoreTokens()) {
        fields.add(tok.nextToken().trim());
    }
    
    if (copyAsIsFieldsStr != null) {
      String [] fs = copyAsIsFieldsStr.split(",");
      for (String f : fs) {
        copyAsIsFields.add(f.trim());
      }
    }
}
 
开发者ID:sematext,项目名称:solr-autocomplete,代码行数:36,代码来源:AutocompleteUpdateRequestProcessorFactory.java

示例7: init

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@Override
public void init(NamedList args){
  NamedList settings = (NamedList)args.get("settings");
  String featuresFileName = (String)settings.get("features");
  String modelFileName = (String)settings.get("model");

  FeaturesConfigReader fcReader = null;
  try {
    fcReader = new FeaturesConfigReader(featuresFileName);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }

  try {
    LinearWeightModelReader mcReader = new LinearWeightModelReader(modelFileName);

    LinearWeightModelReader.WeightDesc[] weightDescs = mcReader.getWeightDescs();

    for(LinearWeightModelReader.WeightDesc weightDesc: weightDescs){
      weights.add(weightDesc.weight);
      FeaturesConfigReader.FeatureDesc featureDesc = fcReader.getFeatureDesc(weightDesc.name);
      if(featureDesc == null){
        throw new IllegalArgumentException("no such feature " + weightDesc.name + " in the feature conf file");
      }
      FieldFeatureExtractorFactory dfeFactory = FeaturesConfigReader.loadFactory(featureDesc);
      featuresSpec.add(dfeFactory);
    }
  } catch (IOException ignored) {
    // TODO: log warning...
  }
}
 
开发者ID:NLP4L,项目名称:solr,代码行数:32,代码来源:LinearWeightQParserPlugin.java

示例8: init

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@Override
public void init(NamedList args){
  NamedList settings = (NamedList)args.get("settings");
  String featuresFileName = (String)settings.get("features");
  String modelFileName = (String)settings.get("model");

  FeaturesConfigReader fcReader = null;
  try {
    fcReader = new FeaturesConfigReader(featuresFileName);
  } catch (IOException e) {
    e.printStackTrace();
  }

  try {
    PRankModelReader mcReader = new PRankModelReader(modelFileName);

    LinearWeightModelReader.WeightDesc[] weightDescs = mcReader.getWeightDescs();

    for(LinearWeightModelReader.WeightDesc weightDesc: weightDescs){
      weights.add(weightDesc.weight);
      FeaturesConfigReader.FeatureDesc featureDesc = fcReader.getFeatureDesc(weightDesc.name);
      if(featureDesc == null){
        throw new IllegalArgumentException("no such feature " + weightDesc.name + " in the feature conf file");
      }
      FieldFeatureExtractorFactory dfeFactory = FeaturesConfigReader.loadFactory(featureDesc);
      featuresSpec.add(dfeFactory);
    }

    float[] bbs = mcReader.getBs();
    for(float b: bbs){
      bs.add(b);
    }
  } catch (IOException ignored) {
    // TODO: log warning...
  }
}
 
开发者ID:NLP4L,项目名称:solr,代码行数:37,代码来源:PRankQParserPlugin.java

示例9: process

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@Override
public void process(NamedList<Object> wordData, String wordName) {
  String word = (String) wordData.get("word");

  StringBuilder collation = new StringBuilder(originalQuery);
  collation.replace(wordStartOffset, wordEndOffset, word);

  String collVal = collation.toString();
  if (collVal.equals(originalQuery) == false) {
      newSuggestions.add(collVal);
  }
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:13,代码来源:CreateNewSuggestionsProcessor.java

示例10: iterateOverSpellcheckerSuggestionsForWord

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
/**
 * Contains logic for iterating over spellchecker's suggestions. If any of input parameters is null, just exits. This method
 * iterates over suggestions for one incorrect word (which was provided with parameter)
 * 
 * @param suggestions list of all suggestions, can be extracted with method .extractSpellcheckerSuggestions().
 * @param word term for which suggestions are being processed
 * @param processor instance of processor which will handle all suggestions for word
 */
public static void iterateOverSpellcheckerSuggestionsForWord(NamedList suggestions, String word, SpellcheckerSuggestionProcessor processor) {
  if (suggestions == null || word == null || processor == null) {
    return;
  }
  NamedList stuff = (NamedList) suggestions.get(word);
  
  iterateOverSpellcheckerSuggestionsForWord(stuff, processor);    
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:17,代码来源:ReSearcherUtils.java

示例11: getInt

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
protected int getInt(NamedList args, String name) {
  Integer value = (Integer) args.get(name);
  if (value != null) {
    return value.intValue();
  } else {
    return 0;
  }
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:10,代码来源:AbstractReSearcherComponent.java

示例12: getFloat

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
protected float getFloat(NamedList args, String name) {
  Float value = (Float) args.get(name);
  if (value != null) {
    return value.floatValue();
  } else {
    return 0;
  }
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:10,代码来源:AbstractReSearcherComponent.java

示例13: getBoolean

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
protected boolean getBoolean(NamedList args, String name) {
  Boolean value = (Boolean) args.get(name);
  if (value != null) {
    return value.booleanValue();
  } else {
    return false;
  }
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:10,代码来源:AbstractReSearcherComponent.java

示例14: getIds

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
List<Object> getIds(NamedList response) {
    List<Object> ids = new ArrayList<>();
    SolrDocumentList list = (SolrDocumentList) response.get("response");
    for (int j = 0; j < list.size(); ++j) {
        String id =  list.get(j).getFieldValue("id").toString();
        id = id.substring(id.indexOf(':')+1,id.length());
        ids.add(id);
    }

    return ids;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:12,代码来源:SolrSearchService.java

示例15: copyFieldInNamedList

import org.apache.solr.common.util.NamedList; //导入方法依赖的package包/类
/**
 * Copies a field value from one NamedList into another
 */
private static void copyFieldInNamedList(NamedList<Object> from, NamedList<Object> to, String key) {
  int index = from.indexOf(key, 0);
  if(index != -1) {
    Object value = from.get(key);
    int index2 = to.indexOf(key, 0);
    if(index2 != -1) {
      to.setVal(index2, value);
    } else {
      to.add(key, value);
    }
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:16,代码来源:JsonReferencePayloadHandler.java


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