code: public void query(final String whereClause, final String[] whereArgs, final String groupBy, final String orderBy, final String limit, final SuccessCallback<Cursor> successCallback, final ErrorCallback errorCallback) {
          checkNotNull(successCallback);
          checkNotNull(errorCallback);
  
          final Callable<Cursor> call = new Callable<Cursor>() {
              @Override
              public Cursor call() throws Exception {
                  return SugarRecord.getCursor(getSugarClass(), whereClause, whereArgs, groupBy, orderBy, limit);
              }
          };
  
          final Future<Cursor> future = doInBackground(call);
          Cursor cursor;
  
          try {
              cursor = future.get();
  
              if (null == cursor) {
                  errorCallback.onError(new Exception("Problem when trying to get the cursor"));
              } else {
                  successCallback.onSuccess(cursor);
              }
  
          } catch (Exception e) {
              errorCallback.onError(e);
          }
      }
docs: Method that provides you the ability of perform a custom query and retrieve a cursor. It works on top of SugarRecord class,
  All the code is executed asynchronously with the usage of Futures and callbacks.
  
  @param whereClause the clause of the search
  @param whereArgs the arguments for the search
  @param groupBy the form that you want to group them
  @param orderBy the form that you want to order
  @param limit the limit of objects to want
  @param successCallback the callback to be executed if the operation is successful
  @param errorCallback the callback to be executed if the operation has an error