Esempio n. 1
0
        /// <summary>
        /// Process each document
        /// </summary>
        private void ProcessDocuments(DocumentCollection recordParserResponse)
        {
            var documentDetailList = new List <DocumentDetail>();
            var overlayLogList     = new List <JobWorkerLog <OverlaySearchLogInfo> >();
            var docManager         = new OverlayDocumentManager(_jobParameter, _dataset, PipelineId, WorkerId);

            //Bulk Search for entire batch
            documentDetailList = docManager.BulkSearch(recordParserResponse.documents, _userInfo, out overlayLogList);

            SendRelationshipsInfo(documentDetailList);

            #region Send Message
            //Send response
            if (documentDetailList != null && documentDetailList.Any())
            {
                if (documentDetailList.Count > _batchSize)
                {
                    Send(documentDetailList.Take(_batchSize).ToList());
                    var remainDocumentList = documentDetailList.Skip(_batchSize).ToList();
                    Send(remainDocumentList); //send remaining list
                    documentDetailList.Clear();
                }
                else
                {
                    Send(documentDetailList);
                    documentDetailList.Clear();
                }
            }
            //Send Log
            if (overlayLogList != null && overlayLogList.Any())
            {
                SendLog(overlayLogList);
                overlayLogList.Clear();
            }
            #endregion
        }
        /// <summary>
        /// Process each document 
        /// </summary>
        private void ProcessDocuments(DocumentCollection recordParserResponse)
        {
            var documentDetailList = new List<DocumentDetail>();
            var overlayLogList = new List<JobWorkerLog<OverlaySearchLogInfo>>();
            var docManager = new OverlayDocumentManager(_jobParameter, _dataset, PipelineId, WorkerId);

            //Bulk Search for entire batch
            documentDetailList = docManager.BulkSearch(recordParserResponse.documents, _userInfo, out overlayLogList);

            SendRelationshipsInfo(documentDetailList);

            #region Send Message
            //Send response   
            if (documentDetailList != null && documentDetailList.Any())
            {
                if (documentDetailList.Count > _batchSize)
                {
                    Send(documentDetailList.Take(_batchSize).ToList());
                    var remainDocumentList = documentDetailList.Skip(_batchSize).ToList();
                    Send(remainDocumentList); //send remaining list
                    documentDetailList.Clear();
                }
                else
                {
                    Send(documentDetailList);
                    documentDetailList.Clear();
                }
            }
            //Send Log   
            if (overlayLogList != null && overlayLogList.Any())
            {
                SendLog(overlayLogList);
                overlayLogList.Clear();
            }
            #endregion
        }