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


Java SearchException类代码示例

本文整理汇总了Java中org.gbif.common.search.SearchException的典型用法代码示例。如果您正苦于以下问题:Java SearchException类的具体用法?Java SearchException怎么用?Java SearchException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: searchHeatMap

import org.gbif.common.search.SearchException; //导入依赖的package包/类
public OccurrenceHeatmapResponse searchHeatMap(@Nullable OccurrenceHeatmapRequest request) {
  try {
    SolrQuery solrQuery = occurrenceSearchHeatmapRequestBuilder.build(request);
    solrQuery.setRows(0);
    solrQuery.setStart(0);
    solrQuery.setFacet(true);
    solrQuery.add(FacetParams.FACET_HEATMAP, OccurrenceSolrField.COORDINATE.getFieldName());
    solrQuery.add(FacetParams.FACET_HEATMAP_LEVEL, Integer.toString(gridLevel(request.getZoom())));
    solrQuery.add(FacetParams.FACET_HEATMAP_MAX_CELLS, Integer.toString(HeatmapFacetCounter.MAX_ROWS_OR_COLUMNS));
    if(request.getGeometry() != null) {
      solrQuery.add(FacetParams.FACET_HEATMAP_GEOM, request.getGeometry());
    }
    LOG.debug("Solr heatmap query {}", solrQuery);
    return OccurrenceHeatmapResponseBuilder.build(solrClient.query(solrQuery), OccurrenceSolrField.COORDINATE.getFieldName());
  } catch (SolrServerException | IOException e) {
    LOG.error("Error executing the search operation", e);
    throw new SearchException(e);
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:20,代码来源:OccurrenceHeatmapsService.java

示例2: search

import org.gbif.common.search.SearchException; //导入依赖的package包/类
@Override
public SearchResponse<Occurrence, OccurrenceSearchParameter> search(@Nullable OccurrenceSearchRequest request) {
  try {
    if (hasReplaceableScientificNames(request)) {
      SolrQuery solrQuery = occurrenceSearchRequestBuilder.build(request);
      QueryResponse queryResponse = solrClient.query(solrQuery);
      return buildResponse(queryResponse, request);
    } else {
      return new SearchResponse<Occurrence, OccurrenceSearchParameter>(request);
    }
  } catch (SolrServerException | IOException e) {
    LOG.error("Error executing the search operation", e);
    throw new SearchException(e);
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:16,代码来源:OccurrenceSearchImpl.java

示例3: suggestTermByField

import org.gbif.common.search.SearchException; //导入依赖的package包/类
/**
 * Searches a indexed terms of a field that matched against the prefix parameter.
 *
 * @param prefix search term
 * @param parameter mapped field to be searched
 * @param limit of maximum matches
 * @return a list of elements that matched against the prefix
 */
public List<String> suggestTermByField(String prefix, OccurrenceSearchParameter parameter, Integer limit) {
  try {
    String solrField = QUERY_FIELD_MAPPING.get(parameter).getFieldName();
    SolrQuery solrQuery = buildTermQuery(parseTermsQueryValue(prefix).toLowerCase(), solrField,
                                         Objects.firstNonNull(limit, DEFAULT_SUGGEST_LIMIT));
    final QueryResponse queryResponse = solrClient.query(solrQuery);
    final TermsResponse termsResponse = queryResponse.getTermsResponse();
    return termsResponse.getTerms(solrField).stream().map(Term::getTerm).collect(Collectors.toList());
  } catch (SolrServerException | IOException e) {
    LOG.error("Error executing/building the request", e);
    throw new SearchException(e);
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:22,代码来源:OccurrenceSearchImpl.java


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