Esempio n. 1
0
        public ReindexResponse Reindex(IndexDefinition index, List <Guid> ids = null)
        {
            ReindexResponse reindexResponse = new ReindexResponse();

            while (true)
            {
                using (var db = this._dataContextFactory.Create())
                {
                    if (ids == null || !ids.Any())
                    {
                        const int batchSize = 100;

                        var processed = index.PerformIndexing(_client, db, batchSize: batchSize, batchSkip: reindexResponse.TotalProcessed);
                        reindexResponse.TotalProcessed += processed;

                        if (processed < batchSize)
                        {
                            break;
                        }
                    }
                    else
                    {
                        reindexResponse.TotalProcessed += index.PerformIndexing(_client, db, ids);
                        break;
                    }
                }
            }

            return(reindexResponse);
        }
Esempio n. 2
0
        public ReindexResponse MergeWith(ReindexResponse other)
        {
            Success        &= other.Success;
            TotalProcessed += other.TotalProcessed;

            return(this);
        }