public List<LogEvent> findByAppIdContains(
      final String appId, String token, LogEvent lastRow, int limit, boolean isPrevPaging) {
    Select sel = QueryBuilder.select().from(table).limit(limit);
    Where w = sel.where(QueryBuilder.eq(pkCols[0], appId));

    w.and(
        QueryBuilder.eq(
            luceneCol,
            Builder.search()
                .filter(Builder.phrase(logTextCol, token))
                .sort(SortField.field(timeuuidCol).reverse(isPrevPaging))
                .build()));

    if (lastRow != null) {
      w.and(
          isPrevPaging
              ? QueryBuilder.gt(timeuuidCol, lastRow.getId().getTimestamp())
              : QueryBuilder.lt(timeuuidCol, lastRow.getId().getTimestamp()));
    }

    log.debug(">>>>>>>>> Firing select query: " + sel.toString());
    List<LogEvent> events = cassandraOperations.select(sel, LogEvent.class);
    if (isPrevPaging) {
      Collections.sort(
          events,
          new Comparator<LogEvent>() {

            @Override
            public int compare(LogEvent o1, LogEvent o2) {
              return o2.getId().getTimestamp().compareTo(o1.getId().getTimestamp());
            }
          });
    }
    return events;
  }
  public List<LogEvent> findByAppId(
      final String appId, LogEvent lastRow, int limit, boolean isPrevPaging) {
    Select sel = QueryBuilder.select().from(table).limit(limit);
    Where w = sel.where(QueryBuilder.eq(pkCols[0], appId));
    if (lastRow != null) {
      w.and(
          isPrevPaging
              ? QueryBuilder.gt(timeuuidCol, lastRow.getId().getTimestamp())
              : QueryBuilder.lt(timeuuidCol, lastRow.getId().getTimestamp()));
    }

    if (isPrevPaging) sel.orderBy(QueryBuilder.asc(timeuuidCol));

    log.debug(">>>>>>>>> Firing select query: " + sel.toString());
    List<LogEvent> events = cassandraOperations.select(sel, LogEvent.class);
    if (isPrevPaging) {
      Collections.sort(
          events,
          new Comparator<LogEvent>() {

            @Override
            public int compare(LogEvent o1, LogEvent o2) {
              return o2.getId().getTimestamp().compareTo(o1.getId().getTimestamp());
            }
          });
    }
    return events;
  }