final Document document = new Document();
document.add(new Field("text", text, Field.Store.YES, Field.Index.TOKENIZED));
final boolean[] called = {false, false};
manager.registerDocumentHandler(new IdentityDocumentMatching("java.lang.String"), new AbstractDocumentHandler() {
public boolean supports(Class clazz) {
called[0]=true;
return true;
}