Ejemplo n.º 1
0
 /// <summary>
 /// Remove the list of NewsItems from the lucene search index.
 /// </summary>
 /// <param name="newsItems">The news items list.</param>
 public void IndexRemove(INewsItem[] newsItems)
 {
     if (!UseIndex || newsItems == null)
     {
         return;
     }
     try {
         LuceneIndexer indexer = GetIndexer();
         indexer.RemoveNewsItems(newsItems);
     } catch (Exception ex) {
         Log.Error("Failure while remove item(s) from search index.", ex);
     }
 }
Ejemplo n.º 2
0
//		/// <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));
        }