Interface HighlightProjectionOptionsStep
- All Superinterfaces:
HighlightProjectionFinalStep,ProjectionFinalStep<List<String>>
-
Method Summary
Modifier and TypeMethodDescriptiondefault ProjectionFinalStep<String[]> array()Changes the collection accumulating the values toString[]instead ofList.<R> ProjectionFinalStep<R> collector(ProjectionCollector.Provider<String, R> collector) Defines the collector to apply to the highlighted strings.highlighter(String highlighterName) Defines a name of a named highlighter to be used by this field projection.default ProjectionFinalStep<String> nullable()Defines the projection as single-valued, i.e. returningStringinstead ofList<String>.default ProjectionFinalStep<Optional<String>> optional()Defines the projection as single-valued wrapped in anOptional, i.e. returningOptional<String>instead ofList<String>.default ProjectionFinalStep<Set<String>> set()single()Deprecated.default ProjectionFinalStep<SortedSet<String>> default ProjectionFinalStep<SortedSet<String>> sortedSet(Comparator<String> comparator) Methods inherited from interface org.hibernate.search.engine.search.projection.dsl.ProjectionFinalStep
toProjection
-
Method Details
-
highlighter
Defines a name of a named highlighter to be used by this field projection.- Parameters:
highlighterName- The name of a highlighterdefined on the query.- Returns:
- A final step to finish the definition of a highlight projection.
- See Also:
-
single
Deprecated.Use thecollector(ProjectionCollector.Provider)instead, e.g..collector(ProjectionCollector.single())Defines the projection as single-valued, i.e. returningStringinstead ofList<String>.Can only be used when the highlighter that creates highlighted fragments for this projection is configured to return a single fragment at most, i.e. when
.numberOfFragments(1)is applied to the highlighter. Otherwise, it will lead to an exception being thrown when the query is created.- Returns:
- A final step in the highlight projection definition.
- See Also:
-
collector
Defines the collector to apply to the highlighted strings.By default, highlighting results in a list
List<String>of highlighted strings. This method allows changing the returned type to a different collection of strings, e.g.Set<String>/String[]or obtaining a single-valued projection (i.e.projectionCollectorProvider.isSingleValued () == true).Note: single-valued projections can only be used when the highlighter that creates highlighted fragments for this projection is configured to return a single fragment at most, i.e. when
.numberOfFragments(1)is applied to the highlighter. Otherwise, it will lead to an exception being thrown when the query is created.- Type Parameters:
R- The type of the final result.- Parameters:
collector- The collector provider to apply to this projection.- Returns:
- A final step in the highlight projection definition.
-
nullable
Defines the projection as single-valued, i.e. returningStringinstead ofList<String>.Can only be used when the highlighter that creates highlighted fragments for this projection is configured to return a single fragment at most, i.e. when
.numberOfFragments(1)is applied to the highlighter. Otherwise, it will lead to an exception being thrown when the query is created.- Returns:
- A final step in the highlight projection definition.
- See Also:
-
optional
Defines the projection as single-valued wrapped in anOptional, i.e. returningOptional<String>instead ofList<String>.Can only be used when the highlighter that creates highlighted fragments for this projection is configured to return a single fragment at most, i.e. when
.numberOfFragments(1)is applied to the highlighter. Otherwise, it will lead to an exception being thrown when the query is created.- Returns:
- A final step in the highlight projection definition.
- See Also:
-
set
- Returns:
- A final step in the highlight projection definition.
-
sortedSet
- Returns:
- A final step in the highlight projection definition.
-
sortedSet
- Parameters:
comparator- The comparator to use for sorting strings within the set.- Returns:
- A final step in the highlight projection definition.
-
array
Changes the collection accumulating the values toString[]instead ofList.- Returns:
- A final step in the highlight projection definition.
-
collector(ProjectionCollector.Provider)instead, e.g.