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


Java ErrorCode.NOT_FOUND属性代码示例

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


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

示例1: get

@Override
public Representation get() {
  try {
    final String defaultSearchFieldName = getSchema().getDefaultSearchFieldName();
    if (null == defaultSearchFieldName) {
      final String message = "undefined " + IndexSchema.DEFAULT_SEARCH_FIELD;
      throw new SolrException(ErrorCode.NOT_FOUND, message);
    }
    getSolrResponse().add(IndexSchema.DEFAULT_SEARCH_FIELD, defaultSearchFieldName);
  } catch (Exception e) {
    getSolrResponse().setException(e);
  }
  handlePostExecution(log);

  return new SolrOutputRepresentation();
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:DefaultSearchFieldResource.java

示例2: doGet

/**
 * Implements the GET request to provide the list of words to the client.
 * Alternatively, if a specific word is requested, then it is returned
 * or a 404 is raised, indicating that the requested word does not exist.
 */
@Override
public void doGet(BaseSolrResource endpoint, String childId) {
  SolrQueryResponse response = endpoint.getSolrResponse();
  if (childId != null) {
    // downcase arg if we're configured to ignoreCase
    String key = getIgnoreCase() ? childId.toLowerCase(Locale.ROOT) : childId;       
    if (!managedWords.contains(key))
      throw new SolrException(ErrorCode.NOT_FOUND, 
          String.format(Locale.ROOT, "%s not found in %s", childId, getResourceId()));
      
    response.add(childId, key);
  } else {
    response.add(WORD_SET_JSON_FIELD, buildMapToStore(managedWords));      
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:ManagedWordSetResource.java

示例3: doGet

@Override
public void doGet(BaseSolrResource endpoint, String childId) {
  SolrQueryResponse response = endpoint.getSolrResponse();
  if (childId != null) {
    boolean ignoreCase = getIgnoreCase();
    String key = applyCaseSetting(ignoreCase, childId);
    
    // if ignoreCase==true, then we get the mappings using the lower-cased key
    // and then return a union of all case-sensitive keys, if false, then
    // we only return the mappings for the exact case requested
    CasePreservedSynonymMappings cpsm = synonymMappings.get(key);
    Set<String> mappings = (cpsm != null) ? cpsm.getMappings(ignoreCase, childId) : null;
    if (mappings == null)
      throw new SolrException(ErrorCode.NOT_FOUND,
          String.format(Locale.ROOT, "%s not found in %s", childId, getResourceId()));          
    
    response.add(childId, mappings);
  } else {
    response.add(SYNONYM_MAPPINGS, buildMapToStore(getStoredView()));      
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:ManagedSynonymFilterFactory.java

示例4: handleRequestBody

@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
  // Make sure the cores is enabled
  CoreContainer cores = getCoreContainer();
  if (cores == null) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
            "Core container instance missing");
  }

  String path = (String) req.getContext().get("path");
  int i = path.lastIndexOf('/');
  String name = path.substring(i + 1, path.length());
  
  if (name.equalsIgnoreCase("properties")) {
    propertiesHandler.handleRequest(req, rsp);
  } else if (name.equalsIgnoreCase("threads")) {
    threadDumpHandler.handleRequest(req, rsp);
  } else if (name.equalsIgnoreCase("logging")) {
    loggingHandler.handleRequest(req, rsp);
  }  else if (name.equalsIgnoreCase("system")) {
    systemInfoHandler.handleRequest(req, rsp);
  } else {
    if (name.equalsIgnoreCase("info")) name = "";
    throw new SolrException(ErrorCode.NOT_FOUND, "Info Handler not found: " + name);
  }
  
  rsp.setHttpCaching(false);
}
 
开发者ID:europeana,项目名称:search,代码行数:28,代码来源:InfoHandler.java

示例5: doDeleteChild

/**
 * Deletes words managed by this resource.
 */
@Override
public synchronized void doDeleteChild(BaseSolrResource endpoint, String childId) {
  // downcase arg if we're configured to ignoreCase
  String key = getIgnoreCase() ? childId.toLowerCase(Locale.ROOT) : childId;       
  if (!managedWords.contains(key))
    throw new SolrException(ErrorCode.NOT_FOUND, 
        String.format(Locale.ROOT, "%s not found in %s", childId, getResourceId()));

  managedWords.remove(key);
  storeManagedData(managedWords);
  log.info("Removed word: {}", key);
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:ManagedWordSetResource.java

示例6: doDeleteChild

@Override
public synchronized void doDeleteChild(BaseSolrResource endpoint, String childId) {
  boolean ignoreCase = getIgnoreCase();
  String key = applyCaseSetting(ignoreCase, childId);
  
  CasePreservedSynonymMappings cpsm = synonymMappings.get(key);
  if (cpsm == null)
    throw new SolrException(ErrorCode.NOT_FOUND, 
        String.format(Locale.ROOT, "%s not found in %s", childId, getResourceId()));

  if (ignoreCase) {
    // delete all mappings regardless of case
    synonymMappings.remove(key);
  } else {
    // just delete the mappings for the specific case-sensitive key
    if (cpsm.mappings.containsKey(childId)) {
      cpsm.mappings.remove(childId);
      
      if (cpsm.mappings.isEmpty())
        synonymMappings.remove(key);            
    } else {
      throw new SolrException(ErrorCode.NOT_FOUND, 
          String.format(Locale.ROOT, "%s not found in %s", childId, getResourceId()));          
    }
  }
  
  // store the updated data (using the stored view)
  storeManagedData(getStoredView());
  
  log.info("Removed synonym mappings for: {}", childId);      
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:ManagedSynonymFilterFactory.java

示例7: init

@Override
public void init(Map<String,String> params) throws SolrException {
  this.currencyConfigFile = params.get(PARAM_CURRENCY_CONFIG);
  if(currencyConfigFile == null) {
    throw new SolrException(ErrorCode.NOT_FOUND, "Missing required configuration "+PARAM_CURRENCY_CONFIG);
  }
  
  // Removing config params custom to us
  params.remove(PARAM_CURRENCY_CONFIG);
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:CurrencyField.java

示例8: getExchangeRate

@Override
  public double getExchangeRate(String sourceCurrencyCode, String targetCurrencyCode) {
//    System.out.println("***** getExchangeRate("+sourceCurrencyCode+targetCurrencyCode+")");
    if(sourceCurrencyCode.equals(targetCurrencyCode)) return 1.0;

    Double result = map.get(sourceCurrencyCode+","+targetCurrencyCode);
    if(result == null) {
      throw new SolrException(ErrorCode.NOT_FOUND, "No exchange rate found for the pair "+sourceCurrencyCode+","+targetCurrencyCode);
    }
    return result;
  }
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:MockExchangeRateProvider.java


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