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. ifSearchQueryWhereStep.where(SearchPredicate)
orSearchQueryWhereStep.where(Function)
is called directly without callingselectEntity()
, orselectEntityReference()
,select(SearchProjection)
or a similar method.R
- The type of entity references, i.e. the type of hits returned byreference queries
, or the type of objects returned forentity reference projections
.E
- The type of entities, i.e. the type of hits returned byentity queries
, or the type of objects returned forentity projections
.LOS
- The type of the initial step of the loading options definition DSL accessible throughSearchQueryOptionsStep.loading(Consumer)
.PJF
- The type of factory used to create projections inselect(Function)
.PDF
- The type of factory used to create predicates inSearchQueryWhereStep.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 Summary
Modifier and TypeMethodDescription<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.<P> SearchQueryWhereStep
<?, P, LOS, ?> Select an object projection as a representation of the search hit for each matching document.<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.SearchQueryWhereStep
<?, List<?>, LOS, ?> select
(SearchProjection<?>... projections) Select a list of projections as a representation of the search hit for each matching document.<P> SearchQueryWhereStep
<?, P, LOS, ?> select
(SearchProjection<P> projection) Select a projection as a representation of the search hit for each matching document.SearchQueryWhereStep
<?, E, LOS, ?> Select the entity was originally indexed as a representation of the search hit for each matching document.SearchQueryWhereStep
<?, R, LOS, ?> Select a reference to the entity that was originally indexed as a representation of the search hit for each matching document.Methods inherited from interface org.hibernate.search.engine.search.query.dsl.SearchQueryWhereStep
where, where, where
-
Method Details
-
selectEntity
SearchQueryWhereStep<?,E, selectEntity()LOS, ?> 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, selectEntityReference()LOS, ?> 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
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, selectLOS, ?> (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
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-createdSearchProjection
object.- Returns:
- The next step.
- See Also:
-
select
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 ofList<T>
). You can replace calls to this method advantageously with calls toselect(Function)
defining acomposite projection
.- Parameters:
projections
- A list of previously-createdSearchProjection
objects.- Returns:
- The next step.
- See Also:
-
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, ...).
-