/// <summary> /// Bulks the index documents. /// </summary> public void BulkIndexDocuments() { List <IndexModelBase> indexableItems = new List <IndexModelBase>(); RockContext rockContext = new RockContext(); // return people var documents = new DocumentService(rockContext).Queryable().AsNoTracking(); int recordCounter = 0; foreach (var document in documents) { var indexableDocument = DocumentIndex.LoadByModel(document); indexableItems.Add(indexableDocument); recordCounter++; if (recordCounter > 100) { IndexContainer.IndexDocuments(indexableItems); indexableItems = new List <IndexModelBase>(); recordCounter = 0; } } IndexContainer.IndexDocuments(indexableItems); }
/// <summary> /// Indexes the document. /// </summary> /// <param name="id"></param> public void IndexDocument(int id) { var documentEntity = new DocumentService(new RockContext()).Get(id); var indexItem = DocumentIndex.LoadByModel(documentEntity); IndexContainer.IndexDocument(indexItem); }