如何在elasticsearch中处理空指针异常

时间:2012-04-26 19:40:01

标签: nullpointerexception elasticsearch

我正在使用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语句,但它不起作用,任何人都可以帮忙解决这个问题吗?

0 个答案:

没有答案