Ejemplo n.º 1
0
        //add to the UrlTable
        public void addToTable(string url, string title, string date)
        {
            string[] keywords = title.Split(' ');

            foreach (string keyword in keywords)
            {
                string keywordTrim = keyword.Trim(new char[] { ' ', '-', '\'', '\"', ',' }).ToLower();
                //Debug.WriteLine(keyword);
                WebPage page = new WebPage(url, title, keywordTrim, date);
                //add page to table
                if (keywordTrim != " " && keywordTrim != null && keywordTrim != "")
                {
                    TableOperation insertOperation = TableOperation.Insert(page);
                    StorageManager.getTable().Execute(insertOperation);
                }

                //add performance and increase index counter
                var crawled   = 0;
                var sizeQueue = 0;
                var sizeIndex = 0;
                TableQuery <Performance> query3 = new TableQuery <Performance>()
                                                  .Take(1);

                foreach (Performance item in StorageManager.getPerformanceTable().ExecuteQuery(query3))
                {
                    crawled   = item.NumCrawled;
                    sizeQueue = item.SizeQueue;
                    sizeIndex = item.SizeIndex + 1;
                }

                Performance.insertPerformance("Crawling", crawled, sizeQueue, sizeIndex);
            }
        }
Ejemplo n.º 2
0
        //add to the UrlTable
        public void addToTable(string url, string title, string date)
        {
            WebPage page = new ClassLibrary1.WebPage(url, title, date);

            //add page to table
            TableOperation insertOrReplaceOperation = TableOperation.InsertOrReplace(page);

            StorageManager.getTable().Execute(insertOrReplaceOperation);

            SizeCounter.SizeIndex += 1;

            CloudQueueMessage message2 = new CloudQueueMessage(SizeCounter.SizeIndex.ToString());

            StorageManager.getNumIndex().AddMessage(message2);

            Performance.insertPerformance("Crawling");
        }