/// <summary> /// Main search method. /// </summary> /// <returns>Array of search results.</returns> public List <ISearchEngineResultItem> Search() { int maxNoOfResults = Int32.Parse(MaxNoOfResults); if (ProviderAttributes[MaxNoOfResults] != null) { Int32.TryParse(ProviderAttributes[MaxNoOfResults], out maxNoOfResults); } CalendarEventArgs args = new CalendarEventArgs(); args.SearchPhrase = SearchPhrase; args.MaximumNumberOfItems = maxNoOfResults; EntityCollection <CalendarEventEntity> collection = DependencyInjectionFactory.Resolve <ICalendarEventBLL>(). GetCalendarEvents(args); List <ISearchEngineResultItem> results = new List <ISearchEngineResultItem>(); foreach (CalendarEventEntity CalEvent in collection) { CalendarEventSearchResultItem item = InitializeItem(CalEvent); results.Add(item); } return(results); }
/// <summary> /// Initialize result item. /// </summary> /// <param name="eventEntity">Event entity.</param> /// <returns>Result item.</returns> protected virtual CalendarEventSearchResultItem InitializeItem(CalendarEventEntity eventEntity) { CalendarEventSearchResultItem item = new CalendarEventSearchResultItem(this); string eventUrl = GetEventViewUrl(eventEntity); item.Title = String.Format("<a href='{0}' title='{1}'>{1}</a>", ClearSearchQueryParams(eventUrl), eventEntity.Title); item.Url = String.Empty; string description = GetFormattedEventDescription(eventEntity); if (ProviderAttributes[BoldSearchPhrasesParam] != null) { if (bool.Parse(ProviderAttributes[BoldSearchPhrasesParam])) { SearchEngineCore.BoldSearchPhrases(SearchPhrase, ref description); } } item.Description = description; item.Related = String.Empty; return(item); }
/// <summary> /// Initialize result item. /// </summary> /// <param name="eventEntity">Event entity.</param> /// <returns>Result item.</returns> protected virtual CalendarEventSearchResultItem InitializeItem(CalendarEventEntity eventEntity) { CalendarEventSearchResultItem item = new CalendarEventSearchResultItem(this); string eventUrl = GetEventViewUrl(eventEntity); item.Title = String.Format("<a href='{0}' title='{1}'>{1}</a>", ClearSearchQueryParams(eventUrl), eventEntity.Title); item.Url = String.Empty; string description = GetFormattedEventDescription(eventEntity); if (ProviderAttributes[BoldSearchPhrasesParam] != null) if (bool.Parse(ProviderAttributes[BoldSearchPhrasesParam])) SearchEngineCore.BoldSearchPhrases(SearchPhrase, ref description); item.Description = description; item.Related = String.Empty; return item; }