public v5_Solr_Title_Result Map_To_Result(v5_SolrDocument thisResult, List <Complete_Item_Aggregation_Metadata_Type> DisplayFields) { // Create the results v5_Solr_Title_Result resultConverted = new v5_Solr_Title_Result(); resultConverted.MaterialType = thisResult.Type; // Get the bibid resultConverted.BibID = thisResult.DID.Substring(0, 10); // For now... resultConverted.GroupThumbnail = thisResult.MainThumbnail; resultConverted.GroupTitle = thisResult.Title ?? "NO TITLE"; // These should not really be necessary resultConverted.Primary_Identifier = String.Empty; resultConverted.Primary_Identifier_Type = String.Empty; resultConverted.Snippet = String.Empty; // Add the item v5_Solr_Item_Result itemResult = new v5_Solr_Item_Result(); itemResult.VID = thisResult.DID.Substring(11, 5); itemResult.Title = thisResult.Title ?? "NO TITLE"; itemResult.MainThumbnail = thisResult.MainThumbnail; resultConverted.Items.Add(itemResult); // Build the display results values List <string> display_result_fields = new List <string>(); foreach (Complete_Item_Aggregation_Metadata_Type metadataField in DisplayFields) { display_result_fields.Add(data_from_display_field(thisResult, metadataField.SolrCode) ?? String.Empty); } resultConverted.Metadata_Display_Values = display_result_fields.ToArray(); return(resultConverted); }
public v5_Solr_Title_Result Map_To_Result(SolrNet.Group <v5_SolrDocument> Grouping, List <Complete_Item_Aggregation_Metadata_Type> DisplayFields) { // Create the results v5_Solr_Title_Result resultConverted = new v5_Solr_Title_Result(); // These should not really be necessary resultConverted.Primary_Identifier = String.Empty; resultConverted.Primary_Identifier_Type = String.Empty; resultConverted.Snippet = String.Empty; // Now add all the item info bool first_item = true; foreach (v5_SolrDocument item in Grouping.Documents) { if (first_item) { resultConverted.MaterialType = item.Type; // Get the bibid resultConverted.BibID = item.DID.Substring(0, 10); // Look for information about this bibid first Multiple_Volume_Item titleInfo = Engine_ApplicationCache_Gateway.Title_List.Get_Title(resultConverted.BibID); if (titleInfo == null) { resultConverted.GroupThumbnail = item.MainThumbnail; resultConverted.GroupTitle = item.Title ?? "NO TITLE"; } else { if ((titleInfo.GroupThumbnailType == Group_Thumbnail_Enum.Custom_Thumbnail) && (!String.IsNullOrEmpty(titleInfo.CustomThumbnail))) { resultConverted.GroupThumbnail = titleInfo.CustomThumbnail; } else { resultConverted.GroupThumbnail = item.MainThumbnail; } resultConverted.GroupTitle = titleInfo.GroupTitle; } // Build the display results values List <string> display_result_fields = new List <string>(); foreach (Complete_Item_Aggregation_Metadata_Type metadataField in DisplayFields) { display_result_fields.Add(data_from_display_field(item, metadataField.SolrCode) ?? String.Empty); } resultConverted.Metadata_Display_Values = display_result_fields.ToArray(); // Done with this first item first_item = false; } // Add the item v5_Solr_Item_Result itemResult = new v5_Solr_Item_Result(); itemResult.VID = item.DID.Substring(11, 5); itemResult.Title = item.Title ?? "NO TITLE"; itemResult.MainThumbnail = item.MainThumbnail; resultConverted.Items.Add(itemResult); } return(resultConverted); }