Exemple #1
0
        // RemoveTreeActivity, RebuildActivity
        internal async STT.Task <bool> DeleteDocumentsAsync(IEnumerable <SnTerm> deleteTerms, VersioningInfo versioning, CancellationToken cancellationToken)
        {
            await IndexingEngine.WriteIndexAsync(deleteTerms, null, null, cancellationToken).ConfigureAwait(false);

            // Not necessary to check if indexing interfered here. If it did, change is detected in overlapped AddDocument/UpdateDocument
            // operations and refresh (re-delete) is called there.
            // Delete documents will never detect changes in index, since it sets timestamp in index history to maxvalue.

            return(true);
        }
Exemple #2
0
        // AddTreeActivity
        internal static async STT.Task <bool> AddTreeAsync(string treeRoot, int activityId,
                                                           bool executingUnprocessedActivities, CancellationToken cancellationToken)
        {
            var delTerms          = executingUnprocessedActivities ? new [] { new SnTerm(IndexFieldName.InTree, treeRoot) } : null;
            var excludedNodeTypes = GetNotIndexedNodeTypes();
            var docs = SearchManager.LoadIndexDocumentsByPath(treeRoot, excludedNodeTypes).Select(CreateIndexDocument);
            await IndexingEngine.WriteIndexAsync(delTerms, null, docs, cancellationToken).ConfigureAwait(false);

            return(true);
        }
Exemple #3
0
        /* AddDocumentActivity, RebuildActivity */
        internal async STT.Task <bool> AddDocumentAsync(IndexDocument document, VersioningInfo versioning, CancellationToken cancellationToken)
        {
            var delTerms = versioning.Delete.Select(i => new SnTerm(IndexFieldName.VersionId, i)).ToArray();
            var updates  = GetUpdates(versioning);

            if (document != null)
            {
                SetDocumentFlags(document, versioning);
            }

            await IndexingEngine.WriteIndexAsync(delTerms, updates, new[] { document }, cancellationToken).ConfigureAwait(false);

            return(true);
        }
Exemple #4
0
        /* ==================================================================== Document operations */

        /* ClearAndPopulateAll */
        public STT.Task AddDocumentsAsync(IEnumerable <IndexDocument> documents, CancellationToken cancellationToken)
        {
            return(IndexingEngine.WriteIndexAsync(null, null, documents, cancellationToken));
        }