/// <summary>
	    /// Generally used for unit testing to use an explicit examine searcher
	    /// </summary>
	    /// <param name="searchProvider"></param>
	    /// <param name="indexProvider"></param>
	    internal DefaultPublishedMediaStore(BaseSearchProvider searchProvider, BaseIndexProvider indexProvider)
		{
		    _searchProvider = searchProvider;
		    _indexProvider = indexProvider;
		}
Пример #2
0
	    /// <summary>
	    /// Generally used for unit testing to use an explicit examine searcher
	    /// </summary>
	    /// <param name="searchProvider"></param>
	    /// <param name="indexProvider"></param>
	    internal PublishedMediaCache(BaseSearchProvider searchProvider, BaseIndexProvider indexProvider)
	    {
		    _searchProvider = searchProvider;
		    _indexProvider = indexProvider;
		}
Пример #3
0
 /// <summary>
 /// Internal constructor used for unit tests
 /// </summary>
 /// <param name="result"></param>
 /// <param name="indexer"></param>
 /// <param name="searcher"></param>
 internal ExamineBackedMedia(SearchResult result, BaseIndexProvider indexer, BaseSearchProvider searcher)
     : this(result)
 {
     _indexer = indexer;
     _searcher = searcher;
 }
        private ExamineIndexerModel CreateModel(BaseIndexProvider indexer)
        {
            var indexerModel = new ExamineIndexerModel()
            {
                IndexCriteria = indexer.IndexerData,
                Name = indexer.Name
            };
            var props = TypeHelper.CachedDiscoverableProperties(indexer.GetType(), mustWrite: false)
                //ignore these properties
                                  .Where(x => !new[] { "IndexerData", "Description", "WorkingFolder" }.InvariantContains(x.Name))
                                  .OrderBy(x => x.Name);
            foreach (var p in props)
            {
                indexerModel.ProviderProperties.Add(p.Name, p.GetValue(indexer, null).ToString());
            }

            var luceneIndexer = indexer as LuceneIndexer;
            if (luceneIndexer != null && luceneIndexer.IndexExists())
            {                
                indexerModel.IsLuceneIndex = true;
                indexerModel.DocumentCount = luceneIndexer.GetIndexDocumentCount();
                indexerModel.FieldCount = luceneIndexer.GetIndexDocumentCount();
                indexerModel.IsOptimized = luceneIndexer.IsIndexOptimized();
                indexerModel.DeletionCount = luceneIndexer.GetDeletedDocumentsCount();                
            }
            return indexerModel;
        }