public IEnumerable <SimpleDataSet> GetAllData(string indexType) { //Before getting all data, we need to make sure that the docs are available from GitHub ZipDownloader.EnsureGitHubDocs(); var config = DocumentationIndexConfig.Settings; var fullPath = HttpContext.Current.Server.MapPath(config.DirectoryToIndex); var directory = new DirectoryInfo(fullPath); var files = config.Recursive ? directory.GetFiles(config.SupportedFileTypes, SearchOption.AllDirectories) : directory.GetFiles(config.SupportedFileTypes); var i = 0; //unique id for each doc foreach (var file in files) { i++; var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary <string, string>() }; simpleDataSet = ExamineHelper.MapFileToSimpleDataIndexItem(file, simpleDataSet, i, indexType); yield return(simpleDataSet); } }
public IEnumerable <SimpleDataSet> GetAllData(string indexType) { var config = DocumentationIndexConfig.Settings; var fullPath = HostingEnvironment.MapPath(config.DirectoryToIndex); var directory = new DirectoryInfo(fullPath); var files = config.Recursive ? directory.GetFiles(config.SupportedFileTypes, SearchOption.AllDirectories) : directory.GetFiles(config.SupportedFileTypes); var i = 0; //unique id for each doc foreach (var file in files) { i++; var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary <string, string>() }; simpleDataSet = ExamineHelper.MapFileToSimpleDataIndexItem(file, simpleDataSet, i, indexType); yield return(simpleDataSet); } }
public IEnumerable <SimpleDataSet> GetAllData(string indexType) { var config = DocumentationIndexConfig.Settings; var fullPath = HostingEnvironment.MapPath(config.DirectoryToIndex); var directory = new DirectoryInfo(fullPath); var files = config.Recursive ? directory.GetFiles(config.SupportedFileTypes, SearchOption.AllDirectories) : directory.GetFiles(config.SupportedFileTypes); var i = 0; //unique id for each doc foreach (var file in files) { i++; var simpleDataSet = new SimpleDataSet { NodeDefinition = new IndexedNode(), RowData = new Dictionary <string, string>() }; try { simpleDataSet = ExamineHelper.MapFileToSimpleDataIndexItem(file, simpleDataSet, i, indexType); } catch (Exception ex) { Umbraco.Core.Logging.LogHelper.Error <DocumentationIndexDataService>( $"Indexing docs - could not parse document {file.FullName}", ex); if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Break(); } } yield return(simpleDataSet); } Umbraco.Core.Logging.LogHelper.Info <DocumentationIndexDataService>( $"Indexed documentation files: {0}", () => files.Length); }