}
else {
Set<Class<?>> involvedClasses = new HashSet<Class<?>>( indexedTargetedEntities.size() );
involvedClasses.addAll( indexedTargetedEntities );
for ( Class<?> clazz : indexedTargetedEntities ) {
EntityIndexBinding indexBinder = builders.get( clazz );
if ( indexBinder != null ) {
DocumentBuilderIndexedEntity builder = indexBinder.getDocumentBuilder();
involvedClasses.addAll( builder.getMappedSubclasses() );
}
}
for ( Class clazz : involvedClasses ) {
EntityIndexBinding entityIndexBinding = builders.get( clazz );
//TODO should we rather choose a polymorphic path and allow non mapped entities
if ( entityIndexBinding == null ) {
throw new SearchException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
}
DocumentBuilderIndexedEntity builder = entityIndexBinding.getDocumentBuilder();
if ( builder.getIdKeywordName() != null ) {
idFieldNames.add( builder.getIdKeywordName() );
allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
}
searcherSimilarity = checkSimilarity( searcherSimilarity, entityIndexBinding.getSimilarity() );
useFieldCacheOnClassTypes = useFieldCacheOnClassTypes || builder.getFieldCacheOption()
.contains( FieldCacheType.CLASS );
populateIndexManagers( targetedIndexes, entityIndexBinding.getSelectionStrategy() );
}
this.classesAndSubclasses = involvedClasses;
}
this.idFieldNames = idFieldNames;