org.hibernate.search.engine
Class DocumentBuilderIndexedEntity<T>
java.lang.Object
org.hibernate.search.engine.DocumentBuilderContainedEntity<T>
org.hibernate.search.engine.DocumentBuilderIndexedEntity<T>
- All Implemented Interfaces:
- DocumentBuilder
public class DocumentBuilderIndexedEntity<T>
- extends DocumentBuilderContainedEntity<T>
Set up and provide a manager for classes which are directly annotated with @Indexed
.
- Author:
- Gavin King, Emmanuel Bernard, Sylvain Vieujot, Richard Hallier, Hardy Ferentschik
Field Summary |
protected org.hibernate.annotations.common.reflection.XMember |
idGetter
The class member used as document id. |
protected java.lang.String |
idKeywordName
Name of the document id field. |
Method Summary |
void |
addWorkToQueue(java.lang.Class<T> entityClass,
T entity,
java.io.Serializable id,
WorkType workType,
java.util.List<LuceneWork> queue,
SearchFactoryImplementor searchFactoryImplementor)
|
boolean |
allowFieldSelectionInProjection()
|
protected void |
checkDocumentId(org.hibernate.annotations.common.reflection.XProperty member,
DocumentBuilderContainedEntity.PropertiesMetadata propertiesMetadata,
boolean isRoot,
java.lang.String prefix,
InitContext context)
|
AddLuceneWork |
createAddWork(java.lang.Class<T> entityClass,
T entity,
java.io.Serializable id,
java.lang.String idInString,
boolean isBatch)
|
DirectoryProvider[] |
getDirectoryProviders()
|
IndexShardingStrategy |
getDirectoryProviderSelectionStrategy()
|
org.apache.lucene.document.Document |
getDocument(T instance,
java.io.Serializable id,
java.util.Map<java.lang.String,java.lang.String> fieldToAnalyzerMap)
Builds the Lucene Document for a given entity instance and its id . |
static java.lang.Class |
getDocumentClass(org.apache.lucene.document.Document document)
|
static java.lang.Object[] |
getDocumentFields(SearchFactoryImplementor searchFactoryImplementor,
java.lang.Class<?> clazz,
org.apache.lucene.document.Document document,
java.lang.String[] fields)
|
static java.io.Serializable |
getDocumentId(SearchFactoryImplementor searchFactoryImplementor,
java.lang.Class<?> clazz,
org.apache.lucene.document.Document document)
|
java.io.Serializable |
getId(java.lang.Object entity)
Return the entity id if possible
An IllegalStateException otherwise
If the id is provided, we can't extract it from the entity |
TwoWayFieldBridge |
getIdBridge()
|
java.lang.String |
getIdentifierName()
|
java.lang.String |
getIdKeywordName()
|
org.apache.lucene.index.Term |
getTerm(java.io.Serializable id)
|
protected void |
init(org.hibernate.annotations.common.reflection.XClass clazz,
InitContext context)
|
Methods inherited from class org.hibernate.search.engine.DocumentBuilderContainedEntity |
getAnalyzer, getAnalyzer, getAnalyzer, getBoost, getBoost, getDynamicBoost, getDynamicBoost, getEntityState, getIdAttributeName, getIndex, getMappedSubclasses, getSimilarity, getTermVector, initializeMemberLevelAnnotations, isRoot, postInitialize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
idGetter
protected org.hibernate.annotations.common.reflection.XMember idGetter
- The class member used as document id.
idKeywordName
protected java.lang.String idKeywordName
- Name of the document id field.
DocumentBuilderIndexedEntity
public DocumentBuilderIndexedEntity(org.hibernate.annotations.common.reflection.XClass clazz,
InitContext context,
DirectoryProvider[] directoryProviders,
IndexShardingStrategy shardingStrategy,
org.hibernate.annotations.common.reflection.ReflectionManager reflectionManager)
- Creates a document builder for entities annotated with
@Indexed
.
- Parameters:
clazz
- The class for which to build a DocumentBuilderContainedEntity
.context
- Handle to default configuration settings.directoryProviders
- Arrays of directory providers for the underlying Lucene indexes of the indexed entity.shardingStrategy
- The sharding strategy used for the indexed entity.reflectionManager
- Reflection manager to use for processing the annotations.
init
protected void init(org.hibernate.annotations.common.reflection.XClass clazz,
InitContext context)
- Overrides:
init
in class DocumentBuilderContainedEntity<T>
checkDocumentId
protected void checkDocumentId(org.hibernate.annotations.common.reflection.XProperty member,
DocumentBuilderContainedEntity.PropertiesMetadata propertiesMetadata,
boolean isRoot,
java.lang.String prefix,
InitContext context)
- Overrides:
checkDocumentId
in class DocumentBuilderContainedEntity<T>
addWorkToQueue
public void addWorkToQueue(java.lang.Class<T> entityClass,
T entity,
java.io.Serializable id,
WorkType workType,
java.util.List<LuceneWork> queue,
SearchFactoryImplementor searchFactoryImplementor)
- Overrides:
addWorkToQueue
in class DocumentBuilderContainedEntity<T>
createAddWork
public AddLuceneWork createAddWork(java.lang.Class<T> entityClass,
T entity,
java.io.Serializable id,
java.lang.String idInString,
boolean isBatch)
getDocument
public org.apache.lucene.document.Document getDocument(T instance,
java.io.Serializable id,
java.util.Map<java.lang.String,java.lang.String> fieldToAnalyzerMap)
- Builds the Lucene
Document
for a given entity instance
and its id
.
- Parameters:
instance
- The entity for which to build the matching Lucene Document
id
- the entity id.fieldToAnalyzerMap
- this maps gets populated while generating the Document
.
It allows to specify for any document field a named analyzer to use. This parameter cannot be null
.
- Returns:
- The Lucene
Document
for the specified entity.
getIdentifierName
public java.lang.String getIdentifierName()
getDirectoryProviders
public DirectoryProvider[] getDirectoryProviders()
getDirectoryProviderSelectionStrategy
public IndexShardingStrategy getDirectoryProviderSelectionStrategy()
allowFieldSelectionInProjection
public boolean allowFieldSelectionInProjection()
getTerm
public org.apache.lucene.index.Term getTerm(java.io.Serializable id)
getIdBridge
public TwoWayFieldBridge getIdBridge()
getDocumentClass
public static java.lang.Class getDocumentClass(org.apache.lucene.document.Document document)
getIdKeywordName
public java.lang.String getIdKeywordName()
getId
public java.io.Serializable getId(java.lang.Object entity)
- Return the entity id if possible
An IllegalStateException otherwise
If the id is provided, we can't extract it from the entity
- Returns:
- entity id
getDocumentId
public static java.io.Serializable getDocumentId(SearchFactoryImplementor searchFactoryImplementor,
java.lang.Class<?> clazz,
org.apache.lucene.document.Document document)
getDocumentFields
public static java.lang.Object[] getDocumentFields(SearchFactoryImplementor searchFactoryImplementor,
java.lang.Class<?> clazz,
org.apache.lucene.document.Document document,
java.lang.String[] fields)
Copyright © 2006-2010 Hibernate. All Rights Reserved.