public Spider(Frontier frontier, Index index, Filtering.Filter filter, Action <Index> callback) { this.frontier = frontier; this.index = Index.CreateEmptyCopy(index); this.filter = filter; this.callback = callback; }
public Spider(Frontier frontier, Index index, Filtering.Filter filter, Action<Index> callback) { this.frontier = frontier; this.index = Index.CreateEmptyCopy(index); this.filter = filter; this.callback = callback; }
public static void StartAndWait(Frontier frontier, Index index, Filtering.Filter filter, int pagecount) { int count = (int)Math.Ceiling(pagecount / (double)SPIDER_PAGE_COUNT); Spider[] spiders = new Spider[count]; Thread[] threads = new Thread[count]; for (int i = 0; i < count; i++) { Spider sp = spiders[i] = new Spider(frontier, index, filter, ind => { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Merging Index of {0}", ind.SiteCount); Console.ForegroundColor = ConsoleColor.Gray; lock (index) { index.MergeIn(ind); } }); threads[i] = new Thread(() => sp.Run()); threads[i].Start(); } for (int i = 0; i < count; i++) { threads[i].Join(); } }