public static void AddUpdateLuceneIndex(Tag sampleData) { AddUpdateLuceneIndex(new List<Tag> { sampleData }); }
private static void addToLuceneIndex(Tag Data, IndexWriter writer) { var searchQuery = new TermQuery(new Term("Id", Data.Id.ToString())); writer.DeleteDocuments(searchQuery); var doc = new Document(); doc.Add(new Field("Id", Data.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field("Name", Data.Name, Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(doc); }