org.hibernate.search.impl
Class MutableSearchFactory

java.lang.Object
  extended by org.hibernate.search.impl.MutableSearchFactory
All Implemented Interfaces:
SearchFactoryImplementor, SearchFactory, SearchFactoryImplementorWithShareableState, SearchFactoryState, SearchFactoryIntegrator

public class MutableSearchFactory
extends Object
implements SearchFactoryImplementorWithShareableState, SearchFactoryIntegrator

Factory delegating to a concrete implementation of another factory, Useful to swap one factory for another. Swapping factory is thread safe.

Author:
Emmanuel Bernard

Constructor Summary
MutableSearchFactory()
           
 
Method Summary
 void addClasses(Class<?>... classes)
          Add the following classes to the SearchFactory
 QueryContextBuilder buildQueryBuilder()
           
 void close()
           
 HSQuery createHSQuery()
          Return an Hibernate Search query object.
 Analyzer getAnalyzer(Class<?> clazz)
          Retrieves the scoped analyzer for a given class.
 Analyzer getAnalyzer(String name)
          Retrieve an analyzer instance by its definition name
 Map<String,Analyzer> getAnalyzers()
           
 BackendQueueProcessorFactory getBackendQueueProcessorFactory()
           
 int getCacheBitResultsSize()
           
 Set<Class<?>> getClassesInDirectoryProvider(DirectoryProvider<?> directoryProvider)
           
 Properties getConfigurationProperties()
           
 Map<DirectoryProvider<?>,DirectoryProviderData> getDirectoryProviderData()
           
 Map<DirectoryProvider,LuceneIndexingParameters> getDirectoryProviderIndexingParams()
           
 ReentrantLock getDirectoryProviderLock(DirectoryProvider<?> dp)
           
 Set<DirectoryProvider<?>> getDirectoryProviders()
           
 DirectoryProvider[] getDirectoryProviders(Class<?> entity)
          Provide access to the DirectoryProviders for a given entity.
<T> DocumentBuilderContainedEntity<T>
getDocumentBuilderContainedEntity(Class<T> entityType)
           
<T> DocumentBuilderIndexedEntity<T>
getDocumentBuilderIndexedEntity(Class<T> entityType)
           
 Map<Class<?>,DocumentBuilderContainedEntity<?>> getDocumentBuildersContainedEntities()
           
 Map<Class<?>,DocumentBuilderIndexedEntity<?>> getDocumentBuildersIndexedEntities()
           
 ErrorHandler getErrorHandler()
           
 int getFilterCacheBitResultsSize()
           
 FilterCachingStrategy getFilterCachingStrategy()
           
 FilterDef getFilterDefinition(String name)
           
 Map<String,FilterDef> getFilterDefinitions()
           
 Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes)
           
 PolymorphicIndexHierarchy getIndexHierarchy()
           
 LuceneIndexingParameters getIndexingParameters(DirectoryProvider<?> provider)
           
 String getIndexingStrategy()
           
 OptimizerStrategy getOptimizerStrategy(DirectoryProvider<?> provider)
           
 ReaderProvider getReaderProvider()
           
 ServiceManager getServiceManager()
           
 Similarity getSimilarity(DirectoryProvider<?> directoryProvider)
           
 Statistics getStatistics()
          Retrieve the statistics instance for this factory.
 StatisticsImplementor getStatisticsImplementor()
          Retrieve the statistics implementor instance for this factory.
 Worker getWorker()
           
 boolean isDirtyChecksEnabled()
           
 boolean isJMXEnabled()
           
 boolean isStopped()
           
 BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor, Integer writerThreads)
           
 void optimize()
          Optimize all indexes
 void optimize(Class entityType)
          Optimize the index holding entityType
 void setBackendQueueProcessorFactory(BackendQueueProcessorFactory backendQueueProcessorFactory)
           
 void setDelegate(SearchFactoryImplementorWithShareableState delegate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableSearchFactory

public MutableSearchFactory()
Method Detail

setDelegate

public void setDelegate(SearchFactoryImplementorWithShareableState delegate)

getBackendQueueProcessorFactory

public BackendQueueProcessorFactory getBackendQueueProcessorFactory()
Specified by:
getBackendQueueProcessorFactory in interface SearchFactoryImplementor
Specified by:
getBackendQueueProcessorFactory in interface SearchFactoryState

setBackendQueueProcessorFactory

public void setBackendQueueProcessorFactory(BackendQueueProcessorFactory backendQueueProcessorFactory)
Specified by:
setBackendQueueProcessorFactory in interface SearchFactoryState

getFilterDefinitions

public Map<String,FilterDef> getFilterDefinitions()
Specified by:
getFilterDefinitions in interface SearchFactoryState

getDocumentBuildersIndexedEntities

public Map<Class<?>,DocumentBuilderIndexedEntity<?>> getDocumentBuildersIndexedEntities()
Specified by:
getDocumentBuildersIndexedEntities in interface SearchFactoryImplementor
Specified by:
getDocumentBuildersIndexedEntities in interface SearchFactoryState

getDocumentBuilderIndexedEntity

public <T> DocumentBuilderIndexedEntity<T> getDocumentBuilderIndexedEntity(Class<T> entityType)
Specified by:
getDocumentBuilderIndexedEntity in interface SearchFactoryImplementor

getDocumentBuilderContainedEntity

public <T> DocumentBuilderContainedEntity<T> getDocumentBuilderContainedEntity(Class<T> entityType)
Specified by:
getDocumentBuilderContainedEntity in interface SearchFactoryImplementor

getWorker

public Worker getWorker()
Specified by:
getWorker in interface SearchFactoryState
Specified by:
getWorker in interface SearchFactoryIntegrator

getOptimizerStrategy

public OptimizerStrategy getOptimizerStrategy(DirectoryProvider<?> provider)
Specified by:
getOptimizerStrategy in interface SearchFactoryImplementor

getFilterCachingStrategy

public FilterCachingStrategy getFilterCachingStrategy()
Specified by:
getFilterCachingStrategy in interface SearchFactoryImplementor
Specified by:
getFilterCachingStrategy in interface SearchFactoryState

getAnalyzers

public Map<String,Analyzer> getAnalyzers()
Specified by:
getAnalyzers in interface SearchFactoryState

getCacheBitResultsSize

public int getCacheBitResultsSize()
Specified by:
getCacheBitResultsSize in interface SearchFactoryState

getConfigurationProperties

public Properties getConfigurationProperties()
Specified by:
getConfigurationProperties in interface SearchFactoryState

getFilterDefinition

public FilterDef getFilterDefinition(String name)
Specified by:
getFilterDefinition in interface SearchFactoryImplementor

getIndexingParameters

public LuceneIndexingParameters getIndexingParameters(DirectoryProvider<?> provider)
Specified by:
getIndexingParameters in interface SearchFactoryImplementor

getIndexingStrategy

public String getIndexingStrategy()
Specified by:
getIndexingStrategy in interface SearchFactoryImplementor
Specified by:
getIndexingStrategy in interface SearchFactoryState

close

public void close()
Specified by:
close in interface SearchFactoryIntegrator

createHSQuery

public HSQuery createHSQuery()
Description copied from interface: SearchFactoryIntegrator
Return an Hibernate Search query object. This object uses fluent APIs to define the query executed. Offers a few execution approaches: - return the list of results eagerly - return the list of results lazily - get the number of results

Specified by:
createHSQuery in interface SearchFactoryIntegrator

getClassesInDirectoryProvider

public Set<Class<?>> getClassesInDirectoryProvider(DirectoryProvider<?> directoryProvider)
Specified by:
getClassesInDirectoryProvider in interface SearchFactoryImplementor

getDirectoryProviders

public Set<DirectoryProvider<?>> getDirectoryProviders()
Specified by:
getDirectoryProviders in interface SearchFactoryImplementor

getDirectoryProviderLock

public ReentrantLock getDirectoryProviderLock(DirectoryProvider<?> dp)
Specified by:
getDirectoryProviderLock in interface SearchFactoryImplementor

getFilterCacheBitResultsSize

public int getFilterCacheBitResultsSize()
Specified by:
getFilterCacheBitResultsSize in interface SearchFactoryImplementor

getIndexedTypesPolymorphic

public Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes)
Specified by:
getIndexedTypesPolymorphic in interface SearchFactoryImplementor

makeBatchBackend

public BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor,
                                     Integer writerThreads)
Specified by:
makeBatchBackend in interface SearchFactoryImplementor

getSimilarity

public Similarity getSimilarity(DirectoryProvider<?> directoryProvider)
Specified by:
getSimilarity in interface SearchFactoryImplementor

getErrorHandler

public ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface SearchFactoryImplementor
Specified by:
getErrorHandler in interface SearchFactoryState

isJMXEnabled

public boolean isJMXEnabled()
Specified by:
isJMXEnabled in interface SearchFactoryImplementor

getStatisticsImplementor

public StatisticsImplementor getStatisticsImplementor()
Description copied from interface: SearchFactoryImplementor
Retrieve the statistics implementor instance for this factory.

Specified by:
getStatisticsImplementor in interface SearchFactoryImplementor
Returns:
The statistics implementor.

getIndexHierarchy

public PolymorphicIndexHierarchy getIndexHierarchy()
Specified by:
getIndexHierarchy in interface SearchFactoryState

getDirectoryProviderIndexingParams

public Map<DirectoryProvider,LuceneIndexingParameters> getDirectoryProviderIndexingParams()
Specified by:
getDirectoryProviderIndexingParams in interface SearchFactoryState

getServiceManager

public ServiceManager getServiceManager()
Specified by:
getServiceManager in interface SearchFactoryState

getReaderProvider

public ReaderProvider getReaderProvider()
Specified by:
getReaderProvider in interface SearchFactory
Specified by:
getReaderProvider in interface SearchFactoryState
Returns:
Return the configured reader provider.

getDirectoryProviders

public DirectoryProvider[] getDirectoryProviders(Class<?> entity)
Description copied from interface: SearchFactory
Provide access to the DirectoryProviders for a given entity. In most cases, the returned type will be a one element array. But if the given entity is configured to use sharded indexes, then multiple elements will be returned. In this case all of them should be considered.

Specified by:
getDirectoryProviders in interface SearchFactory
Parameters:
entity - the entity for which to return the directory providers
Returns:
array of DirectoryProviders for the specified entity

optimize

public void optimize()
Description copied from interface: SearchFactory
Optimize all indexes

Specified by:
optimize in interface SearchFactory

optimize

public void optimize(Class entityType)
Description copied from interface: SearchFactory
Optimize the index holding entityType

Specified by:
optimize in interface SearchFactory
Parameters:
entityType - the entity type (index) to optimize

getAnalyzer

public Analyzer getAnalyzer(String name)
Description copied from interface: SearchFactory
Retrieve an analyzer instance by its definition name

Specified by:
getAnalyzer in interface SearchFactory
Parameters:
name - the name of the analyzer
Returns:
analyzer with the specified name

getAnalyzer

public Analyzer getAnalyzer(Class<?> clazz)
Description copied from interface: SearchFactory
Retrieves the scoped analyzer for a given class.

Specified by:
getAnalyzer in interface SearchFactory
Parameters:
clazz - The class for which to retrieve the analyzer.
Returns:
The scoped analyzer for the specified class.

buildQueryBuilder

public QueryContextBuilder buildQueryBuilder()
Specified by:
buildQueryBuilder in interface SearchFactory
Returns:
return a query builder providing a fluent API to create Lucene queries

getStatistics

public Statistics getStatistics()
Description copied from interface: SearchFactory
Retrieve the statistics instance for this factory.

Specified by:
getStatistics in interface SearchFactory
Returns:
The statistics.

getDocumentBuildersContainedEntities

public Map<Class<?>,DocumentBuilderContainedEntity<?>> getDocumentBuildersContainedEntities()
Specified by:
getDocumentBuildersContainedEntities in interface SearchFactoryState

getDirectoryProviderData

public Map<DirectoryProvider<?>,DirectoryProviderData> getDirectoryProviderData()
Specified by:
getDirectoryProviderData in interface SearchFactoryState

addClasses

public void addClasses(Class<?>... classes)
Description copied from interface: SearchFactoryIntegrator
Add the following classes to the SearchFactory

Specified by:
addClasses in interface SearchFactoryIntegrator

isDirtyChecksEnabled

public boolean isDirtyChecksEnabled()
Specified by:
isDirtyChecksEnabled in interface SearchFactoryImplementor
Returns:
true if we are allowed to inspect entity state to potentially skip some indexing operations. Can be disabled to get pre-3.4 behavior (always rebuild document)

isStopped

public boolean isStopped()
Specified by:
isStopped in interface SearchFactoryIntegrator
Returns:
true if the SearchFactory was stopped


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved