Example #1
0
        public void RebuildIndexes(IEnumerable <string> stemmerNames, Action <double> progressReporter = null)
        {
            Check.DoRequireArgumentNotNull(stemmerNames, nameof(stemmerNames));

            FulltextBackgroundTaskExecutor.Schedule(() =>
            {
                FulltextStatusSummary = $"Rebuilding {string.Join(", ", stemmerNames)}.";
                SearchEngine.RebuildIndexes(stemmerNames, Storage.GetAll(), Storage.CountAll(),
                                            (progress) =>
                {
                    FulltextTaskCompletion = progress;
                    progressReporter?.Invoke(progress);
                });
            });
        }
Example #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    // dispose managed state (managed objects).
                    FulltextBackgroundTaskExecutor.WaitForAllCurrentTasksToFinish(5000);
                    FulltextBackgroundTaskExecutor.Dispose();

                    Storage?.Dispose();
                    SearchEngine?.Dispose();
                }

                // free unmanaged resources (unmanaged objects) and override a finalizer below.
                // set large fields to null.

                _disposedValue = true;
            }
        }
Example #3
0
 /// <summary>
 ///     Block scheduling of new tasks and wait until already scheduled ones finish.
 /// </summary>
 /// <param name="maxWaitMilliseconds">
 ///     Maximum wait time in milliseconds; must be 0, positive or -1 for infinite.
 ///     When 0, method effectively checks if there are pending tasks.
 /// </param>
 public bool WaitForFulltextBackgroundWorkToComplete(int maxWaitMilliseconds)
 {
     return(FulltextBackgroundTaskExecutor.WaitForAllCurrentTasksToFinish(maxWaitMilliseconds));
 }