Interface Query<T>

All Superinterfaces:
Iterable<T>

public interface Query<T> extends Iterable<T>
Since:
15.0
  • Method Details

    • getQueryString

      String getQueryString()
      Returns the Ickle query string.
    • list

      List<T> list()
      Returns the results of a search as a list.
      Returns:
      a list of objects that were found in the search.
    • execute

      QueryResult<T> execute()
      Executes the query (a SELECT statement). Subsequent invocations cause the query to be re-executed.

      Executing a DELETE is also allowed. In this case, no results will be returned, but the number of affected entries will be returned as the hit count in the QueryResult.

      Returns:
      QueryResult with the results.
    • executeStatement

      int executeStatement()
      Executes a data modifying statement (typically a DELETE) that does not return results; instead it returns the count of affected entries. This method cannot be used to execute a SELECT.

      NOTE: Paging parameters (firstResult/maxResults) are NOT allowed.

      Returns:
      the number of affected (deleted) entries
    • hasProjections

      boolean hasProjections()
      Indicates if the parsed query has projections (a SELECT clause) and consequently, the returned results will actually be Object[] containing the projected values rather than the target entity.
      Returns:
      true if it has projections, false otherwise.
    • getStartOffset

      long getStartOffset()
    • startOffset

      Query<T> startOffset(long startOffset)
    • getMaxResults

      int getMaxResults()
    • maxResults

      Query<T> maxResults(int maxResults)
    • hitCountAccuracy

      Integer hitCountAccuracy()
      Returns:
      the current hitCountAccuracy if present
      See Also:
    • hitCountAccuracy

      Query<T> hitCountAccuracy(int hitCountAccuracy)
      Limits the required accuracy of the hit count for the indexed queries to an upper-bound. Setting the hit-count-accuracy could improve the performance of queries targeting large data sets.
      Parameters:
      hitCountAccuracy - The value to apply
      Returns:
      this, for method chaining
    • getParameters

      Map<String,Object> getParameters()
      Returns the named parameters Map.
      Returns:
      the named parameters (unmodifiable) or null if the query does not have parameters
    • setParameter

      Query<T> setParameter(String paramName, Object paramValue)
      Sets the value of a named parameter.
      Parameters:
      paramName - the parameters name (non-empty and not null)
      paramValue - a non-null value
      Returns:
      itself
    • setParameters

      Query<T> setParameters(Map<String,Object> paramValues)
      Sets multiple named parameters at once. Parameter names cannot be empty or null. Parameter values must not be null.
      Parameters:
      paramValues - a Map of parameters
      Returns:
      itself
    • iterator

      CloseableIterator<T> iterator()
      Returns a CloseableIterator over the results. Close the iterator when you are done with processing the results.
      Specified by:
      iterator in interface Iterable<T>
      Returns:
      the results of the query as an iterator.
    • entryIterator

      <K> CloseableIterator<EntityEntry<K,T>> entryIterator()
      Returns a CloseableIterator over the results, including both key and value. Close the iterator when you are done with processing the results. The query cannot use projections.
      Returns:
      the results of the query as an iterator.
    • timeout

      Query<T> timeout(long timeout, TimeUnit timeUnit)
      Set the timeout for this query. If the query hasn't finished processing before the timeout, a timeout will be thrown. For queries that use the index, the timeout is handled on a best effort basis, and the supplied time is rounded to the nearest millisecond.
    • local

      Query<T> local(boolean local)
      Set the query execution scope
      Parameters:
      local - if true, query will be restricted to the data present in the local node, ignoring the other members of the clusters
    • scoreRequired

      Query<T> scoreRequired(boolean scoreRequired)