Package org.hibernate.search.engine
Class AbstractDocumentBuilder<T>
java.lang.Object
org.hibernate.search.engine.AbstractDocumentBuilder<T>
- All Implemented Interfaces:
DocumentBuilder
- Direct Known Subclasses:
DocumentBuilderContainedEntity,DocumentBuilderIndexedEntity
Abstract base class for the document builders.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classWrapper class containing all the meta data extracted out of a single entity. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Class<?> protected final Stringprotected EntityStateprotected final AbstractDocumentBuilder.PropertiesMetadataprotected ReflectionManagerFields inherited from interface org.hibernate.search.engine.DocumentBuilder
CLASS_FIELDNAME -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDocumentBuilder(XClass xClass, ConfigContext context, Similarity similarity, ReflectionManager reflectionManager, Set<XClass> optimizationBlackList) Constructor used on contained entities not annotated with@Indexedthemselves. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToScopedAnalyzer(String fieldName, Analyzer analyzer, Index index) abstract voidaddWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, boolean batch, List<LuceneWork> queue) voidappendContainedInWorkForInstance(Object instance, WorkPlan workplan) If we have a work instance we have to check whether the instance to be indexed is contained in any other indexed entities.protected abstract voiddocumentBuilderSpecificChecks(XProperty member, AbstractDocumentBuilder.PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix, ConfigContext context) voidMakes sure isCollectionRoleExcluded will always return false, so that collection update events are always processed.protected AnalyzergetAnalyzer(XAnnotatedElement annotatedElement, ConfigContext context) Class<?> protected Floatprotected BoostStrategygetDynamicBoost(XProperty member) abstract SerializableIn case of an indexed entity, return the value of it's identifier: what is marked as @Id or @DocumentId; in case the entity uses @ProvidedId, it's illegal to call this method.protected Field.Indexprotected IntegergetPrecisionStep(NumericField numericFieldAnn) protected Field.TermVectorgetTermVector(TermVector vector) booleanisCollectionRoleExcluded(String collectionRole) Returns true if the collection event is not going to affect the index state, so that the indexing event can be skipped.booleanHibernate entities might be considered dirty, but still have only changes that don't affect indexing.booleanisRoot()voidpostInitialize(Set<Class<?>> indexedClasses)
-
Field Details
-
beanXClassName
-
beanClass
-
fieldCollectionRoles
-
indexedEmbeddedCollectionRoles
-
containedInCollectionRoles
-
metadata
-
entityState
-
reflectionManager
-
-
Constructor Details
-
AbstractDocumentBuilder
public AbstractDocumentBuilder(XClass xClass, ConfigContext context, Similarity similarity, ReflectionManager reflectionManager, Set<XClass> optimizationBlackList) Constructor used on contained entities not annotated with@Indexedthemselves.- Parameters:
xClass- The class for which to build a DocumentBuilderContainedEntity}context- Handle to default configuration settingssimilarity- The index level similarityreflectionManager- Reflection manager to use for processing the annotations
-
-
Method Details
-
addWorkToQueue
public abstract void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, boolean batch, List<LuceneWork> queue) -
documentBuilderSpecificChecks
protected abstract void documentBuilderSpecificChecks(XProperty member, AbstractDocumentBuilder.PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix, ConfigContext context) -
getId
In case of an indexed entity, return the value of it's identifier: what is marked as @Id or @DocumentId; in case the entity uses @ProvidedId, it's illegal to call this method.- Parameters:
entity- the instance for which to retrieve the id- Returns:
- the value, or null if it's not an indexed entity
- Throws:
IllegalStateException- when used with a @ProvidedId annotated entity
-
isRoot
public boolean isRoot() -
getBeanClass
-
getBeanXClass
-
getMetadata
-
getSimilarity
-
getAnalyzer
-
getEntityState
-
getMappedSubclasses
-
postInitialize
-
getAnalyzer
-
addToScopedAnalyzer
-
getBoost
-
getDynamicBoost
-
getTermVector
-
getIndex
-
appendContainedInWorkForInstance
If we have a work instance we have to check whether the instance to be indexed is contained in any other indexed entities. -
getPrecisionStep
-
isDirty
Hibernate entities might be considered dirty, but still have only changes that don't affect indexing. So this isDirty() implementation will return true only if the proposed change is possibly affecting the index.- Parameters:
dirtyPropertyNames- Contains the property name of each value which changed, or null for everything.- Returns:
- true if it can't make sure the index doesn't need an update
- Since:
- 3.4
-
isCollectionRoleExcluded
Returns true if the collection event is not going to affect the index state, so that the indexing event can be skipped.- Parameters:
collectionRole-- Returns:
- true if the collection Role does not affect index state
- Since:
- 3.4
-
forceStateInspectionOptimizationsDisabled
public void forceStateInspectionOptimizationsDisabled()Makes sure isCollectionRoleExcluded will always return false, so that collection update events are always processed.- See Also:
-