Esempio n. 1
0
        public IEnumerable<Site.SpellcheckResult> CheckPages(Guid siteId, IEnumerable<Guid> pageIds, Site.SpellcheckConfigurations configurations)
        {
            var results = new List<Site.SpellcheckResult>();

            foreach (var pageId in pageIds)
            {
                var page = _blobs.Get<PageProfile>(new BlobReference(siteId, pageId));
                var config = configurations.GetFor(page.Url);

                if (config == null) continue;

                var spellchecker = _spellcheckerFactory.CreateFor(config.PrimaryLanguageKey, config.SecondaryLanguageKey);
                var result = spellchecker.Check(page.Text);

                if (result.HasData)
                {
                    results.Add(new Site.SpellcheckResult
                    {
                        PageId = pageId,
                        ConfirmedMisspellings = result.Misspellings,
                        PotentialMisspellings = result.PotentialMisspellings,
                        SiteId = siteId
                    });
                }
            }

            return results;
        }