Exemplo n.º 1
0
        static void Main(string[] args)
        {
            DI.Initialize();

            DI.webCrawler.Initialize();
            DI.DPC.Initialize();

            if (crawl)
            {
                WebCrawler.WebCrawler webCrawler = DI.webCrawler;
                webCrawler.Run();
            }

            Indexer.Indexer indexer = DI.indexer;
            DI.indexer.Initialize(arePagesInMemory, numberOfPagesToLoad);
            DI.ranker.Initialize();
            indexer.Run(numberOfPagesToLoad);
            List <string> urlsOfMatchedDocuments = QueryPages(indexer);

            if (urlsOfMatchedDocuments.Count == 0)
            {
                Console.WriteLine("No matching pages");
            }
            else
            {
                Console.WriteLine("Url of matching pages:");
                foreach (string url in urlsOfMatchedDocuments)
                {
                    Console.WriteLine(url);
                }
            }
            Console.ReadLine();
        }
Exemplo n.º 2
0
 public static void Initialize()
 {
     ranker         = new Ranker.Ranker();
     indexer        = new Indexer.Indexer();
     urlFilter      = new UrlFilter();
     urlFrontier    = new UrlFrontier();
     indexCreator   = new IndexCreator();
     pageRetriever  = new PageRetriever();
     termContructor = new TermConstructor();
     tokenizer      = new Tokenizer();
     webCrawler     = new WebCrawler.WebCrawler();
     pageDB         = new PageDB();
     DPC            = new DuplicatePageChecker();
     DUC            = new DuplicateURLChecker();
     pageFetcher    = new PageFetcher();
     pageParser     = new PageParser();
 }
Exemplo n.º 3
0
        public static List <string> QueryPages(Indexer.Indexer indexer)
        {
            string query = "Jyllands, jyllandsposten, Amerika, Øl, Cirkus, Fastelavn";

            return(indexer.ProcessQuery(query));
        }