Пример #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 CreateInternalIndex()
 => new UmbracoContentIndex(
     Constants.UmbracoIndexes.InternalIndexName,
     CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.InternalIndexPath),
     new UmbracoFieldDefinitionCollection(),
     new CultureInvariantWhitespaceAnalyzer(),
     _profilingLogger,
     _languageService,
     _umbracoIndexConfig.GetContentValueSetValidator());