anchor.diff: -﻿namespace FlexSearch.Core
  -
  +﻿// ----------------------------------------------------------------------------
  +//  Licensed to FlexSearch under one or more contributor license 
  +//  agreements. See the NOTICE file distributed with this work 
  +//  for additional information regarding copyright ownership. 
  +//
  +//  This source code is subject to terms and conditions of the 
  +//  Apache License, Version 2.0. A copy of the license can be 
  +//  found in the License.txt file at the root of this distribution. 
  +//  You may also obtain a copy of the License at:
  +// 
  +//     http://www.apache.org/licenses/LICENSE-2.0
  +// 
  +//  By using this source code in any fashion, you are agreeing
  +//  to be bound by the terms of the Apache License, Version 2.0.
  +//
  +//  You must not remove this notice, or any other, from this software.
  +// ----------------------------------------------------------------------------
  +namespace FlexSearch.Core
  +
  +open CsvHelper
  +open CsvHelper.Configuration
   open System
  -open System.IO
   open System.Data
   open System.Data.SqlClient
  -open CsvHelper
  -open CsvHelper.Configuration
  -open Microsoft.Owin
  -
  -
  -
  -
  -/// <summary>
  +open System.IO
  +
   /// Represents a request which can be sent to CSV connector to index CSV data.
  -/// </summary>
   [<Sealed>]
   type CsvIndexingRequest() = 
       inherit DtoBase()
       
  -    /// <summary>
       /// Name of the index
  -    /// </summary>
       member val IndexName = defString with get, set
       
  -    /// <summary>
       /// Signifies if the passed CSV file(s) has a header record 
  -    /// </summary>
       member val HasHeaderRecord = false with get, set
       
  -    /// <summary>
       /// The headers to be used by each column. This should only be passed when there is
       /// no header in the csv file. The first column is always assumed to be id field. Make sure
       /// in your array you always offset the column names by 1 position.
  -    /// </summary>
       member val Headers = defArray<string> with get, set
       
  -    /// <summary>
       /// The path of the folder or file to be indexed. The service will pickup all files with 
       /// .csv extension.
  -    /// </summary>
       member val Path = defString with get, set
  -
  -    override __.Validate() =
  -        if __.HasHeaderRecord = false && (__.Headers |> Seq.isEmpty) 
  -        then fail <| Error.MissingFieldValue("HasHeaderRecord, Headers")
  -        else ok ()
  -        
  -
  -/// <summary>
  +    
  +    override __.Validate() = 
  +        if __.HasHeaderRecord = false && (__.Headers |> Seq.isEmpty) then 
  +            fail <| Error.MissingFieldValue("HasHeaderRecord, Headers")
  +        else ok()
  +
   /// Connector for importing CSV file data into the system.
  -/// </summary>
   [<Sealed>]
   [<Name("POST-/indices/:id/csv")>]
   type CsvHandler(queueService : IQueueService, jobService : IJobService) = 
  
positive.code:                     let! (body : CsvIndexingRequest, path : string, jobId : Guid, isFolder : bool) = inbox.Receive()
                      let job = new Job(JobId = jobId.ToString("N"), Status = JobStatus.InProgress)
                      jobService.UpdateJob(job) |> ignore
  
                      let execFileJob filePath = 
                          match ProcessFile(body, filePath) with
                          | Choice1Of2() -> 
  
negative.code:                     // The first column is always id so skip it
                      headers
                      |> Seq.skip 1
                      |> Seq.iteri (fun i header -> document.Fields.Add(header, cr.CurrentRecord.[i + 1]))
                      queueService.AddDocumentQueue(document)
                      generateDoc cr
              generateDoc reader
      
      let bulkRequestProcessor = 
  