}
if (!create && docToUpdate != null) {
Document doc = getDocument(docToUpdate, bean, attributes, config, reverseattributes);
// add facets to document
if (categoryDocBuilder != null) {
categoryDocBuilder.build(doc);
}
indexWriter.updateDocument(idTerm, doc);
} else {
Document doc = getDocument(null, bean, attributes, config, reverseattributes);
// add facets to document