public TextSearchService(IRecordService service, ITextSearchSettings settings, DocumentWriter.DocumentWriter documentWriter, RecordExtractService recordExtractService) { Service = service; Settings = settings; DocumentWriter = documentWriter; RecordExtractService = recordExtractService; }
private void ProcessEntireRecordExtracts(TextSearchContainer container) { //for each record with exact match on name do record extract //3. foreachrecord with name output them through recordextract var done = 0; var count = container.NameMatches.Count; var typesWithExactNameMatch = container.NameMatches.Select(r => r.Type).Distinct(); var bookmark = container.AddHeadingWithBookmark("Detail of Records With Name Match"); foreach (var type in typesWithExactNameMatch.OrderBy(Service.GetDisplayName)) { var thisType = type; var thisBookmark = container.Section.AddHeading2WithBookmark(Service.GetCollectionName(thisType)); bookmark.AddChildBookmark(thisBookmark); foreach (var record in container.NameMatches.Where(r => r.Type == thisType)) { try { container.Controller.UpdateProgress(done++, count, string.Format("Extracting Detail For {0} {1}", Service.GetDisplayName(type), record.GetStringField(Service.GetPrimaryField(type)))); var thisResponse = RecordExtractService.ExtractRecordToDocument(container.Controller.GetLevel2Controller(), record.ToLookup(), container.Section, container.Request.DetailOfRecordsRelatedToMatches); container.Response.AddResponseItems( thisResponse.ResponseItems.Select(r => new TextSearchResponseItem(r))); if (!thisResponse.Success) { throw thisResponse.Exception; } thisBookmark.AddChildBookmarks(thisResponse.Bookmarks); } catch (Exception ex) { container.Response.AddResponseItem(new TextSearchResponseItem("Error Extracting Record", thisType, ex)); } } } }