Interface SearchQuerySelectStep<N extends SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,PJF extends SearchProjectionFactory<R,E>,PDF extends SearchPredicateFactory>

Type Parameters:
N - The next step if no type of hits is explicitly selected, i.e. if SearchQueryWhereStep.where(SearchPredicate) or SearchQueryWhereStep.where(Function) is called directly without calling selectEntity(), or selectEntityReference(), select(SearchProjection) or a similar method.
R - The type of entity references, i.e. the type of hits returned by reference queries, or the type of objects returned for entity reference projections.
E - The type of entities, i.e. the type of hits returned by entity queries, or the type of objects returned for entity projections.
LOS - The type of the initial step of the loading options definition DSL accessible through SearchQueryOptionsStep.loading(Consumer).
PJF - The type of factory used to create projections in select(Function).
PDF - The type of factory used to create predicates in SearchQueryWhereStep.where(Function).
All Superinterfaces:
SearchQueryWhereStep<N,E,LOS,PDF>
All Known Subinterfaces:
ElasticsearchSearchQuerySelectStep<R,E,LOS>, LuceneSearchQuerySelectStep<R,E,LOS>
All Known Implementing Classes:
AbstractDelegatingSearchQuerySelectStep, AbstractSearchQuerySelectStep

public interface SearchQuerySelectStep<N extends SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,PJF extends SearchProjectionFactory<R,E>,PDF extends SearchPredicateFactory> extends SearchQueryWhereStep<N,E,LOS,PDF>
The initial step in a query definition, where the element used to represent query hits, i.e. the "SELECT" clause, can be set.

The "SELECT" clause may be omitted by setting the "WHERE" clause directly, in which case selectEntity() will be assumed.

  • Method Details

    • selectEntity

      SearchQueryWhereStep<?,E,LOS,?> selectEntity()
      Select the entity was originally indexed as a representation of the search hit for each matching document.

      The entity will be loaded directly from its original source (relational database, ...).

      Returns:
      The next step.
      See Also:
    • selectEntityReference

      SearchQueryWhereStep<?,R,LOS,?> selectEntityReference()
      Select a reference to the entity that was originally indexed as a representation of the search hit for each matching document.

      Entity references are instances of type EntityReference, but some mappers may expose a different type for backwards compatibility reasons. EntityReference should be favored wherever possible as mapper-specific types will eventually be removed.

      Returns:
      The next step.
      See Also:
    • select

      <P> SearchQueryWhereStep<?,P,LOS,?> select(Class<P> objectClass)
      Select an object projection as a representation of the search hit for each matching document.
      Type Parameters:
      P - The resulting type of the projection.
      Parameters:
      objectClass - The type of objects returned by the projection. The class is expected to be mapped (generally through annotations) in such a way that it defines the inner projections.
      Returns:
      The next step.
      See Also:
    • select

      <P> SearchQueryWhereStep<?,P,LOS,?> select(Function<? super PJF,? extends ProjectionFinalStep<P>> projectionContributor)
      Select a given projection as a representation of the search hit for each matching document.
      Type Parameters:
      P - The resulting type of the projection.
      Parameters:
      projectionContributor - A function that will use the factory passed in parameter to create a projection, returning the final step in the projection DSL. Should generally be a lambda expression.
      Returns:
      The next step.
      See Also:
    • select

      <P> SearchQueryWhereStep<?,P,LOS,?> select(SearchProjection<P> projection)
      Select a projection as a representation of the search hit for each matching document.
      Type Parameters:
      P - The resulting type of the projection.
      Parameters:
      projection - A previously-created SearchProjection object.
      Returns:
      The next step.
      See Also:
    • select

      SearchQueryWhereStep<?,List<?>,LOS,?> select(SearchProjection<?>... projections)
      Select a list of projections as a representation of the search hit for each matching document.

      Note that using this method will force you to use casts when consuming the results, since the returned lists are not typed (List<?> instead of List<T>). You can replace calls to this method advantageously with calls to select(Function) defining a composite projection.

      Parameters:
      projections - A list of previously-created SearchProjection objects.
      Returns:
      The next step.
      See Also:
    • extension

      <T> T extension(SearchQueryDslExtension<T,R,E,LOS> extension)
      Extend the current DSL step with the given extension, resulting in an extended step offering more query options.
      Type Parameters:
      T - The type of DSL step provided by the extension.
      Parameters:
      extension - The extension to the query DSL.
      Returns:
      The extended DSL step.
      Throws:
      SearchException - If the extension cannot be applied (wrong underlying backend, ...).