* analyzer definition names. This map will be added to the <code>Work</code> instance and processed at actual indexing time.
* @param processedFieldNames A list of field names we have already processed.
* @param unproxiedInstance The entity we currently "add" to the document.
*/
private void allowAnalyzerDiscriminatorOverride(Document doc, PropertiesMetadata propertiesMetadata, Map<String, String> fieldToAnalyzerMap, Set<String> processedFieldNames, Object unproxiedInstance) {
Discriminator discriminator = propertiesMetadata.discriminator;
if ( discriminator == null ) {
return;
}
Object value = null;
if ( propertiesMetadata.discriminatorGetter != null ) {
value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
}
// now we give the discriminator the opportunity to specify a analyzer per field level
for ( Object o : doc.getFields() ) {
Fieldable field = (Fieldable) o;
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() );
}