protected PackageSearcherManager(string indexName, Lucene.Net.Store.Directory directory, Rankings rankings, DownloadCounts downloadCounts, FrameworksList frameworks)
            : base(directory)
        {
            Rankings       = rankings;
            DownloadCounts = downloadCounts;
            Frameworks     = frameworks;
            IndexName      = indexName;

            _currentDownloadCounts = new IndexData <IDictionary <int, DownloadCountRecord> >(
                "DownloadCounts",
                DownloadCounts.Path,
                DownloadCounts.Load,
                DownloadCountRefreshRate);
            _currentRankings = new IndexData <IDictionary <string, IDictionary <string, int> > >(
                "Rankings",
                Rankings.Path,
                Rankings.Load,
                RankingRefreshRate);
            _currentFrameworkList = new IndexData <IList <FrameworkName> >(
                "FrameworkList",
                Frameworks.Path,
                Frameworks.Load,
                FrameworksRefreshRate);

            Id = Guid.NewGuid(); // Used for identifying changes to the searcher manager at runtime.
        }
        public static PackageSearcherManager CreateAzure(
            CloudStorageAccount storageAccount,
            string indexContainer      = null,
            string dataContainer       = null,
            bool requireDownloadCounts = true)
        {
            if (String.IsNullOrEmpty(indexContainer))
            {
                indexContainer = "ng-search-index";
            }

            string dataPath = String.Empty;

            if (String.IsNullOrEmpty(dataContainer))
            {
                dataContainer = indexContainer;
                dataPath      = "data/";
            }

            DownloadCounts downloadCounts = requireDownloadCounts
                    ?
                                            (DownloadCounts) new StorageDownloadCounts(storageAccount, dataContainer, dataPath + DownloadCounts.FileName)
                    :
                                            (DownloadCounts) new EmptyDownloadCounts();

            return(new PackageSearcherManager(
                       indexContainer,
                       new AzureDirectory(storageAccount, indexContainer, new RAMDirectory()),
                       new StorageRankings(storageAccount, dataContainer, dataPath + Rankings.FileName),
                       downloadCounts,
                       new StorageFrameworksList(storageAccount, dataContainer, dataPath + FrameworksList.FileName)));
        }