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.
 IndexManagerHolder getAllIndexesManager()
           
 org.apache.lucene.analysis.Analyzer getAnalyzer(Class<?> clazz)
          Retrieves the scoped analyzer for a given class.
 org.apache.lucene.analysis.Analyzer getAnalyzer(String name)
          Retrieve an analyzer instance by its definition name
 Map<String,org.apache.lucene.analysis.Analyzer> getAnalyzers()
           
 int getCacheBitResultsSize()
           
 Properties getConfigurationProperties()
           
 TimeoutExceptionFactory getDefaultTimeoutExceptionFactory()
           
<T> DocumentBuilderContainedEntity<T>
getDocumentBuilderContainedEntity(Class<T> entityType)
           
 Map<Class<?>,DocumentBuilderContainedEntity<?>> getDocumentBuildersContainedEntities()
           
 ErrorHandler getErrorHandler()
          Used to catch exceptions in all synchronous operations; but default they are logged, the user can configure alternative error management means.
 int getFilterCacheBitResultsSize()
           
 FilterCachingStrategy getFilterCachingStrategy()
           
 FilterDef getFilterDefinition(String name)
           
 Map<String,FilterDef> getFilterDefinitions()
           
 Map<Class<?>,EntityIndexBinder> getIndexBindingForEntity()
           
 EntityIndexBinder getIndexBindingForEntity(Class<?> entityType)
           
 Set<Class<?>> getIndexedTypesPolymorphic(Class<?>[] classes)
           
 PolymorphicIndexHierarchy getIndexHierarchy()
           
 String getIndexingStrategy()
           
 IndexReaderAccessor getIndexReaderAccessor()
          Provides access to the IndexReader API
 InstanceInitializer getInstanceInitializer()
           
 SearchMapping getProgrammaticMapping()
           
 ServiceManager getServiceManager()
           
 Statistics getStatistics()
          Retrieve the statistics instance for this factory.
 StatisticsImplementor getStatisticsImplementor()
          Retrieve the statistics implementor instance for this factory.
 TimingSource getTimingSource()
           
 Worker getWorker()
           
 boolean isDirtyChecksEnabled()
           
 boolean isIndexMetadataComplete()
           
 boolean isJMXEnabled()
           
 boolean isStopped()
           
 boolean isTransactionManagerExpected()
           
 BatchBackend makeBatchBackend(MassIndexerProgressMonitor progressMonitor)
           
 void optimize()
          Optimize all indexes
 void optimize(Class entityType)
          Optimize the index holding entityType
 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)

getFilterDefinitions

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

getIndexBindingForEntity

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

getIndexBindingForEntity

public EntityIndexBinder getIndexBindingForEntity(Class<?> entityType)
Specified by:
getIndexBindingForEntity in interface SearchFactoryIntegrator

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

getFilterCachingStrategy

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

getAnalyzers

public Map<String,org.apache.lucene.analysis.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

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

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)
Specified by:
makeBatchBackend in interface SearchFactoryImplementor

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

getServiceManager

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

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 org.apache.lucene.analysis.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 org.apache.lucene.analysis.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

addClasses

public void addClasses(Class<?>... classes)
Description copied from interface: SearchFactoryIntegrator
Add the following classes to the SearchFactory. If these classes are new to the SearchFactory this will trigger a reconfiguration.

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

isTransactionManagerExpected

public boolean isTransactionManagerExpected()
Specified by:
isTransactionManagerExpected in interface SearchFactoryState

getAllIndexesManager

public IndexManagerHolder getAllIndexesManager()
Specified by:
getAllIndexesManager in interface SearchFactoryImplementor
Specified by:
getAllIndexesManager in interface SearchFactoryState

getErrorHandler

public ErrorHandler getErrorHandler()
Description copied from interface: SearchFactoryIntegrator
Used to catch exceptions in all synchronous operations; but default they are logged, the user can configure alternative error management means.

Specified by:
getErrorHandler in interface SearchFactoryState
Specified by:
getErrorHandler in interface SearchFactoryIntegrator
Returns:
the configured ErrorHandler, global to the SearchFactory

getIndexReaderAccessor

public IndexReaderAccessor getIndexReaderAccessor()
Description copied from interface: SearchFactory
Provides access to the IndexReader API

Specified by:
getIndexReaderAccessor in interface SearchFactory
Returns:
the IndexReaderAccessor for this SearchFactory

getInstanceInitializer

public InstanceInitializer getInstanceInitializer()
Specified by:
getInstanceInitializer in interface SearchFactoryImplementor
Specified by:
getInstanceInitializer in interface SearchFactoryState
Returns:
returns an instance of InstanceInitializer for class/object initialization.

getDefaultTimeoutExceptionFactory

public TimeoutExceptionFactory getDefaultTimeoutExceptionFactory()
Specified by:
getDefaultTimeoutExceptionFactory in interface SearchFactoryState
Specified by:
getDefaultTimeoutExceptionFactory in interface SearchFactoryIntegrator

getTimingSource

public TimingSource getTimingSource()
Specified by:
getTimingSource in interface SearchFactoryImplementor
Specified by:
getTimingSource in interface SearchFactoryState

getProgrammaticMapping

public SearchMapping getProgrammaticMapping()
Specified by:
getProgrammaticMapping in interface SearchFactoryState

isIndexMetadataComplete

public boolean isIndexMetadataComplete()
Specified by:
isIndexMetadataComplete in interface SearchFactoryState


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