public class DelegatingSearchProjectionFactoryContext<R,O> extends Object implements SearchProjectionFactoryContext<R,O>
| Constructor and Description |
|---|
DelegatingSearchProjectionFactoryContext(SearchProjectionFactoryContext<R,O> delegate) |
| Modifier and Type | Method and Description |
|---|---|
<P1,P2,T> CompositeProjectionContext<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.
|
<T> CompositeProjectionContext<T> |
composite(Function<List<?>,T> transformer,
SearchProjection<?>... projections)
Create a projection that will compose a custom object based on the given projections.
|
<P,T> CompositeProjectionContext<T> |
composite(Function<P,T> transformer,
SearchProjection<P> projection)
Create a projection that will compose a custom object based on one given projection.
|
<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.
|
DistanceToFieldProjectionContext |
distance(String absoluteFieldPath,
GeoPoint center)
Project on the distance from the center to a
GeoPoint field. |
DocumentReferenceProjectionContext |
documentReference()
Project the match to a
DocumentReference. |
<P> SearchProjectionFactoryExtensionContext<P,R,O> |
extension()
Create a context allowing to try to apply multiple extensions one after the other,
failing only if none of the extensions is supported.
|
<T> T |
extension(SearchProjectionFactoryContextExtension<T,R,O> extension)
Extend the current context with the given extension,
resulting in an extended context offering different types of projections.
|
FieldProjectionContext<Object> |
field(String absoluteFieldPath)
Project to the value of a field in the indexed document, without specifying a type.
|
<T> FieldProjectionContext<T> |
field(String absoluteFieldPath,
Class<T> type)
Project to the value of a field in the indexed document.
|
ObjectProjectionContext<O> |
object()
Project to an object representing the match.
|
FieldProjectionContext<Object> |
rawField(String absoluteFieldPath)
Project to the raw value of a field in the indexed document, without specifying a type.
|
<T> FieldProjectionContext<T> |
rawField(String absoluteFieldPath,
Class<T> type)
Project to the raw value of a field in the indexed document.
|
ReferenceProjectionContext<R> |
reference()
Project to a reference to the match.
|
ScoreProjectionContext |
score()
Project on the score of the hit.
|
public DelegatingSearchProjectionFactoryContext(SearchProjectionFactoryContext<R,O> delegate)
public DocumentReferenceProjectionContext documentReference()
SearchProjectionFactoryContextDocumentReference.documentReference in interface SearchProjectionFactoryContext<R,O>public ReferenceProjectionContext<R> reference()
SearchProjectionFactoryContextThe actual type of the reference depends on the mapper used to create the query: a POJO mapper may return a class/identifier couple, for example.
reference in interface SearchProjectionFactoryContext<R,O>public ObjectProjectionContext<O> object()
SearchProjectionFactoryContext
The actual type of the object depends on the entry point
for your query: an IndexManager
will return a Java representation of the document,
but a mapper may return a Java representation of the mapped object.
object in interface SearchProjectionFactoryContext<R,O>public <T> FieldProjectionContext<T> field(String absoluteFieldPath, Class<T> type)
SearchProjectionFactoryContextfield in interface SearchProjectionFactoryContext<R,O>T - The resulting type of the projection.absoluteFieldPath - The absolute path of the field.type - The resulting type of the projection.public FieldProjectionContext<Object> field(String absoluteFieldPath)
SearchProjectionFactoryContextfield in interface SearchProjectionFactoryContext<R,O>absoluteFieldPath - The absolute path of the field.public <T> FieldProjectionContext<T> rawField(String absoluteFieldPath, Class<T> type)
SearchProjectionFactoryContext
Using this method instead of SearchProjectionFactoryContext.field(String, Class) will disable some of the conversion applied to the field value,
allowing to retrieve values directly from the backend.
rawField in interface SearchProjectionFactoryContext<R,O>T - The resulting type of the projection.absoluteFieldPath - The absolute path of the field.type - The resulting type of the projection.public FieldProjectionContext<Object> rawField(String absoluteFieldPath)
SearchProjectionFactoryContext
Using this method instead of SearchProjectionFactoryContext.field(String, Class) will disable some of the conversion applied to the field value,
allowing to retrieve values directly from the backend.
rawField in interface SearchProjectionFactoryContext<R,O>absoluteFieldPath - The absolute path of the field.public ScoreProjectionContext score()
SearchProjectionFactoryContextscore in interface SearchProjectionFactoryContext<R,O>public DistanceToFieldProjectionContext distance(String absoluteFieldPath, GeoPoint center)
SearchProjectionFactoryContextGeoPoint field.distance in interface SearchProjectionFactoryContext<R,O>public <T> CompositeProjectionContext<T> composite(Function<List<?>,T> transformer, SearchProjection<?>... projections)
SearchProjectionFactoryContextcomposite in interface SearchProjectionFactoryContext<R,O>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.public <P,T> CompositeProjectionContext<T> composite(Function<P,T> transformer, SearchProjection<P> projection)
SearchProjectionFactoryContextcomposite in interface SearchProjectionFactoryContext<R,O>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.public <P1,P2,T> CompositeProjectionContext<T> composite(BiFunction<P1,P2,T> transformer, SearchProjection<P1> projection1, SearchProjection<P2> projection2)
SearchProjectionFactoryContextcomposite in interface SearchProjectionFactoryContext<R,O>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.public <P1,P2,P3,T> CompositeProjectionContext<T> composite(TriFunction<P1,P2,P3,T> transformer, SearchProjection<P1> projection1, SearchProjection<P2> projection2, SearchProjection<P3> projection3)
SearchProjectionFactoryContextcomposite in interface SearchProjectionFactoryContext<R,O>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.public <T> T extension(SearchProjectionFactoryContextExtension<T,R,O> extension)
SearchProjectionFactoryContextextension in interface SearchProjectionFactoryContext<R,O>T - The type of context provided by the extension.extension - The extension to the projection DSL.public <P> SearchProjectionFactoryExtensionContext<P,R,O> extension()
SearchProjectionFactoryContext
If you only need to apply a single extension and fail if it is not supported,
use the simpler SearchProjectionFactoryContext.extension(SearchProjectionFactoryContextExtension) method instead.
This method is generic, and you should set the generic type explicitly to the expected projected type,
e.g. .<MyProjectedType>extension().
extension in interface SearchProjectionFactoryContext<R,O>P - 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.