Пример #1
0
        /// <summary>
        /// Inform the commit policy of index updates. After the specified number
        /// of updates, invoke the rules engine to determine whether to
        /// commit changes to the index to disk and optimize the index.
        /// </summary>
        /// <param name="context">Index processing context.</param>
        /// <param name="operation">Index operation.</param>
        public void IndexModified(
            CS.IProviderUpdateContext context,
            CS.IndexOperation operation)
        {
            this._lastContext = context;
            context.CommitPolicy.IndexModified(operation);

            lock (this)
            {
                // for the RulesBasedCommitPolicy providder,
                // it is important to call ShouldCommit before ShouldOptimize

                if (SC.Sharedsource.Pipelines.Shutdown.FinalizeIndexes.FinalizeImmediately ||
                    context.CommitPolicy.ShouldCommit)
                {
                    context.Commit();
                }

                SC.Sharedsource.ContentSearch.RulesBasedCommitPolicy policy =
                    context.CommitPolicy as SC.Sharedsource.ContentSearch.RulesBasedCommitPolicy;

                if (policy == null)
                {
                    return;
                }

                if (policy.ShouldOptimize)
                {
                    context.Optimize();
                    policy.ShouldOptimize = false;
                }
            }
        }
 /// <summary>
 /// Increment the potential number of items updated since the last commit.
 /// </summary>
 /// <param name="operation">Indexing operation.</param>
 public void IndexModified(CS.IndexOperation operation)
 {
     ++this._count;
 }
 public void IndexModified(CS.IndexOperation operation)
 {
     this._wrappedPolicy.IndexModified(operation);
 }