コード例 #1
0
 /// <summary>
 /// Get the details for searchers
 /// </summary>
 /// <returns></returns>
 public IEnumerable<ExamineSearcherModel> GetSearcherDetails()
 {
     var model = new List<ExamineSearcherModel>(
         ExamineManager.Instance.SearchProviderCollection.Cast<BaseSearchProvider>().Select(searcher =>
         {
             var indexerModel = new ExamineIndexerModel()
             {
                 Name = searcher.Name
             };
             var props = TypeHelper.CachedDiscoverableProperties(searcher.GetType(), mustWrite: false)
                 //ignore these properties
                                   .Where(x => !new[] { "Description" }.InvariantContains(x.Name))
                                   .OrderBy(x => x.Name);
             foreach (var p in props)
             {
                 indexerModel.ProviderProperties.Add(p.Name, p.GetValue(searcher, null).ToString());
             }
             return indexerModel;
         }));
     return model;
 }
コード例 #2
0
        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;
        }