我正在使用elasticsearch,我试图在数据库为空时处理这种情况
@SuppressWarnings("unchecked")
public <M extends Model> SearchResults<M> findPage(int page, String search, String searchFields, String orderBy, String order, String where) {
BoolQueryBuilder qb = buildQueryBuilder(search, searchFields, where);
Query<M> query = (Query<M>) ElasticSearch.query(qb, entityClass);
// FIXME Currently we ignore the orderBy and order fields
query.from((page - 1) * getPageSize()).size(getPageSize());
query.hydrate(true);
return query.fetch();
}
返回query.fetch();
时的错误我正在尝试实施一个try和catch语句,但它不起作用,任何人都可以帮忙解决这个问题吗?