anchor.diff:          /// are flushed to the Directory. This gives us the best place to
           /// automate things around Lucene flush logic. 
           override this.doBeforeFlush() = 
  -            // Save the current generation in the commit data so that
  -            // it can be used for shard recovery 
  -            this.SetCommitData(getCommitData (state.Generation))
  -            // Increment the current generation so that the log file 
  -            // can be switched
  -            state.GetNextGen() |> ignore
  +            /// State can be null when the index writer is opened for the
  +            /// very first time
  +            if not (isNull state) then 
  +                // Save the current generation in the commit data so that
  +                // it can be used for shard recovery 
  +                this.SetCommitData(getCommitData (state.Generation))
  +                // Increment the current generation so that the log file 
  +                // can be switched
  +                state.GetNextGen() |> ignore
           
           /// A hook for extending classes to execute operations after pending 
           /// added and deleted documents have been flushed to the Directory but 
           /// before the change is committed (new segments_N file written).
           override this.doAfterFlush() = 
  -            let current = state.LastCommitTime
  -            let commitTime = DateTime.Now.Ticks
  -            // We don't care if something else has changed the time as this is a
  -            // fallback mechanism
  -            Interlocked.CompareExchange(ref state.LastCommitTime, commitTime, current) |> ignore
  -            // Auto commit after flush
  -            this.Commit()
  +            /// State can be null when the index writer is opened for the
  +            /// very first time
  +            if not (isNull state) then 
  +                let current = state.LastCommitTime
  +                
  +                let commitTime = DateTime.Now.Ticks
  +                // We don't care if something else has changed the time as this is a
  +                // fallback mechanism
  +                Interlocked.CompareExchange(ref state.LastCommitTime, commitTime, current) |> ignore
  +                // Auto commit after flush
  +                this.Commit()
       
       /// An IndexWriter creates and maintains an index. This is a wrapper around
       /// Lucene IndexWriter to expose the functionality in a controlled and functional 
  
positive.code:         { Setting : IndexSetting.T }
      
      let withIndexName (indexName, path) = 
          let setting = 
              { IndexName = indexName
                IndexAnalyzer = Unchecked.defaultof<_>
  
negative.code:     
      /// Create index settings from the Index Dto
      let createIndexSetting (index : Index.Dto, analyzerService) = 
          try 
              withIndexName (index.IndexName, Constants.DataFolder +/ index.IndexName)
              |> withShardConfiguration (index.ShardConfiguration)
              |> withIndexConfiguration (index.IndexConfiguration)
              |> withScripts (index.Scripts)
  