org.hibernate.search
Interface SearchFactory

All Known Subinterfaces:
SearchFactoryImplementor, SearchFactoryImplementorWithShareableState, SearchFactoryIntegrator
All Known Implementing Classes:
ImmutableSearchFactory, MutableSearchFactory

public interface SearchFactory

Provide application wide operations as well as access to the underlying Lucene resources.

Author:
Emmanuel Bernard, Hardy Ferentschik

Method Summary
 QueryContextBuilder buildQueryBuilder()
           
 Analyzer getAnalyzer(Class<?> clazz)
          Retrieves the scoped analyzer for a given class.
 Analyzer getAnalyzer(String name)
          Retrieve an analyzer instance by its definition name
 DirectoryProvider[] getDirectoryProviders(Class<?> entity)
          Provide access to the DirectoryProviders for a given entity.
 ReaderProvider getReaderProvider()
           
 Statistics getStatistics()
          Retrieve the statistics instance for this factory.
 void optimize()
          Optimize all indexes
 void optimize(Class entityType)
          Optimize the index holding entityType
 

Method Detail

getReaderProvider

ReaderProvider getReaderProvider()
Returns:
Return the configured reader provider.

getDirectoryProviders

DirectoryProvider[] getDirectoryProviders(Class<?> entity)
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.

Parameters:
entity - the entity for which to return the directory providers
Returns:
array of DirectoryProviders for the specified entity

optimize

void optimize()
Optimize all indexes


optimize

void optimize(Class entityType)
Optimize the index holding entityType

Parameters:
entityType - the entity type (index) to optimize

getAnalyzer

Analyzer getAnalyzer(String name)
Retrieve an analyzer instance by its definition name

Parameters:
name - the name of the analyzer
Returns:
analyzer with the specified name
Throws:
SearchException - if the definition name is unknown

getAnalyzer

Analyzer getAnalyzer(Class<?> clazz)
Retrieves the scoped analyzer for a given class.

Parameters:
clazz - The class for which to retrieve the analyzer.
Returns:
The scoped analyzer for the specified class.
Throws:
IllegalArgumentException - in case clazz == null or the specified class is not an indexed entity.

buildQueryBuilder

QueryContextBuilder buildQueryBuilder()
Returns:
return a query builder providing a fluent API to create Lucene queries

getStatistics

Statistics getStatistics()
Retrieve the statistics instance for this factory.

Returns:
The statistics.


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