R - The type of entity references, i.e. the type of objects returned for
entity reference projections.E - The type of entities, i.e. the type of objects returned for
entity projections.public interface SearchProjectionFactory<R,E>
| Modifier and Type | Method and Description |
|---|---|
default <P1,P2,T> CompositeProjectionOptionsStep<T> |
composite(BiFunction<P1,P2,T> transformer,
ProjectionFinalStep<P1> dslFinalStep1,
ProjectionFinalStep<P2> dslFinalStep2)
Create a projection that will compose a custom object based on two almost-built projections.
|
<P1,P2,T> CompositeProjectionOptionsStep<T> |
composite(BiFunction<P1,P2,T> transformer,
SearchProjection<P1> projection1,
SearchProjection<P2> projection2)
Create a projection that will compose a custom object based on two given projections.
|
default <T> CompositeProjectionOptionsStep<T> |
composite(Function<List<?>,T> transformer,
ProjectionFinalStep<?>... dslFinalSteps)
Create a projection that will compose a custom object based on the given almost-built projections.
|
<T> CompositeProjectionOptionsStep<T> |
composite(Function<List<?>,T> transformer,
SearchProjection<?>... projections)
Create a projection that will compose a custom object based on the given projections.
|
default <P,T> CompositeProjectionOptionsStep<T> |
composite(Function<P,T> transformer,
ProjectionFinalStep<P> dslFinalStep)
Create a projection that will compose a custom object based on one almost-built projection.
|
<P,T> CompositeProjectionOptionsStep<T> |
composite(Function<P,T> transformer,
SearchProjection<P> projection)
Create a projection that will compose a custom object based on one given projection.
|
default CompositeProjectionOptionsStep<List<?>> |
composite(ProjectionFinalStep<?>... dslFinalSteps)
Create a projection that will compose a
List based on the given almost-built projections. |
default CompositeProjectionOptionsStep<List<?>> |
composite(SearchProjection<?>... projections)
Create a projection that will compose a
List based on the given projections. |
default <P1,P2,P3,T> |
composite(TriFunction<P1,P2,P3,T> transformer,
ProjectionFinalStep<P1> dslFinalStep1,
ProjectionFinalStep<P2> dslFinalStep2,
ProjectionFinalStep<P3> dslFinalStep3)
Create a projection that will compose a custom object based on three almost-built projections.
|
<P1,P2,P3,T> |
composite(TriFunction<P1,P2,P3,T> transformer,
SearchProjection<P1> projection1,
SearchProjection<P2> projection2,
SearchProjection<P3> projection3)
Create a projection that will compose a custom object based on three given projections.
|
DistanceToFieldProjectionOptionsStep |
distance(String absoluteFieldPath,
GeoPoint center)
Project on the distance from the center to a
GeoPoint field. |
DocumentReferenceProjectionOptionsStep |
documentReference()
Project the match to a
DocumentReference. |
EntityProjectionOptionsStep<E> |
entity()
Project to the entity was originally indexed.
|
EntityReferenceProjectionOptionsStep<R> |
entityReference()
Project to a reference to the entity that was originally indexed.
|
<T> SearchProjectionFactoryExtensionIfSupportedStep<T,R,E> |
extension()
Create a DSL step allowing multiple attempts to apply extensions one after the other,
failing only if none of the extensions is supported.
|
<T> T |
extension(SearchProjectionFactoryExtension<T,R,E> extension)
Extend the current factory with the given extension,
resulting in an extended factory offering different types of projections.
|
default FieldProjectionOptionsStep<Object> |
field(String absoluteFieldPath)
Project to the value of a field in the indexed document, without specifying a type.
|
default <T> FieldProjectionOptionsStep<T> |
field(String absoluteFieldPath,
Class<T> type)
Project to the value of a field in the indexed document.
|
<T> FieldProjectionOptionsStep<T> |
field(String absoluteFieldPath,
Class<T> type,
ValueConvert convert)
Project to the value of a field in the indexed document.
|
FieldProjectionOptionsStep<Object> |
field(String absoluteFieldPath,
ValueConvert convert)
Project to the value of a field in the indexed document, without specifying a type.
|
ScoreProjectionOptionsStep |
score()
Project on the score of the hit.
|
DocumentReferenceProjectionOptionsStep documentReference()
DocumentReference.EntityReferenceProjectionOptionsStep<R> entityReference()
The actual type of the reference depends on the mapper used to create the query: the ORM mapper will return a class/identifier pair, for example.
EntityProjectionOptionsStep<E> entity()
The actual type of the entity depends on the mapper used to create the query and on the indexes targeted by your query: the ORM mapper will return a managed entity loaded from the database, for example.
default <T> FieldProjectionOptionsStep<T> field(String absoluteFieldPath, Class<T> type)
This method will apply projection converters on data fetched from the backend.
See ValueConvert.YES.
T - The resulting type of the projection.absoluteFieldPath - The absolute path of the field.type - The resulting type of the projection.<T> FieldProjectionOptionsStep<T> field(String absoluteFieldPath, Class<T> type, ValueConvert convert)
T - The resulting type of the projection.absoluteFieldPath - The absolute path of the field.type - The resulting type of the projection.convert - Controls how the data fetched from the backend should be converted.
See ValueConvert.default FieldProjectionOptionsStep<Object> field(String absoluteFieldPath)
This method will apply projection converters on data fetched from the backend.
See ValueConvert.YES.
absoluteFieldPath - The absolute path of the field.FieldProjectionOptionsStep<Object> field(String absoluteFieldPath, ValueConvert convert)
absoluteFieldPath - The absolute path of the field.convert - Controls how the data fetched from the backend should be converted.
See ValueConvert.ScoreProjectionOptionsStep score()
DistanceToFieldProjectionOptionsStep distance(String absoluteFieldPath, GeoPoint center)
GeoPoint field.absoluteFieldPath - The absolute path of the field.center - The center to compute the distance from.default CompositeProjectionOptionsStep<List<?>> composite(SearchProjection<?>... projections)
List based on the given projections.projections - The projections used to populate the list, in order.default CompositeProjectionOptionsStep<List<?>> composite(ProjectionFinalStep<?>... dslFinalSteps)
List based on the given almost-built projections.dslFinalSteps - The final steps in the projection DSL allowing the retrieval of SearchProjections.<T> CompositeProjectionOptionsStep<T> composite(Function<List<?>,T> transformer, SearchProjection<?>... projections)
T - The type of the custom object composing the projected elements.transformer - The function that will transform the list of projected elements into a custom object.projections - The projections used to populate the list, in order.default <T> CompositeProjectionOptionsStep<T> composite(Function<List<?>,T> transformer, ProjectionFinalStep<?>... dslFinalSteps)
T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected element into a custom object.dslFinalSteps - The final steps in the projection DSL allowing the retrieval of SearchProjections.<P,T> CompositeProjectionOptionsStep<T> composite(Function<P,T> transformer, SearchProjection<P> projection)
P - The type of the element passed to the transformer.T - The type of the custom object composing the projected element.transformer - The function that will transform the projected element into a custom object.projection - The original projection used to produce the element passed to the transformer.default <P,T> CompositeProjectionOptionsStep<T> composite(Function<P,T> transformer, ProjectionFinalStep<P> dslFinalStep)
P - The type of the element passed to the transformer.T - The type of the custom object composing the projected element.transformer - The function that will transform the projected element into a custom object.dslFinalStep - The final step in the projection DSL allowing the retrieval of the SearchProjection
that will be used to produce the element passed to the transformer.<P1,P2,T> CompositeProjectionOptionsStep<T> composite(BiFunction<P1,P2,T> transformer, SearchProjection<P1> projection1, SearchProjection<P2> projection2)
P1 - The type of the first element passed to the transformer.P2 - The type of the second element passed to the transformer.T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected elements into a custom object.projection1 - The projection used to produce the first element passed to the transformer.projection2 - The projection used to produce the second element passed to the transformer.default <P1,P2,T> CompositeProjectionOptionsStep<T> composite(BiFunction<P1,P2,T> transformer, ProjectionFinalStep<P1> dslFinalStep1, ProjectionFinalStep<P2> dslFinalStep2)
P1 - The type of the first element passed to the transformer.P2 - The type of the second element passed to the transformer.T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected elements into a custom object.dslFinalStep1 - The final step in the projection DSL allowing the retrieval of the SearchProjection
that will be used to produce the first element passed to the transformer.dslFinalStep2 - The final step in the projection DSL allowing the retrieval of the SearchProjection
that will be used to produce the second element passed to the transformer.<P1,P2,P3,T> CompositeProjectionOptionsStep<T> composite(TriFunction<P1,P2,P3,T> transformer, SearchProjection<P1> projection1, SearchProjection<P2> projection2, SearchProjection<P3> projection3)
P1 - The type of the first element passed to the transformer.P2 - The type of the second element passed to the transformer.P3 - The type of the third element passed to the transformer.T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected elements into a custom object.projection1 - The projection used to produce the first element passed to the transformer.projection2 - The projection used to produce the second element passed to the transformer.projection3 - The projection used to produce the third element passed to the transformer.default <P1,P2,P3,T> CompositeProjectionOptionsStep<T> composite(TriFunction<P1,P2,P3,T> transformer, ProjectionFinalStep<P1> dslFinalStep1, ProjectionFinalStep<P2> dslFinalStep2, ProjectionFinalStep<P3> dslFinalStep3)
P1 - The type of the first element passed to the transformer.P2 - The type of the second element passed to the transformer.P3 - The type of the third element passed to the transformer.T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected elements into a custom object.dslFinalStep1 - The final step in the projection DSL allowing the retrieval of the SearchProjection
that will be used to produce the first element passed to the transformer.dslFinalStep2 - The final step in the projection DSL allowing the retrieval of the SearchProjection
that will be used to produce the second element passed to the transformer.dslFinalStep3 - The final step in the projection DSL allowing the retrieval of the SearchProjection
that will be used to produce the third element passed to the transformer.<T> T extension(SearchProjectionFactoryExtension<T,R,E> extension)
T - The type of factory provided by the extension.extension - The extension to the projection DSL.SearchException - If the extension cannot be applied (wrong underlying backend, ...).<T> SearchProjectionFactoryExtensionIfSupportedStep<T,R,E> extension()
If you only need to apply a single extension and fail if it is not supported,
use the simpler extension(SearchProjectionFactoryExtension) method instead.
This method is generic, and you should set the generic type explicitly to the expected projected type,
e.g. .<MyProjectedType>extension().
T - The expected projected type.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.