Ejemplo n.º 1
0
        public void Configure(string name, LuceneDirectoryIndexOptions options)
        {
            switch (name)
            {
            case Constants.UmbracoIndexes.InternalIndexName:
                options.Analyzer         = new CultureInvariantWhitespaceAnalyzer();
                options.Validator        = _umbracoIndexConfig.GetContentValueSetValidator();
                options.FieldDefinitions = new UmbracoFieldDefinitionCollection();
                break;

            case Constants.UmbracoIndexes.ExternalIndexName:
                options.Analyzer         = new StandardAnalyzer(LuceneInfo.CurrentVersion);
                options.Validator        = _umbracoIndexConfig.GetPublishedContentValueSetValidator();
                options.FieldDefinitions = new UmbracoFieldDefinitionCollection();
                break;

            case Constants.UmbracoIndexes.MembersIndexName:
                options.Analyzer         = new CultureInvariantWhitespaceAnalyzer();
                options.Validator        = _umbracoIndexConfig.GetMemberValueSetValidator();
                options.FieldDefinitions = new UmbracoFieldDefinitionCollection();
                break;
            }

            // ensure indexes are unlocked on startup
            options.UnlockIndex = true;

            if (_settings.LuceneDirectoryFactory == LuceneDirectoryFactory.SyncedTempFileSystemDirectoryFactory)
            {
                // if this directory factory is enabled then a snapshot deletion policy is required
                options.IndexDeletionPolicy = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
            }
        }
 private IIndex CreateExternalIndex()
 => new UmbracoContentIndex(
     Constants.UmbracoIndexes.ExternalIndexName,
     CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.ExternalIndexPath),
     new UmbracoFieldDefinitionCollection(),
     new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30),
     _profilingLogger,
     _languageService,
     _umbracoIndexConfig.GetPublishedContentValueSetValidator());