private async Task ReindexProjectAsync(Guid projectId)
        {
            var project = await _projectRepository.FindAsync(projectId);

            if (project == null)
            {
                throw new Exception("Cannot find the project with the Id " + projectId);
            }

            var docs = (await _documentRepository.GetListByProjectId(project.Id))
                       .Where(doc => doc.FileName != project.NavigationDocumentName && doc.FileName != project.ParametersDocumentName)
                       .ToList();
            await _elasticSearchService.DeleteAllByProjectIdAsync(project.Id);

            if (docs.Any())
            {
                await _elasticSearchService.AddOrUpdateManyAsync(docs);
            }
        }
Exemple #2
0
        public async Task ReindexAsync(ReindexInput input)
        {
            var project = await _projectRepository.GetAsync(input.ProjectId);

            await _documentFullSearch.DeleteAllByProjectIdAsync(project.Id);

            var docs = await _documentRepository.GetListByProjectId(project.Id);

            foreach (var doc in docs)
            {
                if (doc.FileName == project.NavigationDocumentName)
                {
                    continue;
                }

                if (doc.FileName == project.ParametersDocumentName)
                {
                    continue;
                }

                await _documentFullSearch.AddOrUpdateAsync(doc);
            }
        }