Example #1
0
        async Task CreateLuceneIndex(Uri catalogIndex, Func<StorageHttpMessageHandler> handlerFunc, CancellationToken cancellationToken)
        {
            Lucene.Net.Store.Directory luceneDirectory = new RAMDirectory();

            var collector = new SearchIndexFromCatalogCollector(
                catalogIndex,
                luceneDirectory,
                null,
                handlerFunc);

            await collector.Run(
                new MemoryCursor(DateTime.MinValue.ToUniversalTime()),
                new MemoryCursor(DateTime.MaxValue.ToUniversalTime()),
                cancellationToken);

            ILogger logger = new DebugLogger("Lucene");
            ILoader loader = new AuxillaryIndexLoader();

            SearcherManager = new NuGetSearcherManager("memory", logger, luceneDirectory, loader);
            SearcherManager.RegistrationBaseAddress["http"] = new Uri(_baseAddress, Registration);
            SearcherManager.RegistrationBaseAddress["https"] = new Uri(_baseAddress, Registration);
            SearcherManager.Open();
        }