Interface SearchScope<E>
-
- Type Parameters:
E- A supertype of all types in this scope.
public interface SearchScope<E>Represents a set of types and the corresponding indexes, allowing to build search-related objects (query, predicate, ...) taking into account the relevant indexes and their metadata (underlying technology, field types, ...).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SearchAggregationFactoryaggregation()Initiate the building of a search aggregation that will be valid for the indexes in this scope.<T> Textension(IndexScopeExtension<T> extension)Extend the current search scope with the given extension, resulting in an extended search scope offering backend-specific utilities.Set<? extends SearchIndexedEntity<? extends E>>includedTypes()MassIndexermassIndexer()Create aMassIndexerfor the indexes mapped to types in this scope, or to any of their sub-types.MassIndexermassIndexer(String tenantId)Create aMassIndexerfor the indexes mapped to types in this scope, or to any of their sub-types.SearchPredicateFactorypredicate()Initiate the building of a search predicate.SearchProjectionFactory<EntityReference,E>projection()Initiate the building of a search projection that will be valid for the indexes in this scope.SearchSchemaManagerschemaManager()Create aSearchSchemaManagerfor the indexes mapped to types in this scope, or to any of their sub-types.SearchSortFactorysort()Initiate the building of a search sort.SearchWorkspaceworkspace()Create aSearchWorkspacefor the indexes mapped to types in this scope, or to any of their sub-types.SearchWorkspaceworkspace(String tenantId)Create aSearchWorkspacefor the indexes mapped to types in this scope, or to any of their sub-types.
-
-
-
Method Detail
-
predicate
SearchPredicateFactory predicate()
Initiate the building of a search predicate.The predicate will only be valid for
search queriescreated 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 lambdaswithin the search query DSL, removing the need to create separate objects to represent the predicates.- Returns:
- A predicate factory.
- See Also:
SearchPredicateFactory
-
sort
SearchSortFactory sort()
Initiate the building of a search sort.The sort will only be valid for
search queriescreated 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 lambdaswithin the search query DSL, removing the need to create separate objects to represent the sorts.- Returns:
- A sort factory.
- See Also:
SearchSortFactory
-
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 queriescreated 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:
SearchProjectionFactory
-
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 queriescreated 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:
SearchAggregationFactory
-
schemaManager
SearchSchemaManager schemaManager()
Create aSearchSchemaManagerfor the indexes mapped to types in this scope, or to any of their sub-types.- Returns:
- A
SearchSchemaManager.
-
workspace
SearchWorkspace workspace()
Create aSearchWorkspacefor 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
SearchWorkspace workspace(String tenantId)
Create aSearchWorkspacefor 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 aMassIndexerfor 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
massIndexer(String)instead.MassIndexerinstances cannot be reused.- Returns:
- A
MassIndexer.
-
massIndexer
MassIndexer massIndexer(String tenantId)
Create aMassIndexerfor 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.MassIndexerinstances cannot be reused.- Parameters:
tenantId- The identifier of the tenant whose index content should be targeted.- Returns:
- A
MassIndexer.
-
includedTypes
Set<? extends SearchIndexedEntity<? extends E>> includedTypes()
- Returns:
- A set containing one
SearchIndexedEntityfor each indexed entity in this scope.
-
extension
<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.- 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, ...).
-
-