Class DefaultSearchQuerySelectStep<R,E,LOS>
- java.lang.Object
-
- org.hibernate.search.engine.search.query.dsl.spi.AbstractSearchQuerySelectStep<SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,SearchProjectionFactory<R,E>,SearchPredicateFactory>
-
- org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQuerySelectStep<R,E,LOS>
-
- All Implemented Interfaces:
SearchQuerySelectStep<SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,SearchProjectionFactory<R,E>,SearchPredicateFactory>,SearchQueryWhereStep<SearchQueryOptionsStep<?,E,LOS,?,?>,E,LOS,SearchPredicateFactory>
public final class DefaultSearchQuerySelectStep<R,E,LOS> extends AbstractSearchQuerySelectStep<SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,SearchProjectionFactory<R,E>,SearchPredicateFactory>
-
-
Constructor Summary
Constructors Constructor Description DefaultSearchQuerySelectStep(SearchQueryIndexScope<?> scope, BackendSessionContext sessionContext, SearchLoadingContextBuilder<E,LOS> loadingContextBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SearchLoadingContextBuilder<E,LOS>loadingContextBuilder()protected SearchQueryIndexScope<?>scope()<P> SearchQueryWhereStep<?,P,LOS,?>select(Class<P> objectClass)Select an object projection as a representation of the search hit for each matching document.<P> org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<P,LOS>select(Function<? super SearchProjectionFactory<R,E>,? extends ProjectionFinalStep<P>> projectionContributor)Select a given projection as a representation of the search hit for each matching document.org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<List<?>,LOS>select(SearchProjection<?>... projections)Select a list of projections as a representation of the search hit for each matching document.<P> org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<P,LOS>select(SearchProjection<P> projection)Select a projection as a representation of the search hit for each matching document.org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<E,LOS>selectEntity()Select the entity was originally indexed as a representation of the search hit for each matching document.org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<R,LOS>selectEntityReference()Select a reference to the entity that was originally indexed as a representation of the search hit for each matching document.protected BackendSessionContextsessionContext()SearchQueryOptionsStep<?,E,LOS,?,?>where(BiConsumer<? super SearchPredicateFactory,? super SimpleBooleanPredicateClausesCollector<?>> predicateContributor)Set the predicate for this query.SearchQueryOptionsStep<?,E,LOS,?,?>where(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> predicateContributor)Set the predicate for this query.SearchQueryOptionsStep<?,E,LOS,?,?>where(SearchPredicate predicate)Set the predicate for this query.-
Methods inherited from class org.hibernate.search.engine.search.query.dsl.spi.AbstractSearchQuerySelectStep
extension
-
-
-
-
Constructor Detail
-
DefaultSearchQuerySelectStep
public DefaultSearchQuerySelectStep(SearchQueryIndexScope<?> scope, BackendSessionContext sessionContext, SearchLoadingContextBuilder<E,LOS> loadingContextBuilder)
-
-
Method Detail
-
selectEntity
public org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<E,LOS> selectEntity()
Description copied from interface:SearchQuerySelectStepSelect 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:
SearchQueryWhereStep
-
selectEntityReference
public org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<R,LOS> selectEntityReference()
Description copied from interface:SearchQuerySelectStepSelect 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.EntityReferenceshould be favored wherever possible as mapper-specific types will eventually be removed.- Returns:
- The next step.
- See Also:
SearchQueryWhereStep
-
select
public <P> SearchQueryWhereStep<?,P,LOS,?> select(Class<P> objectClass)
Description copied from interface:SearchQuerySelectStepSelect 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:
SearchQueryWhereStep
-
select
public <P> org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<P,LOS> select(Function<? super SearchProjectionFactory<R,E>,? extends ProjectionFinalStep<P>> projectionContributor)
Description copied from interface:SearchQuerySelectStepSelect 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:
SearchQueryWhereStep
-
select
public <P> org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<P,LOS> select(SearchProjection<P> projection)
Description copied from interface:SearchQuerySelectStepSelect 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-createdSearchProjectionobject.- Returns:
- The next step.
- See Also:
SearchQueryWhereStep
-
select
public org.hibernate.search.engine.search.query.dsl.impl.DefaultSearchQueryOptionsStep<List<?>,LOS> select(SearchProjection<?>... projections)
Description copied from interface:SearchQuerySelectStepSelect 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 toSearchQuerySelectStep.select(Function)defining acomposite projection.- Parameters:
projections- A list of previously-createdSearchProjectionobjects.- Returns:
- The next step.
- See Also:
SearchProjectionFactory.composite(SearchProjection[]),SearchQueryWhereStep
-
where
public SearchQueryOptionsStep<?,E,LOS,?,?> where(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> predicateContributor)
Description copied from interface:SearchQueryWhereStepSet the predicate for this query.- Parameters:
predicateContributor- A function that will use the factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
- The next step.
-
where
public SearchQueryOptionsStep<?,E,LOS,?,?> where(SearchPredicate predicate)
Description copied from interface:SearchQueryWhereStepSet the predicate for this query.- Parameters:
predicate- ASearchPredicateobject obtained from the search scope.- Returns:
- The next step.
-
where
public SearchQueryOptionsStep<?,E,LOS,?,?> where(BiConsumer<? super SearchPredicateFactory,? super SimpleBooleanPredicateClausesCollector<?>> predicateContributor)
Description copied from interface:SearchQueryWhereStepSet the predicate for this query.- Parameters:
predicateContributor- A consumer that will use the factory passed in parameter to create predicates and add them as clauses to the collector passed in parameter. Should generally be a lambda expression. The resulting root predicate will have to match all clauses.- Returns:
- The next step.
- See Also:
SimpleBooleanPredicateClausesCollector
-
scope
protected SearchQueryIndexScope<?> scope()
- Specified by:
scopein classAbstractSearchQuerySelectStep<SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,SearchProjectionFactory<R,E>,SearchPredicateFactory>
-
sessionContext
protected BackendSessionContext sessionContext()
- Specified by:
sessionContextin classAbstractSearchQuerySelectStep<SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,SearchProjectionFactory<R,E>,SearchPredicateFactory>
-
loadingContextBuilder
protected SearchLoadingContextBuilder<E,LOS> loadingContextBuilder()
- Specified by:
loadingContextBuilderin classAbstractSearchQuerySelectStep<SearchQueryOptionsStep<?,E,LOS,?,?>,R,E,LOS,SearchProjectionFactory<R,E>,SearchPredicateFactory>
-
-