.property( "id", ElementType.FIELD ).documentId()
.property( "title", ElementType.FIELD ).field()
;
cfg.setProgrammaticMapping( mapping );
cfg.addClass( Document.class );
MutableSearchFactory sf = (MutableSearchFactory) new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
try {
assertEquals( expectation, extractWorkspace( sf, Document.class ).areSingleTermDeletesSafe() );
// trigger a SearchFactory rebuild:
sf.addClasses( Dvd.class, Book.class );
// DVD share the same index, so now it's always unsafe [always false no matter the global option]
assertEquals( false, extractWorkspace( sf, Dvd.class ).areSingleTermDeletesSafe() );
assertEquals( false, extractWorkspace( sf, Document.class ).areSingleTermDeletesSafe() );
// but still as expected for Book :
assertEquals( expectation, extractWorkspace( sf, Book.class ).areSingleTermDeletesSafe() );
}
finally {
sf.close();
}
}