Class SearchScopeImpl<E>
- java.lang.Object
-
- org.hibernate.search.mapper.orm.scope.impl.SearchScopeImpl<E>
-
- All Implemented Interfaces:
SearchScope<E>
public class SearchScopeImpl<E> extends Object implements SearchScope<E>
-
-
Constructor Summary
Constructors Constructor Description SearchScopeImpl(HibernateOrmScopeMappingContext mappingContext, TenancyConfiguration tenancyConfiguration, PojoScopeDelegate<EntityReference,E,HibernateOrmScopeIndexedTypeContext<? extends E>> delegate)
-
Method Summary
All Methods Instance Methods Concrete 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.SearchHighlighterFactoryhighlighter()Initiate the building of a highlighter that will be valid for the indexes in this scope.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.MassIndexermassIndexer(Set<String> tenantIds)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.PojoScopeSchemaManagerschemaManagerDelegate()SearchQuerySelectStep<?,EntityReference,E,SearchLoadingOptionsStep,?,?>search(HibernateOrmScopeSessionContext sessionContext, HibernateOrmSelectionLoadingContext.Builder loadingContextBuilder)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.
-
-
-
Constructor Detail
-
SearchScopeImpl
public SearchScopeImpl(HibernateOrmScopeMappingContext mappingContext, TenancyConfiguration tenancyConfiguration, PojoScopeDelegate<EntityReference,E,HibernateOrmScopeIndexedTypeContext<? extends E>> delegate)
-
-
Method Detail
-
search
public SearchQuerySelectStep<?,EntityReference,E,SearchLoadingOptionsStep,?,?> search(HibernateOrmScopeSessionContext sessionContext, HibernateOrmSelectionLoadingContext.Builder loadingContextBuilder)
-
predicate
public SearchPredicateFactory predicate()
Description copied from interface:SearchScopeInitiate 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.- Specified by:
predicatein interfaceSearchScope<E>- Returns:
- A predicate factory.
- See Also:
SearchPredicateFactory
-
sort
public SearchSortFactory sort()
Description copied from interface:SearchScopeInitiate 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.- Specified by:
sortin interfaceSearchScope<E>- Returns:
- A sort factory.
- See Also:
SearchSortFactory
-
projection
public SearchProjectionFactory<EntityReference,E> projection()
Description copied from interface:SearchScopeInitiate 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.- Specified by:
projectionin interfaceSearchScope<E>- Returns:
- A projection factory.
- See Also:
SearchProjectionFactory
-
aggregation
public SearchAggregationFactory aggregation()
Description copied from interface:SearchScopeInitiate 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.- Specified by:
aggregationin interfaceSearchScope<E>- Returns:
- An aggregation factory.
- See Also:
SearchAggregationFactory
-
highlighter
public SearchHighlighterFactory highlighter()
Description copied from interface:SearchScopeInitiate the building of a highlighter that will be valid for the indexes in this scope.The highlighter 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 highlighters with lambdaswithin the search query DSL, removing the need to create separate objects to represent the projections.- Specified by:
highlighterin interfaceSearchScope<E>- Returns:
- A highlighter factory.
-
schemaManager
public SearchSchemaManager schemaManager()
Description copied from interface:SearchScopeCreate aSearchSchemaManagerfor the indexes mapped to types in this scope, or to any of their sub-types.- Specified by:
schemaManagerin interfaceSearchScope<E>- Returns:
- A
SearchSchemaManager.
-
workspace
public SearchWorkspace workspace()
Description copied from interface:SearchScopeCreate 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
SearchScope.workspace(String)instead.- Specified by:
workspacein interfaceSearchScope<E>- Returns:
- A
SearchWorkspace.
-
workspace
public SearchWorkspace workspace(String tenantId)
Description copied from interface:SearchScopeCreate 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
SearchScope.workspace()instead.- Specified by:
workspacein interfaceSearchScope<E>- Parameters:
tenantId- The identifier of the tenant whose index content should be targeted.- Returns:
- A
SearchWorkspace.
-
massIndexer
public MassIndexer massIndexer()
Description copied from interface:SearchScopeCreate aMassIndexerfor 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
SearchScope.massIndexer(String)/SearchScope.massIndexer(Set)instead. In case this method is used in multi-tenant environment -MassIndexerfor all configured tenants will be created.MassIndexerinstances cannot be reused.- Specified by:
massIndexerin interfaceSearchScope<E>- Returns:
- A
MassIndexer.
-
massIndexer
public MassIndexer massIndexer(String tenantId)
Description copied from interface:SearchScopeCreate 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
SearchScope.massIndexer()instead.MassIndexerinstances cannot be reused.- Specified by:
massIndexerin interfaceSearchScope<E>- Parameters:
tenantId- The identifier of the tenant whose index content should be targeted.- Returns:
- A
MassIndexer.
-
massIndexer
public MassIndexer massIndexer(Set<String> tenantIds)
Description copied from interface:SearchScopeCreate aMassIndexerfor 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.
MassIndexerinstances cannot be reused.- Specified by:
massIndexerin interfaceSearchScope<E>- Parameters:
tenantIds- The tenants identifiers whose index content should be targeted. If empty, all tenants will be targeted.- Returns:
- A
MassIndexer.
-
includedTypes
public Set<? extends SearchIndexedEntity<? extends E>> includedTypes()
- Specified by:
includedTypesin interfaceSearchScope<E>- Returns:
- A set containing one
SearchIndexedEntityfor each indexed entity in this scope.
-
extension
public <T> T extension(IndexScopeExtension<T> extension)
Description copied from interface:SearchScopeExtend the current search scope with the given extension, resulting in an extended search scope offering backend-specific utilities.- Specified by:
extensionin interfaceSearchScope<E>- Type Parameters:
T- The type of search scope provided by the extension.- Parameters:
extension- The extension to apply.- Returns:
- The extended search scope.
-
schemaManagerDelegate
public PojoScopeSchemaManager schemaManagerDelegate()
-
-