conversionContext.popProperty();
}
}
// process the indexed fields
XMember previousMember = null;
Object currentFieldValue = null;
for ( PropertyMetadata propertyMetadata : typeMetadata.getAllPropertyMetadata() ) {
XMember member = propertyMetadata.getPropertyAccessor();
if ( previousMember != member ) {
currentFieldValue = unproxy(
ReflectionHelper.getMemberValue( unproxiedInstance, member ),
objectInitializer
);
previousMember = member;
if ( member.isCollection() ) {
if ( currentFieldValue instanceof Collection ) {
objectInitializer.initializeCollection( (Collection) currentFieldValue );
}
else if ( currentFieldValue instanceof Map ) {
objectInitializer.initializeMap( (Map) currentFieldValue );
}
}
}
try {
conversionContext.pushProperty( propertyMetadata.getPropertyAccessorName() );
for ( DocumentFieldMetadata fieldMetadata : propertyMetadata.getFieldMetadata() ) {
final FieldBridge fieldBridge = fieldMetadata.getFieldBridge();
final String fieldName = fieldMetadata.getName();
final FieldBridge oneWayConversionContext = conversionContext.oneWayConversionContext( fieldBridge );
oneWayConversionContext.set(
fieldName,
currentFieldValue,
doc,
typeMetadata.getFieldLuceneOptions( propertyMetadata, fieldMetadata, currentFieldValue, documentBoost )
);
}
}
finally {
conversionContext.popProperty();
}
}
// allow analyzer override for the fields added by the class and field bridges
allowAnalyzerDiscriminatorOverride(
doc, typeMetadata, fieldToAnalyzerMap, processedFieldNames, unproxiedInstance
);
// recursively process embedded objects
for ( EmbeddedTypeMetadata embeddedTypeMetadata : typeMetadata.getEmbeddedTypeMetadata() ) {
XMember member = embeddedTypeMetadata.getEmbeddedGetter();
conversionContext.pushProperty( embeddedTypeMetadata.getEmbeddedFieldName() );
try {
Object value = ReflectionHelper.getMemberValue( unproxiedInstance, member );
//TODO handle boost at embedded level: already stored in propertiesMedatada.boost