TypeMetadata typeMetadata,
Map<String, String> fieldToAnalyzerMap,
Set<String> processedFieldNames,
Object unproxiedInstance) {
Discriminator discriminator = typeMetadata.getDiscriminator();
if ( discriminator == null ) {
return;
}
Object value = null;
if ( typeMetadata.getDiscriminatorGetter() != null ) {
value = ReflectionHelper.getMemberValue( unproxiedInstance, typeMetadata.getDiscriminatorGetter() );
}
// now we give the discriminator the opportunity to specify a analyzer per field level
for ( IndexableField field : doc.getFields() ) {
if ( !processedFieldNames.contains( field.name() ) ) {
String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
if ( analyzerName != null ) {
fieldToAnalyzerMap.put( field.name(), analyzerName );
}
processedFieldNames.add( field.name() );
}