private static void UpdateFarmInIndex(Farm farm, IndexWriter indexWriter, ApplicationDbContext db) { var doc = CreateDocumentFromFarm(farm); indexWriter.UpdateDocument(new Term("id", farm.FarmId.ToString()), doc); db.Entry(farm).State = EntityState.Modified; farm.IndexDateTime = DateTime.Now; }
private void AddFarmToIndex(Farm farm, IndexWriter indexWriter, ApplicationDbContext db) { var doc = CreateDocumentFromFarm(farm); indexWriter.AddDocument(doc); db.Entry(farm).State = EntityState.Modified; farm.IndexDateTime = DateTime.Now; }