/// <summary> /// Add the list of NewsItems to the lucene search index. /// </summary> /// <param name="newsItems">The news items list.</param> public void IndexAdd(IList <INewsItem> newsItems) { if (!UseIndex || newsItems == null) { return; } try { LuceneIndexer indexer = GetIndexer(); indexer.IndexNewsItems(newsItems); } catch (Exception ex) { Log.Error("Failure while add item(s) to search index.", ex); } }
// /// <summary> // /// Re-Index a feed. First, the feed gets removed completely from index, // /// then the items are added to index again. // /// </summary> // /// <param name="feedID">The feed URL.</param> // /// <param name="newsItems">The news items.</param> // public void ReIndex(string feedID, IList newsItems) { // if (!UseIndex) return; // //WASTODO: way too general, we should optimize that: // // re-indexing only the really new items, and remove only // // the purged items: // this.IndexRemove(feedID); // this.IndexAdd(newsItems); // } /// <summary> /// Re-Index a feed. First, the feed gets removed completely from index, /// then the items are added to index again. /// </summary> /// <param name="feed">The feed.</param> /// <param name="items">The NewsItems belonging to the feed</param> public void ReIndex(INewsFeed feed, IList <INewsItem> items) { if (!UseIndex || feed == null) { return; } try { LuceneIndexer indexer = GetIndexer(); indexer.RemoveNewsItems(feed.id); indexer.IndexNewsItems(items); } catch (Exception ex) { Log.Error("Failure while ReIndex item(s) in search index.", ex); } //this.IndexRemove(feed.id); //this.IndexAdd(newsHandler.GetCachedItemsForFeed(feed.link)); }