IndexWriter writer = null; try { writer = m_indexSource.getWriter(false); writer.addDocument(document); } catch (IOException e) { throw new RuntimeException(e); } finally { LuceneUtils.closeQuietly(writer); }
addBean(document);
    public void indexBean(Object bean, Serializable id, Object[] state, String[] fieldNames,            Type[] types, boolean newInstance) {        Document document = new Document();        if (!m_beanAdaptor.documentFromBean(document, bean, id, state, fieldNames, types)) {            return;        }        if (!newInstance) {            removeBean(bean, id);        }        IndexWriter writer = null;        try {            writer = m_indexSource.getWriter(false);            writer.addDocument(document);        } catch (IOException e) {            throw new RuntimeException(e);        } finally {            LuceneUtils.closeQuietly(writer);        }    }