예제 #1
0
        /// <summary>
        /// Perform a set based deletes using the specified index.
        /// </summary>
        /// <param name="indexName">Name of the index.</param>
        /// <param name="queryToDelete">The query to delete.</param>
        /// <param name="allowStale">if set to <c>true</c> [allow stale].</param>
        public void DeleteByIndex(string indexName, IndexQuery queryToDelete, bool allowStale)
        {
            CurrentOperationContext.Headers.Value = OperationsHeaders;
            var databaseBulkOperations = new DatabaseBulkOperations(database, TransactionInformation);

            databaseBulkOperations.DeleteByIndex(indexName, queryToDelete, allowStale);
        }
예제 #2
0
        public HttpResponseMessage BulkDelete(string id)
        {
            var indexDefinition = Database.IndexDefinitionStorage.GetIndexDefinition(id);

            if (indexDefinition == null)
            {
                throw new IndexDoesNotExistsException(string.Format("Index '{0}' does not exist.", id));
            }

            if (indexDefinition.IsMapReduce)
            {
                throw new InvalidOperationException("Cannot execute DeleteByIndex operation on Map-Reduce indexes.");
            }

            // we don't use using because execution is async
            var cts     = new CancellationTokenSource();
            var timeout = cts.TimeoutAfter(DatabasesLandlord.SystemConfiguration.DatabaseOperationTimeout);

            var databaseBulkOperations = new DatabaseBulkOperations(Database, GetRequestTransaction(), cts, timeout);

            return(OnBulkOperation((index, query, options, reportProgress) => databaseBulkOperations.DeleteByIndex(index, query, options, reportProgress), id, timeout));
        }
        public void DeleteByIndex(string indexName, IndexQuery queryToDelete, bool allowStale)
        {
            var databaseBulkOperations = new DatabaseBulkOperations(database, RavenTransactionAccessor.GetTransactionInformation());

            databaseBulkOperations.DeleteByIndex(indexName, queryToDelete, allowStale);
        }