Example #1
0
        public void BuildInvertedIndex()
        {
            string  content = "included definitely in";
            Website web     = new Website {
                Url = testUrl
            };
            var index = new InvertedIndex <Website>();

            processor.PopulateIndex(index, content, web);

            foreach (var word in content.Split(' '))
            {
                Assert.IsTrue(index.ContainsKey(word));
            }
        }
Example #2
0
        public async Task <IActionResult> Get(string id)
        {
            using (var worker = new ProcessorWorker(httpHandler))
            {
                Website website = await repository[id];
                if (website == null)
                {
                    return(NotFound());
                }

                string websiteContent = await worker.GetWebsiteContent(website, ContentProcessor);

                worker.PopulateIndex(indexRepository.Index, websiteContent, website);
                await repository.UpdateWebsite(website);

                await indexRepository.UpdateRepo();

                return(Ok());
            }
        }