public async Task BuildDtSearchIndexAsync(int workspaceArtifactId, int dtSearchIndexArtifactId) { try { Console2.WriteDisplayStartLine("Building DtSearch Index"); await DtSearchIndexManager.FullBuildIndexAsync(workspaceArtifactId, dtSearchIndexArtifactId, true); Console2.WriteDisplayEndLine("Built DtSearch Index!"); // we will probably need to do some sort of status check. Any larger batch of documents probably would not build fast enough to just move on? } catch (Exception ex) { throw new Exception("An error occured when building DtSearch Index", ex); } }
public async Task <int> CreateDtSearchIndexAsync(int workspaceArtifactId, int keywordSearchArtifactId) { Console2.WriteDisplayStartLine("Creating DtSearch Index"); try { int indexShareCodeArtifactId = DtSearchIndexManager.GetIndexShareLocationAsync(workspaceArtifactId).Result[0].ID; DtSearchIndexRequest dtSearchIndexRequest = new DtSearchIndexRequest { Name = Constants.Search.DtSearchIndex.NAME, Order = Constants.Search.DtSearchIndex.ORDER, SearchSearchID = keywordSearchArtifactId, RecognizeDates = Constants.Search.DtSearchIndex.RECOGNIZE_DATES, SkipNumericValues = Constants.Search.DtSearchIndex.SKIP_NUMERIC_VALUES, IndexShareCodeArtifactID = indexShareCodeArtifactId, EmailAddress = Constants.Search.DtSearchIndex.EMAIL_ADDRESS, NoiseWords = Constants.Search.DtSearchIndex.NOISE_WORDS, AlphabetText = Constants.Search.DtSearchIndex.ALPHABET_TEXT, DirtySettings = Constants.Search.DtSearchIndex.DIRTY_SETTINGS, SubIndexSize = Constants.Search.DtSearchIndex.SUB_INDEX_SIZE, FragmentationThreshold = Constants.Search.DtSearchIndex.FRAGMENTATION_THRESHOLD, Priority = Constants.Search.DtSearchIndex.PRIORITY }; int dtSearchIndexArtifactId = await DtSearchIndexManager.CreateAsync(workspaceArtifactId, dtSearchIndexRequest); if (dtSearchIndexArtifactId == 0) { throw new Exception("Failed to create the DtSearch Index"); } Console2.WriteDebugLine($"DtSearch Index ArtifactId: {dtSearchIndexArtifactId}"); Console2.WriteDisplayEndLine("Created DtSearch Index!"); return(dtSearchIndexArtifactId); } catch (Exception ex) { throw new Exception("An error occured when creating DtSearch Index", ex); } }