Interface SearchScope<E>
- Type Parameters:
E
- A supertype of all types in this scope.
The scope can be used for search, to build search-related objects (predicate, sort, projection, aggregation, ...),
or to define the targeted entities/indexes
when passing it to the session
.
It can also be used to start large-scale operations, e.g. using a schemaManager()
, a workspace()
or a massIndexer()
.
-
Method Summary
Modifier and TypeMethodDescriptionInitiate the building of a search aggregation that will be valid for the indexes in this scope.<T> T
extension
(IndexScopeExtension<T> extension) Extend the current search scope with the given extension, resulting in an extended search scope offering backend-specific utilities.Initiate the building of a highlighter that will be valid for the indexes in this scope.Set
<? extends SearchIndexedEntity<? extends E>> Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.massIndexer
(Object tenantId) Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.massIndexer
(String tenantId) Deprecated, for removal: This API element is subject to removal in a future version.massIndexer
(Set<?> tenantIds) Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.Initiate the building of a search predicate.Initiate the building of a search projection that will be valid for the indexes in this scope.Create aSearchSchemaManager
for the indexes mapped to types in this scope, or to any of their sub-types.sort()
Initiate the building of a search sort.Create aSearchWorkspace
for the indexes mapped to types in this scope, or to any of their sub-types.Create aSearchWorkspace
for the indexes mapped to types in this scope, or to any of their sub-types.Deprecated, for removal: This API element is subject to removal in a future version.Useworkspace(Object)
instead.
-
Method Details
-
predicate
SearchPredicateFactory predicate()Initiate the building of a search predicate.The predicate will only be valid for
search queries
created using this scope or another scope instance targeting the same indexes.Note this method is only necessary if you do not want to use lambda expressions, since you can
define predicates with lambdas
within the search query DSL, removing the need to create separate objects to represent the predicates.- Returns:
- A predicate factory.
- See Also:
-
sort
SearchSortFactory sort()Initiate the building of a search sort.The sort will only be valid for
search queries
created using this scope or another scope instance targeting the same indexes. or a wider scope.Note this method is only necessary if you do not want to use lambda expressions, since you can
define sorts with lambdas
within the search query DSL, removing the need to create separate objects to represent the sorts.- Returns:
- A sort factory.
- See Also:
-
projection
SearchProjectionFactory<EntityReference,E> projection()Initiate the building of a search projection that will be valid for the indexes in this scope.The projection will only be valid for
search queries
created using this scope or another scope instance targeting the same indexes.Note this method is only necessary if you do not want to use lambda expressions, since you can
SearchQuerySelectStep.select(Function)
define projections with lambdas} within the search query DSL, removing the need to create separate objects to represent the projections.- Returns:
- A projection factory.
- See Also:
-
aggregation
SearchAggregationFactory aggregation()Initiate the building of a search aggregation that will be valid for the indexes in this scope.The aggregation will only be usable in
search queries
created using this scope or another scope instance targeting the same indexes.Note this method is only necessary if you do not want to use lambda expressions, since you can
SearchQueryOptionsStep.aggregation(AggregationKey, SearchAggregation)
define aggregations with lambdas} within the search query DSL, removing the need to create separate objects to represent the aggregation.- Returns:
- An aggregation factory.
- See Also:
-
schemaManager
SearchSchemaManager schemaManager()Create aSearchSchemaManager
for the indexes mapped to types in this scope, or to any of their sub-types.- Returns:
- A
SearchSchemaManager
.
-
highlighter
SearchHighlighterFactory highlighter()Initiate the building of a highlighter that will be valid for the indexes in this scope.The highlighter will only be valid for
search queries
created using this scope or another scope instance targeting the same indexes.Note this method is only necessary if you do not want to use lambda expressions, since you can
define highlighters with lambdas
within the search query DSL, removing the need to create separate objects to represent the projections.- Returns:
- A highlighter factory.
-
workspace
SearchWorkspace workspace()Create aSearchWorkspace
for the indexes mapped to types in this scope, or to any of their sub-types.This method only works for single-tenant applications. If multi-tenancy is enabled, use
workspace(String)
instead.- Returns:
- A
SearchWorkspace
.
-
workspace
Deprecated, for removal: This API element is subject to removal in a future version.Useworkspace(Object)
instead.Create aSearchWorkspace
for the indexes mapped to types in this scope, or to any of their sub-types.This method only works for multi-tenant applications. If multi-tenancy is disabled, use
workspace()
instead.- Parameters:
tenantId
- The identifier of the tenant whose index content should be targeted.- Returns:
- A
SearchWorkspace
.
-
workspace
Create aSearchWorkspace
for the indexes mapped to types in this scope, or to any of their sub-types.This method only works for multi-tenant applications. If multi-tenancy is disabled, use
workspace()
instead.- Parameters:
tenantId
- The identifier of the tenant whose index content should be targeted.- Returns:
- A
SearchWorkspace
.
-
massIndexer
MassIndexer massIndexer()Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.This method primarily is intended for single-tenant applications. If multi-tenancy is enabled, consider using
massIndexer(String)
/massIndexer(Set)
instead. In case this method is used in multi-tenant environment -MassIndexer
for all configured tenants will be created.MassIndexer
instances cannot be reused.- Returns:
- A
MassIndexer
.
-
massIndexer
Deprecated, for removal: This API element is subject to removal in a future version.UsemassIndexer(Object)
instead.Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.This method only works for multi-tenant applications. If multi-tenancy is disabled, use
massIndexer()
instead.MassIndexer
instances cannot be reused.- Parameters:
tenantId
- The identifier of the tenant whose index content should be targeted.- Returns:
- A
MassIndexer
.
-
massIndexer
Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.This method only works for multi-tenant applications. If multi-tenancy is disabled, use
massIndexer()
instead.MassIndexer
instances cannot be reused.- Parameters:
tenantId
- The identifier of the tenant whose index content should be targeted.- Returns:
- A
MassIndexer
.
-
massIndexer
Create aMassIndexer
for the indexes mapped to types in this scope, or to any of their sub-types.This method works for both single- and multi-tenant applications. If multi-tenancy is disabled, simply keep the set of tenants empty.
MassIndexer
instances cannot be reused.- Parameters:
tenantIds
- The tenants identifiers whose index content should be targeted. If empty, all tenants will be targeted.- Returns:
- A
MassIndexer
.
-
includedTypes
Set<? extends SearchIndexedEntity<? extends E>> includedTypes()- Returns:
- A set containing one
SearchIndexedEntity
for each indexed entity in this scope.
-
extension
Extend the current search scope with the given extension, resulting in an extended search scope offering backend-specific utilities.- Type Parameters:
T
- The type of search scope provided by the extension.- Parameters:
extension
- The extension to apply.- Returns:
- The extended search scope.
- Throws:
SearchException
- If the extension cannot be applied (wrong underlying technology, ...).
-
massIndexer(Object)
instead.