Class ElasticsearchIdProjection<I>
java.lang.Object
org.hibernate.search.backend.elasticsearch.search.projection.impl.AbstractElasticsearchProjection<I>
org.hibernate.search.backend.elasticsearch.search.projection.impl.ElasticsearchIdProjection<I>
- All Implemented Interfaces:
ElasticsearchSearchProjection<I>,ElasticsearchSearchProjection.Extractor<String,,I> SearchProjection<I>
public class ElasticsearchIdProjection<I>
extends AbstractElasticsearchProjection<I>
implements ElasticsearchSearchProjection.Extractor<String,I>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.hibernate.search.backend.elasticsearch.search.projection.impl.AbstractElasticsearchProjection
AbstractElasticsearchProjection.AbstractBuilder<P>Nested classes/interfaces inherited from interface org.hibernate.search.backend.elasticsearch.search.projection.impl.ElasticsearchSearchProjection
ElasticsearchSearchProjection.Extractor<E,P> -
Field Summary
Fields inherited from class org.hibernate.search.backend.elasticsearch.search.projection.impl.AbstractElasticsearchProjection
indexNamesFields inherited from interface org.hibernate.search.backend.elasticsearch.search.projection.impl.ElasticsearchSearchProjection
log -
Method Summary
Modifier and TypeMethodDescriptionextract(ProjectionHitMapper<?> projectionHitMapper, com.google.gson.JsonObject hit, com.google.gson.JsonObject source, ProjectionExtractContext context) Performs hit extraction.request(com.google.gson.JsonObject requestBody, ProjectionRequestContext context) Contributes to the request, making sure that the requirements for this projection are met, and creating anElasticsearchSearchProjection.Extractorthat will be able to extract the result of the projection from the Elasticsearch response.toString()transform(LoadingResult<?> loadingResult, String extractedData, ProjectionTransformContext context) Transforms the extracted data to the actual projection result.Methods inherited from class org.hibernate.search.backend.elasticsearch.search.projection.impl.AbstractElasticsearchProjection
indexNames
-
Method Details
-
toString
-
request
public ElasticsearchSearchProjection.Extractor<?,I> request(com.google.gson.JsonObject requestBody, ProjectionRequestContext context) Description copied from interface:ElasticsearchSearchProjectionContributes to the request, making sure that the requirements for this projection are met, and creating anElasticsearchSearchProjection.Extractorthat will be able to extract the result of the projection from the Elasticsearch response.- Specified by:
requestin interfaceElasticsearchSearchProjection<I>- Parameters:
requestBody- The request body.context- An execution context for the request.- Returns:
- An
ElasticsearchSearchProjection.Extractor, to extract the result of the projection from the Elasticsearch response.
-
extract
public String extract(ProjectionHitMapper<?> projectionHitMapper, com.google.gson.JsonObject hit, com.google.gson.JsonObject source, ProjectionExtractContext context) Description copied from interface:ElasticsearchSearchProjection.ExtractorPerforms hit extraction.Implementations should only perform operations relative to extracting content from the index, delaying operations that rely on the mapper until
ElasticsearchSearchProjection.Extractor.transform(LoadingResult, Object, ProjectionTransformContext)is called, so that blocking mapper operations (if any) do not pollute backend threads.- Specified by:
extractin interfaceElasticsearchSearchProjection.Extractor<String,I> - Parameters:
projectionHitMapper- The projection hit mapper used to transform hits to entities.hit- The part of the response body relevant to the hit to extract.source- The part of the source that this extractor should extract from (if relevant).context- An execution context for the extraction.- Returns:
- The element extracted from the hit. Might be a key referring to an object that will be loaded by the
ProjectionHitMapper. This returned object will be passed toElasticsearchSearchProjection.Extractor.transform(LoadingResult, Object, ProjectionTransformContext).
-
transform
public I transform(LoadingResult<?> loadingResult, String extractedData, ProjectionTransformContext context) Description copied from interface:ElasticsearchSearchProjection.ExtractorTransforms the extracted data to the actual projection result.- Specified by:
transformin interfaceElasticsearchSearchProjection.Extractor<String,I> - Parameters:
loadingResult- Container containing all the entities that have been loaded by theProjectionHitMapper.extractedData- The extracted data to transform, coming from theElasticsearchSearchProjection.Extractor.extract(ProjectionHitMapper, JsonObject, JsonObject, ProjectionExtractContext)method.context- An execution context for the transforming.- Returns:
- The final result considered as a hit.
-