本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}