public void Create(Task task,List<int> taskId,List<int> photosId) { List<Tag> tags = new List<Tag>(); foreach (var tagId in taskId) tags.Add(context.Set<Tag>().Find(tagId)); List<Photo> photos = new List<Photo>(); foreach (var photoId in photosId) photos.Add(context.Set<Photo>().Find(photoId)); task.Tags = tags; task.Photos = photos; context.Set<Task>().Add(task); }
public void Delete(Task task) { throw new NotImplementedException(); }
private static void addToLuceneIndex(Task taskData, IndexWriter writer) { var searchQuery = new TermQuery(new Term("Id", taskData.Id.ToString())); writer.DeleteDocuments(searchQuery); var doc = new Document(); doc.Add(new Field("Id", taskData.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field("Name", taskData.Name, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Condition", taskData.Condition, Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(doc); }
public static void AddUpdateLuceneIndex(Task taskData) { AddUpdateLuceneIndex(new List<Task> { taskData }); }
public void CreateIndex(Task task) { Lucene.LuceneSearch.AddUpdateLuceneIndex(task); }