Ejemplo n.º 1
0
 public void Initialize()
 {
     foreach (var index in _indexCreator.Create())
     {
         _examineManager.AddIndex(index);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the application indexes
        /// </summary>
        /// <param name="examineManager"></param>
        public void CreateIndexes(IExamineManager examineManager)
        {
            var adFactory = new AzureDirectoryFactory();

            var simple2Indexer = examineManager.AddIndex(
                new LuceneIndex(
                    "Simple2Indexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/Simple2IndexSet")))));

            var secondIndexer = examineManager.AddIndex(
                new LuceneIndex(
                    "SecondIndexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/SecondIndexSet")))));

            var azureIndexer = examineManager.AddIndex(
                new AzureSearchIndex("AzureIndex", "examine-test", "F72FFB987CF9FEAF57EC007B7A2A592D",

                                     //TODO: Azure Search needs a static definition of fields! ack!
                                     //However in the Azure Portal it says: Existing fields cannot be changed or deleted. New fields can be added to an existing index at any time.

                                     new FieldDefinitionCollection(
                                         new FieldDefinition("Column1", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column2", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column3", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column4", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column5", FieldDefinitionTypes.FullText),
                                         new FieldDefinition("Column6", FieldDefinitionTypes.FullText))));

            var multiSearcher = examineManager.AddSearcher(
                new MultiIndexSearcher(
                    "MultiIndexSearcher",
                    new[] { simple2Indexer, secondIndexer }));
        }
        public void Initialize()
        {
            //TODO: Remove this entire check for 8.1.2
            var examineEnabled = _mainDom.Register(() => {});

            if (!examineEnabled)
            {
                return;
            }

            foreach (var index in _pdfIndexCreator.Create())
            {
                //TODO: Remove this block for 8.1.2 since Umbraco will ensure the locks are removed
                if (index is LuceneIndex luceneIndex)
                {
                    var dir = luceneIndex.GetLuceneDirectory();
                    if (IndexWriter.IsLocked(dir))
                    {
                        _logger.Info(typeof(ExaminePdfComponent),
                                     "Forcing index {IndexerName} to be unlocked since it was left in a locked state",
                                     luceneIndex.Name);
                        IndexWriter.Unlock(dir);
                    }
                }

                _examineManager.AddIndex(index);
            }

            MediaCacheRefresher.CacheUpdated += MediaCacheRefresherUpdated;
        }
Ejemplo n.º 4
0
//ToDo: Refactor after reimplement CacheRefresher events
        public void Initialize()
        {
            foreach (var index in _indexCreator.Create())
            {
                _examineManager.AddIndex(index);
                ElasticSearchIndex luceneIndex = (ElasticSearchIndex)index;
            }

            _logger.Debug <ExamineComponent>("Examine shutdown registered with MainDom");

            var registeredIndexers = _examineManager.Indexes.OfType <IIndex>().Count();

            _logger.Info <ExamineComponent>("Adding examine event handlers for {RegisteredIndexers} index providers.",
                                            registeredIndexers);

            // don't bind event handlers if we're not suppose to listen
            if (registeredIndexers == 0)
            {
                return;
            }

            ContentCacheRefresher.CacheUpdated     += ContentCacheRefresherUpdated;
            ContentTypeCacheRefresher.CacheUpdated += ContentTypeCacheRefresherUpdated;
            MediaCacheRefresher.CacheUpdated       += MediaCacheRefresherUpdated;
            MemberCacheRefresher.CacheUpdated      += MemberCacheRefresherUpdated;
        }
 public void Initialize()
 {
     // add the indexes to the index
     foreach (var index in _productIndexCreator.Create())
     {
         _examineManager.AddIndex(index);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates the application indexes
        /// </summary>
        /// <param name="examineManager"></param>
        public void CreateIndexes(IExamineManager examineManager)
        {
            var adFactory = new AzureDirectoryFactory();

            var simple2Indexer = examineManager.AddIndex(
                new LuceneIndex(
                    "Simple2Indexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/Simple2IndexSet")))));

            var secondIndexer = examineManager.AddIndex(
                new LuceneIndex(
                    "SecondIndexer",
                    adFactory.CreateDirectory(
                        new DirectoryInfo(Context.Server.MapPath("~/App_Data/SecondIndexSet")))));

            var multiSearcher = examineManager.AddSearcher(
                new MultiIndexSearcher(
                    "MultiIndexSearcher",
                    new[] { simple2Indexer, secondIndexer }));
        }
Ejemplo n.º 7
0
 public void Initialize()
 {
     foreach (var index in _tweetIndexCreator.Create())
     {
         if (index is LuceneIndex)
         {
             var luceneIndex = index as LuceneIndex;
             var dir         = luceneIndex.GetLuceneDirectory();
             if (IndexWriter.IsLocked(dir))
             {
                 IndexWriter.Unlock(dir);
             }
         }
         _examineManager.AddIndex(index);
     }
 }