code: public I_CmsIndexWriter getIndexWriter(I_CmsReport report, boolean create) throws CmsIndexException {
  
          // note - create will be:
          //   true if the index is to be fully rebuild,
          //   false if the index is to be incrementally updated
          if (m_indexWriter != null) {
              if (!create) {
                  // re-use existing index writer
                  return m_indexWriter;
              }
              // need to close the index writer if create is "true"
              try {
                  m_indexWriter.close();
                  m_indexWriter = null;
              } catch (IOException e) {
                  // if we can't close the index we are busted!
                  throw new CmsIndexException(
                      Messages.get().container(Messages.LOG_IO_INDEX_WRITER_CLOSE_2, getPath(), getName()),
                      e);
              }
  
          }
  
          // now create is true of false, but the index writer is definitely null / closed
          I_CmsIndexWriter indexWriter = createIndexWriter(create, report);
  
          if (!create) {
              m_indexWriter = indexWriter;
          }
  
          return indexWriter;
      }
docs: Returns a new index writer for this index.<p>
  
  @param report the report to write error messages on
  @param create if <code>true</code> a whole new index is created, if <code>false</code> an existing index is updated
  
  @return a new instance of IndexWriter
  
  @throws CmsIndexException if the index can not be opened