public void addDocument(Document d){
  if (!m_readMode) {
    try {
      writer.addDocument(d);
      m_hitCountCache.clear();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
 else {
    throw new IllegalStateException("Documents can not be added to the index unless" + "the LuceneSearcher is not in read mode");
  }
}

public void addDocument ( Document d ) { if ( ! m_readMode ) { try { writer . addDocument ( d ) ; m_hitCountCache . clear ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } else { throw new IllegalStateException ( "Documents can not be added to the index unless" + "the LuceneSearcher is not in read mode" ) ; } }
add a document to the lucene search index .
