/// <summary> Constructor for a new instance of the Text_Search_ItemViewer class, which allows the full text of an /// individual resource to be searched and individual matching pages are displayed with page thumbnails </summary> /// <param name="BriefItem"> Digital resource object </param> /// <param name="CurrentUser"> Current user, who may or may not be logged on </param> /// <param name="CurrentRequest"> Information about the current request </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public Text_Search_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer) { Tracer.Add_Trace("Text_Search_ItemViewer.Constructor"); // Save the arguments for use later this.BriefItem = BriefItem; this.CurrentUser = CurrentUser; this.CurrentRequest = CurrentRequest; // Set the behavior properties to the empy behaviors ( in the base class ) Behaviors = EmptyBehaviors; if (!String.IsNullOrWhiteSpace(CurrentRequest.Text_Search)) { List <string> terms = new List <string>(); List <string> web_fields = new List <string>(); // Split the terms correctly SobekCM_Assistant.Split_Clean_Search_Terms_Fields(CurrentRequest.Text_Search, "ZZ", Search_Type_Enum.Basic, terms, web_fields, null, Search_Precision_Type_Enum.Contains, '|'); Tracer.Add_Trace("Text_Search_ItemViewer.Constructor", "Performing Solr/Lucene search"); int page = CurrentRequest.SubPage.HasValue ? Math.Max(CurrentRequest.SubPage.Value, ((ushort)1)) : 1; results = Solr_Page_Results.Search(BriefItem.BibID, BriefItem.VID, terms, 20, page, false); Tracer.Add_Trace("Text_Search_ItemViewer.Constructor", "Completed Solr/Lucene search in " + results.QueryTime + "ms"); } }
/// <summary> This provides an opportunity for the viewer to perform any pre-display work /// which is necessary before entering any of the rendering portions </summary> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <remarks> This method his class pulls any full-text search results for this single item from the Solr/Lucene engine </remarks> public override void Perform_PreDisplay_Work(Custom_Tracer Tracer) { if (CurrentMode.Text_Search.Length > 0) { List <string> terms = new List <string>(); List <string> web_fields = new List <string>(); // Split the terms correctly SobekCM_Assistant.Split_Clean_Search_Terms_Fields(CurrentMode.Text_Search, "ZZ", Search_Type_Enum.Basic, terms, web_fields, null, Search_Precision_Type_Enum.Contains, '|'); Tracer.Add_Trace("Text_Search_Item_Viewer.Perform_PreDisplay_Work", "Performing Solr/Lucene search"); results = Solr_Page_Results.Search(CurrentItem.BibID, CurrentItem.VID, terms, 20, CurrentMode.SubPage, false); Tracer.Add_Trace("Text_Search_Item_Viewer.Perform_PreDisplay_Work", "Completed Solr/Lucene search in " + results.QueryTime + "ms"); } }